-
Notifications
You must be signed in to change notification settings - Fork 16
student council page #568
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
student council page #568
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,285 @@ | ||||||
| import NotificationsPanel from '~/components/notifications/notifications-panel'; | ||||||
| import Heading from '~/components/heading'; | ||||||
| import ImageHeader from '~/components/image-header'; | ||||||
| import GenericTable from '~/components/ui/generic-table'; | ||||||
| import FICGroup from '~/components/fic-group'; | ||||||
| import StudentGroup from '~/components/student-group'; | ||||||
| import { getTranslations } from '~/i18n/translations'; | ||||||
| import { db } from '~/server/db'; | ||||||
|
|
||||||
| export const revalidate = 300; | ||||||
| export default async function StudentCouncil({ | ||||||
| params: { locale }, | ||||||
| }: { | ||||||
| params: { locale: string }; | ||||||
| }) { | ||||||
| const text = await getTranslations(locale); | ||||||
|
|
||||||
| // Fetch all student council data with person details | ||||||
| const studentCouncilMembers = await db.query.studentCouncil.findMany({ | ||||||
| with: { | ||||||
| person: true, | ||||||
| }, | ||||||
| orderBy: (studentCouncil, { asc }) => [ | ||||||
| asc(studentCouncil.category), | ||||||
| asc(studentCouncil.section), | ||||||
| ], | ||||||
| }); | ||||||
|
|
||||||
| // Filter members by category "institute functionaries" | ||||||
| const instituteFunctionaries = studentCouncilMembers.filter( | ||||||
| (member) => member.category === 'institute_functionaries' | ||||||
| ); | ||||||
| const coreCommitteeMembers = studentCouncilMembers.filter( | ||||||
| (member) => member.category === 'core_committee' | ||||||
| ); | ||||||
| const nominatedStudentsMembers = studentCouncilMembers.filter( | ||||||
| (member) => member.category === 'nominated_students' | ||||||
| ); | ||||||
| const studentRepresentatives = studentCouncilMembers.filter( | ||||||
| (member) => member.category === 'students_representatives' | ||||||
| ); | ||||||
|
|
||||||
| // Separate faculty and students from institute functionaries | ||||||
| const facultyMembers = instituteFunctionaries.filter( | ||||||
| (member) => member.person.type === 'faculty' | ||||||
| ); | ||||||
|
|
||||||
| // Get faculty employee IDs | ||||||
| const facultyPersonIds = facultyMembers.map((m) => m.personId); | ||||||
| const facultyData = | ||||||
| facultyPersonIds.length > 0 | ||||||
| ? await db.query.faculty.findMany({ | ||||||
| where: (faculty, { inArray }) => | ||||||
| inArray(faculty.id, facultyPersonIds), | ||||||
| columns: { id: true, employeeId: true }, | ||||||
| }) | ||||||
| : []; | ||||||
|
|
||||||
| // Create map for faculty designations | ||||||
| const facultyDesignationMap = new Map( | ||||||
| facultyMembers.map((m) => [m.personId, m.section]) | ||||||
| ); | ||||||
|
|
||||||
| // Prepare data for components | ||||||
| const facultyGroupData = facultyData.map((f) => ({ | ||||||
| employeeId: f.employeeId, | ||||||
| designation: facultyDesignationMap.get(f.id) ?? '', | ||||||
| })); | ||||||
|
Comment on lines
+48
to
+68
|
||||||
|
|
||||||
| // Prepare data for core committee (students only) | ||||||
| const coreCommitteePersonIds = coreCommitteeMembers.map((m) => m.personId); | ||||||
| const coreCommitteeStudentData = | ||||||
| coreCommitteePersonIds.length > 0 | ||||||
| ? await db.query.students.findMany({ | ||||||
| where: (students, { inArray }) => | ||||||
| inArray(students.id, coreCommitteePersonIds), | ||||||
| columns: { id: true, rollNumber: true }, | ||||||
| }) | ||||||
| : []; | ||||||
|
|
||||||
| const coreCommitteeDesignationMap = new Map( | ||||||
| coreCommitteeMembers.map((m) => [m.personId, m.section]) | ||||||
| ); | ||||||
|
|
||||||
| const coreCommitteeGroupData = coreCommitteeStudentData.map((s) => ({ | ||||||
| rollNumber: s.rollNumber, | ||||||
| designation: coreCommitteeDesignationMap.get(s.id) ?? undefined, | ||||||
| })); | ||||||
|
|
||||||
|
Comment on lines
+70
to
+89
|
||||||
| // Prepare data for nominated students | ||||||
| const nominatedStudentsPersonIds = nominatedStudentsMembers.map( | ||||||
| (m) => m.personId | ||||||
| ); | ||||||
| const nominatedStudentsData = | ||||||
| nominatedStudentsPersonIds.length > 0 | ||||||
| ? await db.query.students.findMany({ | ||||||
| where: (students, { inArray }) => | ||||||
| inArray(students.id, nominatedStudentsPersonIds), | ||||||
| columns: { id: true, rollNumber: true }, | ||||||
| }) | ||||||
| : []; | ||||||
|
|
||||||
| const nominatedStudentsDesignationMap = new Map( | ||||||
| nominatedStudentsMembers.map((m) => [m.personId, m.section]) | ||||||
| ); | ||||||
|
|
||||||
| const nominatedStudentsGroupData = nominatedStudentsData.map((s) => ({ | ||||||
| rollNumber: s.rollNumber, | ||||||
| designation: nominatedStudentsDesignationMap.get(s.id) ?? undefined, | ||||||
| })); | ||||||
|
|
||||||
| // Prepare data for student representatives | ||||||
| const studentRepresentativesPersonIds = studentRepresentatives.map( | ||||||
| (m) => m.personId | ||||||
| ); | ||||||
| const studentRepresentativesData = | ||||||
| studentRepresentativesPersonIds.length > 0 | ||||||
| ? await db.query.students.findMany({ | ||||||
| where: (students, { inArray }) => | ||||||
| inArray(students.id, studentRepresentativesPersonIds), | ||||||
| columns: { id: true, rollNumber: true }, | ||||||
| }) | ||||||
| : []; | ||||||
|
|
||||||
| // Get academic details for student representatives | ||||||
| const studentRepresentativesAcademicData = | ||||||
| studentRepresentativesPersonIds.length > 0 | ||||||
| ? await db.query.studentAcademicDetails.findMany({ | ||||||
| where: (academicDetails, { inArray }) => | ||||||
| inArray(academicDetails.id, studentRepresentativesPersonIds), | ||||||
| columns: { | ||||||
| id: true, | ||||||
| section: true, | ||||||
| currentSemester: true, | ||||||
| batch: true, | ||||||
| }, | ||||||
| with: { | ||||||
| major: { | ||||||
| columns: { name: true, degree: true }, | ||||||
| }, | ||||||
| }, | ||||||
| }) | ||||||
| : []; | ||||||
|
|
||||||
| // Create maps for student representatives | ||||||
| const studentRepresentativesMap = new Map( | ||||||
| studentRepresentativesData.map((s) => [s.id, s]) | ||||||
| ); | ||||||
| const studentRepresentativesAcademicMap = new Map( | ||||||
| studentRepresentativesAcademicData.map((s) => [s.id, s]) | ||||||
| ); | ||||||
|
|
||||||
| return ( | ||||||
| <> | ||||||
| <ImageHeader | ||||||
| title={text.StudentCouncil.title} | ||||||
| src="student-activities/thought-lab/welcome-bk-shivani.jpeg" | ||||||
| /> | ||||||
|
|
||||||
| <section className="container"> | ||||||
| {/* Main Title with dual elephants */} | ||||||
| <Heading | ||||||
| glyphDirection="dual" | ||||||
| heading="h3" | ||||||
| text={text.StudentCouncil.title.toUpperCase()} | ||||||
| /> | ||||||
| {/* About Description */} | ||||||
| <p className="mb-6">{text.StudentCouncil.about}</p> | ||||||
| <section className="container my-10" id="notifications"> | ||||||
| <Heading | ||||||
| glyphDirection="ltr" | ||||||
| heading="h3" | ||||||
| href="#notifications" | ||||||
| id="notifications" | ||||||
| text={text.Notifications.title.toUpperCase()} | ||||||
| /> | ||||||
| <NotificationsPanel | ||||||
| locale={locale} | ||||||
| category="student-activities" | ||||||
| showViewAll={true} | ||||||
| viewAllHref={`/${locale}/notifications?category=miscellaneous`} | ||||||
|
||||||
| viewAllHref={`/${locale}/notifications?category=miscellaneous`} | |
| viewAllHref={`/${locale}/notifications?category=student-activities`} |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The empty-state message is hardcoded in English (No core committee members found.). Since this is a localized route, this should come from i18n translations so it renders correctly in Hindi/other locales.
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This empty-state message is hardcoded in English (No nominated students found.). Please move it into the StudentCouncil translations so it’s localized per locale.
| No nominated students found. | |
| {text.StudentCouncil.emptyStates.nominatedStudents} |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This empty-state message is hardcoded in English (No student representatives found.). Please use i18n translation strings instead so the page remains fully localized.
| No student representatives found. | |
| {text.StudentCouncil.emptyStates.noStudentRepresentatives} |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -51,6 +51,7 @@ import { | |||
| nccEn, | ||||
| nssEn, | ||||
| laboratoriesEn, | ||||
| studentCouncilEn, | ||||
| } from './translate'; | ||||
| import { Label } from '@radix-ui/react-label'; | ||||
|
||||
| import { Label } from '@radix-ui/react-label'; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||
| // Student council translations | ||||||
|
|
||||||
| export interface StudentCouncilTranslations { | ||||||
| title: string; | ||||||
| about: string; | ||||||
| headings: { | ||||||
| instituteFunctionaries: string; | ||||||
| coreCommittee: string; | ||||||
| nominatedStudents: string; | ||||||
| studentsRepresentatives: string; | ||||||
| }; | ||||||
| tableHeaders: { | ||||||
| roll: string; | ||||||
| name: string; | ||||||
| contact: string; | ||||||
| branch: string; | ||||||
| batch: string; | ||||||
| }; | ||||||
| } | ||||||
|
|
||||||
| export const studentCouncilEn: StudentCouncilTranslations = { | ||||||
| title: 'Student Council', | ||||||
| about: `The Student Council of NIT Kurukshetra acts as the democratic voice of the student fraternity, serving as a vital bridge between the administration and the learners. We are dedicated to ensuring student welfare, organizing grand fests, and upholding the institute's legacy. In reality, our primary job description involves running laps around the Admin Block chasing signatures for budget approvals that never come on time. We don’t just solve problems; we create WhatsApp groups to discuss them for three hours and achieve nothing. We are the chosen few who get to wear formal clothes while everyone else is in shorts, giving us the illusion of authority. We fight for your rights, but mostly we fight for extra food coupons during the fest. We are the Student Council: Overworked, under-slept, and powered entirely by tea and skipped lectures.`, | ||||||
| headings: { | ||||||
| instituteFunctionaries: 'Institute Functionaries', | ||||||
| coreCommittee: 'Core Committee', | ||||||
| nominatedStudents: 'Nominated Students', | ||||||
| studentsRepresentatives: `Student's Representatives`, | ||||||
|
||||||
| studentsRepresentatives: `Student's Representatives`, | |
| studentsRepresentatives: 'Student Representatives', |
Uh oh!
There was an error while loading. Please reload this page.