Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sections-landing #207

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 87 additions & 3 deletions app/[locale]/institute/sections/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,93 @@
import { WorkInProgressStatus } from '~/components/status';
import Link from 'next/link';
import { Fragment } from 'react';
import { IconType } from 'react-icons';
import { BsHddNetworkFill } from 'react-icons/bs';
import {
MdLibraryBooks,
MdOutlineAccountBalance,
MdOutlineAdminPanelSettings,
MdOutlineElectricalServices,
MdOutlineGroupWork,
MdOutlineHealthAndSafety,
MdOutlineRealEstateAgent,
MdOutlineSecurity,
MdOutlineSportsTennis,
MdOutlineStore,
} from 'react-icons/md';

export default function Sections({
import Heading from '~/components/heading';
import { getTranslations } from '~/i18n/translations';
import { cn } from '~/lib/utils';
import { db } from '~/server/db';

export default async function Sections({
params: { locale },
}: {
params: { locale: string };
}) {
return <WorkInProgressStatus locale={locale} />;
const sections = await db.query.sections.findMany();
console.log('section =>', sections);

const sectionIcons: Record<string, IconType> = {
accounts: MdOutlineAccountBalance,
heydoyouknowme0 marked this conversation as resolved.
Show resolved Hide resolved
'central-workshop': MdOutlineGroupWork,
'centre-of-computing-networking': BsHddNetworkFill,
KambojRajan marked this conversation as resolved.
Show resolved Hide resolved
'electrical-maintenance': MdOutlineElectricalServices,
estate: MdOutlineRealEstateAgent,
'general-administration': MdOutlineAdminPanelSettings,
'health-centre': MdOutlineHealthAndSafety,
library: MdLibraryBooks,
security: MdOutlineSecurity,
sports: MdOutlineSportsTennis,
store: MdOutlineStore,
};
const text = (await getTranslations(locale)).Sections;
KambojRajan marked this conversation as resolved.
Show resolved Hide resolved

return (
<main className="container">
<Heading
glyphDirection="dual"
heading="h1"
text={text.title.toUpperCase()}
/>
<Fragment>
<ul
className={cn(
'container mb-2 sm:mb-4 lg:mb-6 xl:mb-8',
'grid grid-cols-1 gap-2',
'sm:grid-cols-2 sm:gap-4',
'lg:grid-cols-3 lg:gap-6',
'xl:grid-cols-4 xl:gap-8'
)}
>
{sections.map((section, i) => {
const Icon = sectionIcons[section.urlName];
if (!Icon) return null;
return (
<li key={i}>
<Link
className={cn(
'flex items-center gap-2 sm:gap-3 lg:gap-4',
'bg-neutral-50 font-serif text-primary-700',
'rounded p-2 drop-shadow hover:drop-shadow-lg xl:p-3'
)}
href={`/${locale}/institute/sections/${section.urlName}`}
>
<Icon
className={cn(
'size-8 p-1',
'sm:h-12 sm:min-w-12 sm:p-3',
'lg:h-20 lg:min-w-20 lg:p-5',
'rounded bg-primary-700 fill-neutral-50 drop-shadow'
)}
/>
<span className="text-lg">{section.name.toUpperCase()}</span>
</Link>
</li>
);
})}
</ul>
</Fragment>
</main>
);
}
3 changes: 3 additions & 0 deletions i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ Saturdays & Holidays: 09.00 am to 05.00 pm`,
Sports: {},
Store: {},
},
Sections: {
title: 'Sections',
},
Status: {
NoResult: {
title: 'No results found',
Expand Down
3 changes: 3 additions & 0 deletions i18n/hi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ const text: Translations = {
Sports: {},
Store: {},
},
Sections: {
title: 'प्रशासनिक और अवसंरचना सेवाएँ',
},
Status: {
NoResult: {
title: 'कोई परिणाम नहीं मिला',
Expand Down
3 changes: 3 additions & 0 deletions i18n/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ export interface Translations {
Sports: {};
Store: {};
};
Sections: {
title: string;
};
Status: {
NoResult: { title: string; description: string };
Unauthorised: { title: string; description: string };
Expand Down
KambojRajan marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
8 changes: 8 additions & 0 deletions server/db/schema/event.shema.ts
KambojRajan marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { date, pgTable, serial, varchar } from 'drizzle-orm/pg-core';

export const event = pgTable('event', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 128 }).notNull(),
description: varchar('description', { length: 256 }).notNull(),
date: date('date').notNull(),
});