Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default async function BoardOfGovernors({
searchParams,
}: {
params: { locale: string };
searchParams: { meetingPage?: string };
searchParams: { page?: string };
}) {
return (
<Committee locale={locale} searchParams={searchParams} type="governor" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function BuildingAndWorkCommittee({
searchParams,
}: {
params: { locale: string };
searchParams: { meetingPage?: string };
searchParams: { page?: string };
}) {
return (
<Committee locale={locale} searchParams={searchParams} type="building" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export default async function Committee({
type,
}: {
locale: string;
searchParams: { meetingPage?: string };
searchParams: { page?: string };
type: (typeof committeeMembers.committeeType.enumValues)[number];
}) {
const text = (await getTranslations(locale)).Committee;

const meetingPage = isNaN(Number(searchParams.meetingPage ?? '1'))
const meetingPage = isNaN(Number(searchParams.page ?? '1'))
? 1
: Math.max(Number(searchParams.meetingPage ?? '1'), 1);
: Math.max(Number(searchParams.page ?? '1'), 1);

return (
<section className="container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function FinancialCommittee({
searchParams,
}: {
params: { locale: string };
searchParams: { meetingPage?: string };
searchParams: { page?: string };
}) {
return (
<Committee locale={locale} searchParams={searchParams} type="financial" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default async function Senate({
searchParams,
}: {
params: { locale: string };
searchParams: { meetingPage?: string };
searchParams: { page?: string };
}) {
return (
<>
Expand Down
201 changes: 201 additions & 0 deletions app/[locale]/research/patents-and-technologies/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
import { Suspense } from 'react';

import Loading from '~/components/loading';
import ImageHeader from '~/components/image-header';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '~/components/ui';
import { PaginationWithLogic } from '~/components/pagination/pagination';
import { getTranslations } from '~/i18n/translations';

export default async function PatentsAndTechnology({
params: { locale },
searchParams,
}: {
params: { locale: string };
searchParams?: { page?: string };
}) {
const currentPage = Number(searchParams?.page ?? 1);

const text = (await getTranslations(locale)).PatentsAndTechnologies;

// Static patent data
const staticPatents = [
{
applicationNumber: '2269/DEL/2012',
patentNumber: '320045',
title: 'Intelligent induction hardening device and method thereof',
inventors: [
{
facultyId: 'jitender_kumar_chhabra_1',
name: 'Jitender Kumar Chhabra',
},
],
},
{
applicationNumber: '2269/DEL/2012',
patentNumber: '320045',
title:
'Method of preventing radioactive gas to diffuse indoor environment by forming concrete with shielding effect',
inventors: [
{
facultyId: 'jitender_kumar_chhabra_2',
name: 'Jitender Kumar Chhabra',
},
],
},
{
applicationNumber: '2269/DEL/2012',
patentNumber: '320045',
title: 'System for extracting water from atmospheric air',
inventors: [
{
facultyId: 'jitender_kumar_chhabra_3',
name: 'Jitender Kumar Chhabra',
},
],
},
{
applicationNumber: '2269/DEL/2012',
patentNumber: '320045',
title: 'System for extracting water from atmospheric air',
inventors: [
{
facultyId: 'jitender_kumar_chhabra_4',
name: 'Jitender Kumar Chhabra',
},
],
},
{
applicationNumber: '3001/DEL/2013',
patentNumber: '320046',
title: 'Advanced solar energy harvesting system',
inventors: [
{
facultyId: 'jitender_kumar_chhabra_5',
name: 'Jitender Kumar Chhabra',
},
],
},
{
applicationNumber: '3002/DEL/2013',
patentNumber: '320047',
title: 'Automated waste management and recycling apparatus',
inventors: [
{
facultyId: 'jitender_kumar_chhabra_6',
name: 'Jitender Kumar Chhabra',
},
],
},
];

// Get the total count for pagination
const getPatentCount = async () => {
const count = staticPatents.length; // Replace with your actual DB call
return [{ count }];
};

return (
<>
<ImageHeader
title={text.title}
src="research/patents-and-technologies/banner.jpg"
/>
<section className="container p-8">
<div className="max-h-96 w-full overflow-x-auto">
<Table scrollAreaClassName="h-[23rem] min-w-[500px]">
<TableHeader>
<TableRow>
{[
text.number,
text.applicationNumber,
text.patentNumber,
text.techTitle,
text.inventor,
].map((headerText, index) => (
<TableHead key={index}>{headerText}</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody>
<Suspense
fallback={
<TableRow>
<TableCell colSpan={5}>
<Loading />
</TableCell>
</TableRow>
}
>
<PatentTable
tableData={staticPatents}
currentPage={currentPage}
itemsPerPage={10}
/>
</Suspense>
</TableBody>
</Table>
</div>

<div className="mt-6">
<PaginationWithLogic
currentPage={currentPage}
query={getPatentCount()}
/>
</div>
</section>
</>
);
}

const PatentTable = ({
tableData,
currentPage,
itemsPerPage = 10,
}: {
tableData: {
applicationNumber: string;
patentNumber: string;
title: string;
inventors: {
facultyId: string;
name: string;
}[];
}[];
currentPage: number;
itemsPerPage?: number;
}) => {
const startIndex = (currentPage - 1) * itemsPerPage;
const visibleData = tableData.slice(startIndex, startIndex + itemsPerPage);

return (
<>
{visibleData.map((item, index) => {
const cellData = [
startIndex + index + 1,
item.applicationNumber,
item.patentNumber,
item.title,
item.inventors.map((inventor) => inventor.name).join(', '),
];

return (
<TableRow
key={index}
className="text-neutral-700 hover:bg-neutral-50"
>
{cellData.map((cellContent, cellIndex) => (
<TableCell key={cellIndex}>{cellContent}</TableCell>
))}
</TableRow>
);
})}
</>
);
};
18 changes: 9 additions & 9 deletions components/pagination/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export const PaginationWithLogic = async ({
<PaginationItem>
<PaginationPrevious
disabled={currentPage <= 1}
href={{ query: { meetingPage: currentPage - 1 } }}
href={{ query: { page: currentPage - 1 } }}
/>
</PaginationItem>

<PaginationItem>
<PaginationLink
href={{ query: { meetingPage: 1 } }}
href={{ query: { page: 1 } }}
isActive={currentPage == 1}
>
1
Expand All @@ -43,7 +43,7 @@ export const PaginationWithLogic = async ({
{noOfPages > 1 && (currentPage < 4 || noOfPages < 6) && (
<PaginationItem>
<PaginationLink
href={{ query: { meetingPage: 2 } }}
href={{ query: { page: 2 } }}
isActive={currentPage == 2}
>
2
Expand All @@ -53,7 +53,7 @@ export const PaginationWithLogic = async ({
{noOfPages > 2 && (currentPage < 4 || noOfPages < 6) && (
<PaginationItem>
<PaginationLink
href={{ query: { meetingPage: 3 } }}
href={{ query: { page: 3 } }}
isActive={currentPage == 3}
>
3
Expand All @@ -66,7 +66,7 @@ export const PaginationWithLogic = async ({
<>
<PaginationItem>
<PaginationLink
href={{ query: { meetingPage: currentPage } }}
href={{ query: { page: currentPage } }}
isActive={currentPage == currentPage}
>
{currentPage}
Expand All @@ -79,7 +79,7 @@ export const PaginationWithLogic = async ({
{noOfPages > 5 && currentPage > noOfPages - 3 && (
<PaginationItem>
<PaginationLink
href={{ query: { meetingPage: noOfPages - 2 } }}
href={{ query: { page: noOfPages - 2 } }}
isActive={currentPage == noOfPages - 2}
>
{noOfPages - 2}
Expand All @@ -89,7 +89,7 @@ export const PaginationWithLogic = async ({
{noOfPages > 4 && (currentPage > noOfPages - 3 || noOfPages < 6) && (
<PaginationItem>
<PaginationLink
href={{ query: { meetingPage: noOfPages - 1 } }}
href={{ query: { page: noOfPages - 1 } }}
isActive={currentPage == noOfPages - 1}
>
{noOfPages - 1}
Expand All @@ -99,7 +99,7 @@ export const PaginationWithLogic = async ({
{noOfPages > 3 && (
<PaginationItem>
<PaginationLink
href={{ query: { meetingPage: noOfPages } }}
href={{ query: { page: noOfPages } }}
isActive={currentPage == noOfPages}
>
{noOfPages}
Expand All @@ -110,7 +110,7 @@ export const PaginationWithLogic = async ({
<PaginationItem>
<PaginationNext
disabled={currentPage >= noOfPages}
href={{ query: { meetingPage: currentPage + 1 } }}
href={{ query: { page: currentPage + 1 } }}
/>
</PaginationItem>
</PaginationContent>
Expand Down
9 changes: 9 additions & 0 deletions i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,15 @@ Saturdays & Holidays: 09.00 am to 05.00 pm`,
description: 'Not Acceptable Please try again',
},
},
PatentsAndTechnologies: {
title: 'PATENTS & TECHNOLOGIES',
number: 'Serial No.',
applicationNumber: 'Application No.',
patentNumber: 'Patent No.',
techTitle: 'Technology / Invention Title',
inventor: 'Inventor',
},

StudentActivities: {
title: 'STUDENT ACTIVITIES',
headings: {
Expand Down
8 changes: 8 additions & 0 deletions i18n/hi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,14 @@ const text: Translations = {
description: 'अस्वीकार्य दुबारा प्रयास करें।',
},
},
PatentsAndTechnologies: {
title: 'पेटेंट और प्रौद्योगिकी',
number: 'संख्या',
applicationNumber: 'आवेदन संख्या',
patentNumber: 'पेटेंट संख्या',
techTitle: 'प्रौद्योगिकी / आविष्कार शीर्षक',
inventor: 'आविष्कारक',
},
StudentActivities: {
title: 'छात्र गतिविधियाँ',
headings: {
Expand Down
8 changes: 8 additions & 0 deletions i18n/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,14 @@ export interface Translations {
WorkInProgress: { title: string; description: string };
NotAcceptable: { title: string; description: string };
};
PatentsAndTechnologies: {
title: string;
number: string;
applicationNumber: string;
patentNumber: string;
techTitle: string;
inventor: string;
};
StudentActivities: {
title: string;
headings: {
Expand Down