From bb71b725d96c51dbe70b02bd3fa9a90c13eea1d2 Mon Sep 17 00:00:00 2001 From: Amudieshwar-AG Date: Fri, 14 Aug 2026 18:43:41 +0530 Subject: [PATCH] Update Faculty page, FacultyCard component, types, and constants --- .../src/main/resources/application.properties | 2 +- src/components/FacultyCard/FacultyCard.tsx | 126 +- src/constants/index.ts | 3032 +++++++++++++++-- src/pages/Faculty/Faculty.tsx | 102 +- src/types/index.ts | 3 +- 5 files changed, 2971 insertions(+), 294 deletions(-) diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index ae9d8f6..c5fcc97 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -1,7 +1,7 @@ # ─── DATABASE CONNECTION CONFIGURATION ─── spring.datasource.url=jdbc:postgresql://localhost:5432/rit_freshers_hub?sslmode=disable spring.datasource.username=postgres -spring.datasource.password=${DB_PASSWORD:Amudiesh22@.} +spring.datasource.password=${DB_PASSWORD:murugan06} # ─── JPA / HIBERNATE SETTINGS ─── spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect diff --git a/src/components/FacultyCard/FacultyCard.tsx b/src/components/FacultyCard/FacultyCard.tsx index 5f2a3a8..6854ffb 100644 --- a/src/components/FacultyCard/FacultyCard.tsx +++ b/src/components/FacultyCard/FacultyCard.tsx @@ -36,6 +36,52 @@ export default function FacultyCard({ faculty }: FacultyCardProps) { { name: 'Yahoo Mail', url: `https://compose.mail.yahoo.com/?to=${faculty.email}`, icon: Mail, color: 'text-purple-600', bg: 'bg-purple-50' }, ]; + const parseToListItems = (text: string | undefined): string[] => { + if (!text) return []; + const cleaned = text.replace(//gi, '\n'); + const lines = cleaned.split(/\n+/); + const items: string[] = []; + lines.forEach((line) => { + let subParts: string[]; + if (line.includes(';')) { + subParts = line.split(';'); + } else if (line.includes(',') && !line.includes('(')) { + subParts = line.split(','); + } else { + subParts = [line]; + } + subParts.forEach((part) => { + let trimmed = part.trim(); + trimmed = trimmed.replace(/^[\d+.)\-•\s*]+/, '').trim(); + if (trimmed && trimmed !== '—' && trimmed !== 'Nil' && trimmed !== 'nil') { + items.push(trimmed); + } + }); + }); + return items; + }; + + const renderPointList = (value: string | undefined, placeholder: string = 'Not specified') => { + const items = parseToListItems(value); + if (items.length <= 1) { + return ( +

+ {items[0] || placeholder} +

+ ); + } + return ( + + ); + }; + return ( <>
{initials}
-

+

{faculty.name}

@@ -192,17 +238,13 @@ export default function FacultyCard({ faculty }: FacultyCardProps) {

-

Professional Details

+

Professional Details

Department

{faculty.department}

-
-

Specialization

-

{faculty.specialization || 'Not specified'}

-

Qualification

{faculty.qualification || 'Not specified'}

@@ -212,11 +254,15 @@ export default function FacultyCard({ faculty }: FacultyCardProps) {

{faculty.experience || 'Not specified'}

{faculty.joinedInstitution && ( -
+

Joined Institution

{faculty.joinedInstitution}

)} +
+

Interest / Domain / Specialization

+ {renderPointList(faculty.interest || faculty.specialization)} +
@@ -226,17 +272,19 @@ export default function FacultyCard({ faculty }: FacultyCardProps) {
-

Academic Information

+

Academic Information

Subjects Handling

-

{faculty.subjectsHandling || 'Not specified'}

-
-
-

Research Areas

-

{faculty.researchAreas || 'Not specified'}

+ {renderPointList(faculty.subjectsHandling)}
+ {faculty.researchAreas && ( +
+

Research Areas

+

{faculty.researchAreas}

+
+ )} {faculty.studentsGuided && (

Students Guided

@@ -266,7 +314,7 @@ export default function FacultyCard({ faculty }: FacultyCardProps) {
-

Achievements

+

Achievements

{faculty.achievements && faculty.achievements.length > 0 && ( @@ -294,30 +342,36 @@ export default function FacultyCard({ faculty }: FacultyCardProps) { )} {/* Section 4: Office Info */} -
-
-
- -
-

Office Information

-
-
-
- -
-

Office Hours

-

{faculty.officeHours || 'Not specified'}

+ {(faculty.office || faculty.officeHours) && ( +
+
+
+
+

Office Information

-
- -
-

Office Location

-

{faculty.office || 'Not specified'}

-
+
+ {faculty.officeHours && ( +
+ +
+

Office Hours

+

{faculty.officeHours}

+
+
+ )} + {faculty.office && ( +
+ +
+

Office Location

+

{faculty.office}

+
+
+ )}
-
+ )}
@@ -348,7 +402,7 @@ export default function FacultyCard({ faculty }: FacultyCardProps) { >
-

Choose Mail App

+

Choose Mail App

Compose email to {faculty.name}

- {/* Grid */} + {/* Grouped Grid */} {filteredAndSortedFaculty.length > 0 ? ( - - {filteredAndSortedFaculty.map((faculty) => ( - - - - ))} - +
+ {departmentOrder.map((deptName) => { + const facultyInDept = groupedFaculty[deptName]; + if (!facultyInDept || facultyInDept.length === 0) return null; + const deptInfo = DEPT_MAP[deptName] || { abrv: deptName, full: deptName }; + + return ( +
+ {/* Department Header */} +
+

+ {deptInfo.abrv} +

+

+ {deptInfo.full} +

+
+ + {/* Department Grid */} + + {facultyInDept.map((faculty) => ( + + + + ))} + +
+ ); + })} +
) : (
diff --git a/src/types/index.ts b/src/types/index.ts index be84e08..508e6ea 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -28,13 +28,14 @@ export interface Stat { export interface Faculty { id: string; name: string; - designation: string; + designation?: string; department: string; email: string; phone?: string; office?: string; avatar?: string; specialization?: string; + interest?: string; qualification?: string; experience?: string; subjectsHandling?: string;