Skip to content

Commit c099698

Browse files
feat: faculty page frontend
1 parent 4c8ee8a commit c099698

File tree

13 files changed

+808
-181
lines changed

13 files changed

+808
-181
lines changed
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
import { notFound } from 'next/navigation';
2+
import { Fragment } from 'react';
3+
import { MdOutlineEdit } from 'react-icons/md';
4+
5+
import { ScrollArea } from '~/components/ui';
6+
import { getTranslations, type Translations } from '~/i18n/translations';
7+
import { groupBy } from '~/lib/utils';
8+
9+
type FacultySectionProps =
10+
| {
11+
params: {
12+
locale: string;
13+
faculty_section: keyof Translations['FacultyAndStaff']['tabs'];
14+
employee_id: string;
15+
};
16+
asProfile?: never;
17+
}
18+
| {
19+
params?: never;
20+
asProfile: {
21+
id: number;
22+
locale: string;
23+
faculty_section: keyof Translations['FacultyAndStaff']['tabs'];
24+
};
25+
};
26+
27+
export default async function FacultySection({
28+
params,
29+
asProfile,
30+
}: FacultySectionProps) {
31+
const { locale, faculty_section } = params ?? asProfile;
32+
const title = (await getTranslations(locale)).FacultyAndStaff.tabs[
33+
faculty_section
34+
];
35+
36+
const jkchabbraProfile = {
37+
qualifications: [
38+
{
39+
name: 'B.Tech (CSE)',
40+
value: '2nd Topper',
41+
caption: 'National Institute of Technology, Kurukshetra',
42+
year: '',
43+
},
44+
{
45+
name: 'M.Tech (CSE)',
46+
value: 'Gold Medalist',
47+
caption: 'National Institute of Technology, Kurukshetra',
48+
year: '',
49+
},
50+
{
51+
name: 'Ph.D. (S/w Engg)',
52+
value: '',
53+
caption: 'National Institute of Technology, Kurukshetra',
54+
year: '',
55+
},
56+
],
57+
publications: [
58+
{
59+
name: 'Programming with C (4th Edition)',
60+
value: 'McGraw Hill',
61+
caption: 'Byron Gottfried, USA & Jitender Kumar Chhabra',
62+
year: '',
63+
tag: 'Book',
64+
},
65+
{
66+
name: 'Conceptual Programming Tips for Interviews and Competitive Exams',
67+
value: 'McGraw Hill',
68+
caption: 'Jitender Kumar Chhabra',
69+
year: '',
70+
tag: 'Book',
71+
},
72+
],
73+
experience: [
74+
{
75+
name: 'Teaching & Research Experience',
76+
value: '30 years',
77+
caption: 'Professor, Computer Engineering, NIT Kurukshetra',
78+
year: '1995 - Present',
79+
},
80+
],
81+
projects: [
82+
{
83+
name: 'Novel Approach for Secure Storage on External Media',
84+
value: 'DRDO, Govt of India',
85+
caption:
86+
'Design and development of a non-cryptographic secure storage and lossless retrieval system',
87+
year: 'Completed',
88+
},
89+
],
90+
educationCurrent: [
91+
{
92+
name: 'Online Lecture Series on Data Structures & Algorithms',
93+
value: 'YouTube',
94+
caption: 'Channel: @JitenderKrChhabraProfCseNITKKR',
95+
year: 'Ongoing',
96+
},
97+
],
98+
scholars: [
99+
{
100+
name: 'Ph.D. Supervision',
101+
value: '6 Completed, 1 Ongoing',
102+
caption: 'Ph.D. scholars under guidance at NIT Kurukshetra',
103+
year: '',
104+
},
105+
],
106+
awards: [
107+
{
108+
name: 'Best Teacher Award',
109+
value: 'NIT Kurukshetra',
110+
caption: 'Awarded for excellence in teaching and research',
111+
year: '',
112+
},
113+
],
114+
};
115+
const defaultProfileTabs = {
116+
qualifications: [
117+
{
118+
name: 'Ph.D.',
119+
value: 'Nanostructured Biomaterials',
120+
caption: 'Indian institute of Technology Madras',
121+
year: '2010',
122+
},
123+
],
124+
publications: [
125+
{
126+
name: 'Sustainable finishes in textiles, Conference Proceedings',
127+
value:
128+
'International E-Conference on Sustainable Growth in Textiles (SGT-2021), Uttar Pradesh Textile Technology Institute, Kanpur',
129+
caption: 'RK Chhabra, Aakanksha Singh and J N Chakraborty',
130+
year: 'August 2023',
131+
tag: 'Conference',
132+
},
133+
{
134+
name: 'Sustainable finishes in textiles, Conference Proceedings',
135+
value:
136+
'International E-Conference on Sustainable Growth in Textiles (SGT-2021), Uttar Pradesh Textile Technology Institute, Kanpur',
137+
caption: 'RK Chhabra, Aakanksha Singh and J N Chakraborty',
138+
year: 'August 2023',
139+
tag: 'Conference',
140+
},
141+
{
142+
name: 'Sustainable finishes in textiles, Conference Proceedings',
143+
value:
144+
'International E-Conference on Sustainable Growth in Textiles (SGT-2021), Uttar Pradesh Textile Technology Institute, Kanpur',
145+
caption: 'RK Chhabra, Aakanksha Singh and J N Chakraborty',
146+
year: 'August 2023',
147+
tag: 'Journal',
148+
},
149+
{
150+
name: 'Sustainable finishes in textiles, Conference Proceedings',
151+
value:
152+
'International E-Conference on Sustainable Growth in Textiles (SGT-2021), Uttar Pradesh Textile Technology Institute, Kanpur',
153+
caption: 'RK Chhabra, Aakanksha Singh and J N Chakraborty',
154+
year: 'August 2023',
155+
tag: 'Journal',
156+
},
157+
{
158+
name: 'Sustainable finishes in textiles, Conference Proceedings',
159+
value:
160+
'International E-Conference on Sustainable Growth in Textiles (SGT-2021), Uttar Pradesh Textile Technology Institute, Kanpur',
161+
caption: 'RK Chhabra, Aakanksha Singh and J N Chakraborty',
162+
year: 'August 2023',
163+
tag: 'Book/Chapter',
164+
},
165+
{
166+
name: 'Sustainable finishes in textiles, Conference Proceedings',
167+
value:
168+
'International E-Conference on Sustainable Growth in Textiles (SGT-2021), Uttar Pradesh Textile Technology Institute, Kanpur',
169+
caption: 'RK Chhabra, Aakanksha Singh and J N Chakraborty',
170+
year: 'August 2023',
171+
tag: 'Book/Chapter',
172+
},
173+
],
174+
experience: [
175+
{
176+
name: 'Teaching Experience',
177+
value: 'Biomechanics Biotransport',
178+
caption: 'Indian institute of Technology Madras',
179+
year: 'Feb. 2024 - Feb. 2024',
180+
},
181+
],
182+
projects: [
183+
{
184+
name: 'Development of biodegradable bioplastic films from mango seed starch.',
185+
value: 'Nanostructured Biomaterials',
186+
caption: 'Indian institute of Technology Madras',
187+
year: '2010',
188+
},
189+
],
190+
educationCurrent: [
191+
{
192+
name: 'Short Term Course On Fluidized Bed Technology For Waste Management : Design, Modeling and Simulation',
193+
value: 'Chemical Engineering Short Term Course',
194+
caption: 'Coordinator',
195+
year: 'Feb, 2024 - Feb, 2024',
196+
},
197+
],
198+
scholars: [
199+
{
200+
name: 'MULTIFUNCTIONAL FINISHING OF COTTON USING β-CYCLODEXTRIN ASSISTED ESSENTIAL OILS.',
201+
value: 'Ph. D Scholar',
202+
caption: 'Deepika Jha',
203+
year: 'Enrolled: July 2023, Continuing',
204+
},
205+
],
206+
awards: [
207+
{
208+
name: 'MRS-S Funding Support award.',
209+
value: 'Department Of Biotechnology',
210+
caption:
211+
'International Conference on Materials for Advanced Technologies, Singapore',
212+
year: '2017',
213+
},
214+
],
215+
};
216+
const profileTabs =
217+
params?.employee_id === '114' ? jkchabbraProfile : defaultProfileTabs;
218+
219+
if (!profileTabs[faculty_section]) {
220+
return notFound();
221+
}
222+
223+
const hasTag = 'tag' in profileTabs[faculty_section][0];
224+
225+
const dataToDisplay = hasTag
226+
? // @ts-expect-error - Ignore type checking for 'tag' key
227+
groupBy(profileTabs[faculty_section], 'tag')
228+
: new Map([['key', profileTabs[faculty_section]]]);
229+
230+
return (
231+
<>
232+
<h4 className="max-md:hidden">{title}</h4>
233+
<ScrollArea className="rounded-2xl">
234+
{Array.from(dataToDisplay.entries()).map(([key, items]) => (
235+
<Fragment key={key}>
236+
{hasTag && <h5 className="mb-3 px-1 font-black">{key}</h5>}
237+
<ul className="mb-3 space-y-6 px-1">
238+
{items.map((item, index) => (
239+
<li
240+
key={index}
241+
className="flex flex-col gap-3 rounded-xl bg-shade-light p-5 shadow-[0px_4px_12px_0px_rgba(0,15,31,0.1)]" //shadow-[0px_4px_12px_0px_rgba(0,15,31,0.1)]
242+
>
243+
<span className="flex justify-between gap-4">
244+
<h5 className="font-bold">{item.name}</h5>
245+
{0 ? (
246+
<MdOutlineEdit
247+
size={28}
248+
className="cursor-pointer text-primary-700"
249+
/>
250+
) : null}
251+
</span>
252+
<p>{item.value}</p>
253+
<p className="text-neutral-600">{item.caption}</p>
254+
<p className="text-neutral-400">{item.year}</p>
255+
</li>
256+
))}
257+
</ul>
258+
</Fragment>
259+
))}
260+
</ScrollArea>
261+
</>
262+
);
263+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { union } from 'drizzle-orm/pg-core';
2+
import { type ReactNode } from 'react';
3+
4+
import { db, faculty, staff } from '~/server/db';
5+
6+
import { FacultyOrStaffComponent } from '../utils';
7+
8+
export async function generateStaticParams() {
9+
const facultyIds = db
10+
.select({ employee_id: faculty.employeeId })
11+
.from(faculty);
12+
const staffIds = db.select({ employee_id: staff.employeeId }).from(staff);
13+
return await union(facultyIds, staffIds);
14+
}
15+
16+
export default async function FacultyOrStaffLayout({
17+
children,
18+
params: { locale, employee_id },
19+
}: {
20+
children?: ReactNode;
21+
params: { locale: string; employee_id: string };
22+
}) {
23+
return (
24+
<FacultyOrStaffComponent locale={locale} employeeId={employee_id}>
25+
{children}
26+
</FacultyOrStaffComponent>
27+
);
28+
}
Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
import { union } from 'drizzle-orm/pg-core';
1+
import FacultySection from './[faculty_section]/page';
22

3-
import { WorkInProgressStatus } from '~/components/status';
4-
import { db, faculty, staff } from '~/server/db';
5-
6-
export async function generateStaticParams() {
7-
const facultyIds = db
8-
.select({ employee_id: faculty.employeeId })
9-
.from(faculty);
10-
const staffIds = db.select({ employee_id: staff.employeeId }).from(staff);
11-
return await union(facultyIds, staffIds);
12-
}
13-
14-
export default function FacultyOrStaff({
15-
params: { locale, employee_id: employeeId },
3+
export default function FacultyAndStaff({
4+
params: { locale, employee_id },
165
}: {
176
params: { locale: string; employee_id: string };
187
}) {
19-
return <WorkInProgressStatus locale={locale} />;
8+
return (
9+
<FacultySection
10+
params={{
11+
locale: locale,
12+
faculty_section: 'qualifications',
13+
employee_id: employee_id,
14+
}}
15+
/>
16+
);
2017
}

0 commit comments

Comments
 (0)