Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

07 — Component Library (Teachers Module)

Module-specific components; all reference the shared library (00-shared/03). Every component listed here is a client composition over the implemented API — none invent backend data.


A. Module components

TeacherListTile (extends AppListTile)

  • Props: teacher (id, name, employeeNumber, status, departmentLabel), onTap, onMenu (Edit/Deactivate), selected?.
  • Content: AppAvatar initials (name), title = display name, subtitle = employeeNumber · department, trailing = StatusChip + overflow AppMenu.
  • Tokens: surface row, height 56 (02_Design_Tokens.md §3).
  • A11y: combined label "Ramesh Kumar, TCH001, Science, active".

StatusChip (employment status)

  • Props: status: EmploymentStatus (teacher.schema.ts:7-12).
  • Mapping (icon + label — never color-only, 09 §9):
StatusIcon (Material Symbols)Container tokenLabel
activecheck_circle (filled)secondaryContainerActive
inactivepause_circlesurfaceVariantInactive
on_leavebeach_accesstertiaryContainerOn leave
terminatedperson_offerrorContainerTerminated
  • Implementation: AppBadge + icon; Flutter Chip/custom Container.

TeacherCard (desktop grid variant, extends AppCard)

  • Content: header avatar+name+status, body: 3 key InfoRows (dept, designation, employeeNumber), footer: subject count + class count (teacher.schema.ts:44-48).
  • Props: teacher, onTap, elevation: e-1.

AssignmentCard (extends AppCard)

  • Props: assignment (subjectLabel, classLabel, yearLabel), onRemove?.
  • Content: subject (titleMedium) / class · year (bodyMedium) / trailing remove icon (tooltip "Remove assignment").
  • A11y: card tap = one button semantics; remove icon separate.

AssignmentMatrixHeader

  • Props: year (current AcademicYear), onYearChanged, onAdd.
  • Renders AppSectionHeader + AppDropdown (academic year) + tonal add button ("Add assignment").

EmptyAssignmentsState (extends AppEmptyState)

  • Icons: menu_book; copy per context (teacher/class/year).

SubjectBadge / ClassBadge (extends AppBadge + AppChips)

  • Props: label, onDelete?. Read-only chips on profile; input-chip mode in multi-select fields (S5).
  • Max chips shown before "+N more" (list row overflow), (proposed).

TeacherAvatar (extends AppAvatar)

  • Initials from firstName/lastName of linked User (user.schema.ts:17-23) — client resolves from user reference; no photo field exists (fallback always).

TeacherCountStat (extends AppStatTile)

  • Dashboard integration: teachers.total from GET /dashboard/overview (dashboard.service.ts:32,52); tap → S1.

MyTeachingHeader (teacher self, (planned))

  • Banner + summary tiles (assignments count, periods this week) — composed client-side.

B. Reused shared components

Shared componentUsed in
AppSearchBarS1 (q)
AppSkeletonS1/S2/S3/S4 loading
AppEmptyStateS1 empty, S3 empty, S4 empty
AppErrorStateS1/S3 errors (envelope code)
AppBannerS5 409 conflict, S2 on-leave
AppSnackbarsave/deactivate/remove confirmations
AppDropdownyear picker (S3), department/designation/subject/class pickers (S5/S7)
AppSearchBar-style searchable pickeruser picker (S5)
AppDatePickerjoiningDate (S5/S6)
AppTextFieldemployeeNumber, qualification, experienceYears (S5/S6)
AppChips (filter)status/department/designation filters (S1)
AppTabsprofile/assignments/schedule (S2-S4)
AppDialogS8 deactivate, assignment remove, duplicate warning
AppBottomSheetS7 assignment editor (phone), pickers
AppMenurow/detail overflow menus
AppFABS1 "Add teacher"
AppButtonall CTAs (filled/tonal/outlined/destructive)
AppInfoRowS2 profile rows, S1 card body
AppOfflineBannermodule-wide offline reads
AppSectionHeaderS2/S3/S4 sections
AppProgresssubmit spinners, page loaders
AppStatTileS9 summary, dashboard

C. Composition rules

  1. No screen renders raw ObjectIds — every id resolved via reference-catalog lookup or fallback (04 §6).
  2. Status color mapping centralized in StatusChip — no ad-hoc status colors in screens (enforced, 04_Design_System_Mapping.md §7).
  3. Golden tests: StatusChip (4 states × light/dark), TeacherListTile, AssignmentCard, TeacherCard (3 sizes), per 00-shared/03 §G.
  4. New components only if shared library lacks the need (YAGNI — check shared first).