Skip to content

Commit c4b6510

Browse files
Soumil221heydoyouknowme0
authored andcommitted
feat: patents and technologies page
1 parent 29d3526 commit c4b6510

File tree

4 files changed

+226
-0
lines changed

4 files changed

+226
-0
lines changed
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
import { Suspense } from 'react';
2+
3+
import Loading from '~/components/loading';
4+
import ImageHeader from '~/components/image-header';
5+
import {
6+
Table,
7+
TableBody,
8+
TableCell,
9+
TableHead,
10+
TableHeader,
11+
TableRow,
12+
} from '~/components/ui';
13+
import { PaginationWithLogic } from '~/components/pagination/pagination';
14+
import { getTranslations } from '~/i18n/translations';
15+
16+
export default async function PatentsAndTechnology({
17+
params: { locale },
18+
searchParams,
19+
}: {
20+
params: { locale: string };
21+
searchParams?: { page?: string };
22+
}) {
23+
const currentPage = Number(searchParams?.page ?? 1);
24+
25+
const text = (await getTranslations(locale)).PatentsAndTechnologies;
26+
27+
// Static patent data
28+
const staticPatents = [
29+
{
30+
applicationNumber: '2269/DEL/2012',
31+
patentNumber: '320045',
32+
title: 'Intelligent induction hardening device and method thereof',
33+
inventors: [
34+
{
35+
facultyId: 'jitender_kumar_chhabra_1',
36+
name: 'Jitender Kumar Chhabra',
37+
},
38+
],
39+
},
40+
{
41+
applicationNumber: '2269/DEL/2012',
42+
patentNumber: '320045',
43+
title:
44+
'Method of preventing radioactive gas to diffuse indoor environment by forming concrete with shielding effect',
45+
inventors: [
46+
{
47+
facultyId: 'jitender_kumar_chhabra_2',
48+
name: 'Jitender Kumar Chhabra',
49+
},
50+
],
51+
},
52+
{
53+
applicationNumber: '2269/DEL/2012',
54+
patentNumber: '320045',
55+
title: 'System for extracting water from atmospheric air',
56+
inventors: [
57+
{
58+
facultyId: 'jitender_kumar_chhabra_3',
59+
name: 'Jitender Kumar Chhabra',
60+
},
61+
],
62+
},
63+
{
64+
applicationNumber: '2269/DEL/2012',
65+
patentNumber: '320045',
66+
title: 'System for extracting water from atmospheric air',
67+
inventors: [
68+
{
69+
facultyId: 'jitender_kumar_chhabra_4',
70+
name: 'Jitender Kumar Chhabra',
71+
},
72+
],
73+
},
74+
{
75+
applicationNumber: '3001/DEL/2013',
76+
patentNumber: '320046',
77+
title: 'Advanced solar energy harvesting system',
78+
inventors: [
79+
{
80+
facultyId: 'jitender_kumar_chhabra_5',
81+
name: 'Jitender Kumar Chhabra',
82+
},
83+
],
84+
},
85+
{
86+
applicationNumber: '3002/DEL/2013',
87+
patentNumber: '320047',
88+
title: 'Automated waste management and recycling apparatus',
89+
inventors: [
90+
{
91+
facultyId: 'jitender_kumar_chhabra_6',
92+
name: 'Jitender Kumar Chhabra',
93+
},
94+
],
95+
},
96+
];
97+
98+
// Get the total count for pagination
99+
const getPatentCount = async () => {
100+
const count = staticPatents.length; // Replace with your actual DB call
101+
return [{ count }];
102+
};
103+
104+
return (
105+
<>
106+
<ImageHeader
107+
title={text.title}
108+
src="research/patents-and-technologies/banner.jpg"
109+
/>
110+
<section className="container p-8">
111+
<div className="max-h-96 w-full overflow-x-auto">
112+
<Table scrollAreaClassName="h-[23rem] min-w-[500px]">
113+
<TableHeader>
114+
<TableRow>
115+
{[
116+
text.number,
117+
text.applicationNumber,
118+
text.patentNumber,
119+
text.techTitle,
120+
text.inventor,
121+
].map((headerText, index) => (
122+
<TableHead key={index}>{headerText}</TableHead>
123+
))}
124+
</TableRow>
125+
</TableHeader>
126+
<TableBody>
127+
<Suspense
128+
fallback={
129+
<TableRow>
130+
<TableCell colSpan={5}>
131+
<Loading />
132+
</TableCell>
133+
</TableRow>
134+
}
135+
>
136+
<PatentTable
137+
tableData={staticPatents}
138+
currentPage={currentPage}
139+
itemsPerPage={10}
140+
/>
141+
</Suspense>
142+
</TableBody>
143+
</Table>
144+
</div>
145+
146+
<div className="mt-6">
147+
<PaginationWithLogic
148+
currentPage={currentPage}
149+
query={getPatentCount()}
150+
/>
151+
</div>
152+
</section>
153+
</>
154+
);
155+
}
156+
157+
const PatentTable = ({
158+
tableData,
159+
currentPage,
160+
itemsPerPage = 10,
161+
}: {
162+
tableData: {
163+
applicationNumber: string;
164+
patentNumber: string;
165+
title: string;
166+
inventors: {
167+
facultyId: string;
168+
name: string;
169+
}[];
170+
}[];
171+
currentPage: number;
172+
itemsPerPage?: number;
173+
}) => {
174+
const startIndex = (currentPage - 1) * itemsPerPage;
175+
const visibleData = tableData.slice(startIndex, startIndex + itemsPerPage);
176+
177+
return (
178+
<>
179+
{visibleData.map((item, index) => {
180+
const cellData = [
181+
startIndex + index + 1,
182+
item.applicationNumber,
183+
item.patentNumber,
184+
item.title,
185+
item.inventors.map((inventor) => inventor.name).join(', '),
186+
];
187+
188+
return (
189+
<TableRow
190+
key={index}
191+
className="text-neutral-700 hover:bg-neutral-50"
192+
>
193+
{cellData.map((cellContent, cellIndex) => (
194+
<TableCell key={cellIndex}>{cellContent}</TableCell>
195+
))}
196+
</TableRow>
197+
);
198+
})}
199+
</>
200+
);
201+
};

i18n/en.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,15 @@ Saturdays & Holidays: 09.00 am to 05.00 pm`,
13681368
description: 'Not Acceptable Please try again',
13691369
},
13701370
},
1371+
PatentsAndTechnologies: {
1372+
title: 'PATENTS & TECHNOLOGIES',
1373+
number: 'Serial No.',
1374+
applicationNumber: 'Application No.',
1375+
patentNumber: 'Patent No.',
1376+
techTitle: 'Technology / Invention Title',
1377+
inventor: 'Inventor',
1378+
},
1379+
13711380
StudentActivities: {
13721381
title: 'STUDENT ACTIVITIES',
13731382
headings: {

i18n/hi.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,14 @@ const text: Translations = {
13491349
description: 'अस्वीकार्य दुबारा प्रयास करें।',
13501350
},
13511351
},
1352+
PatentsAndTechnologies: {
1353+
title: 'पेटेंट और प्रौद्योगिकी',
1354+
number: 'संख्या',
1355+
applicationNumber: 'आवेदन संख्या',
1356+
patentNumber: 'पेटेंट संख्या',
1357+
techTitle: 'प्रौद्योगिकी / आविष्कार शीर्षक',
1358+
inventor: 'आविष्कारक',
1359+
},
13521360
StudentActivities: {
13531361
title: 'छात्र गतिविधियाँ',
13541362
headings: {

i18n/translations.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,14 @@ export interface Translations {
795795
WorkInProgress: { title: string; description: string };
796796
NotAcceptable: { title: string; description: string };
797797
};
798+
PatentsAndTechnologies: {
799+
title: string;
800+
number: string;
801+
applicationNumber: string;
802+
patentNumber: string;
803+
techTitle: string;
804+
inventor: string;
805+
};
798806
StudentActivities: {
799807
title: string;
800808
headings: {

0 commit comments

Comments
 (0)