subjects module
Registered courses and a choices tab. Groups L/T/P rows that share a subject code.
Related: Attendance Module, Exams Module.
Component architecture#
flowchart TD Sub["Subjects.jsx"] --> Card["SubjectInfoCard.jsx"] Sub --> Tabs["registered | choices"] Sub --> Select["semester Select"]
Props include w, subjectData, semestersData, selectedSem, subjectChoices, activeTab, and the loading flags lifted in App.jsx.
Component: Subjects.jsx#
Data fetching flow#
flowchart TD
Tab{"activeTab"} -->|registered| Reg["w.get_registered_semesters"]
Tab -->|choices| Ch["w.get_semesters_for_grade_card"]
Reg --> Fac["w.get_registered_subjects_and_faculties"]
Ch --> Pref["w.get_subject_choices"]Cache keys are semester.registration_id. Choices land in subjectChoices. Registered subjects land in subjectData.
Subject grouping logic#
flowchart TD Raw["subjects array L T P rows"] --> Reduce["reduce by subject_code"] Reduce --> Group["name code credits isAudit components"]
Each component: { type: subject_component_code, teacher: employee_name }. Audit when audtsubject === "Y".
Component: SubjectInfoCard.jsx#
flowchart LR Left["name code L/T/P teachers"] --> Right["credits"]
L Lecture, T Tutorial, P Practical.
Data layer integration#
get_registered_semesters() → semester list.
get_registered_subjects_and_faculties(semester) → { subjects, registered_subject_faculty }.
get_subject_choices(semester) → object with subjectpreferencegrid in mock data.
Mock keys: fakeData.subjects.semestersData, subjectData[semKey], choiceSubjects.
State management pattern#
flowchart TD AA["AuthenticatedApp"] --> Sub["Subjects"] Sub --> Card["SubjectInfoCard"]
Local loading booleans are actually lifted (loading, subjectsLoading, choicesLoading).
UI components#
flowchart TD Sticky["sticky top-14"] --> Select Body --> Credits["Total Credits"] Body --> Cards["SubjectInfoCard list"]
Styling and layout#
flowchart TD Card["border-b flex"] --> Info["flex-1 name code components"] Card --> Badge["credits text-3xl"]
max-[390px] shrinks type.
Data flow summary#
flowchart TD Tab --> SemList["displayedSemesters"] SemList --> Fetch["cache miss -> w"] Fetch --> Group["group by code"] Group --> UI["cards"]