Introducing a new way to review your PRs.

Read the announcement

nusmodifications / nusmods

🏫 Official course planning platform for National University of Singapore.

View on GitHub

20 documents · Updated Nov 6, 2026

docs / timetable-experience

Timetable experience

The timetable experience turns a user's selected module lessons into a weekly view for one academic semester. It lets the user add courses, choose lesson options, review exam dates, and share or export the resulting schedule. The experience joins saved scheduling state with timetable display and interaction behavior; see Timetable scheduling and Timetable rendering and interaction for those child views.

Timetable page

The timetable page is the semester-focused workspace for building and reviewing a schedule. It loads the timetable for the semester in the URL, keeps a shared timetable separate until the user accepts it, and presents the schedule with its course controls.

The page supports both saved and shared schedules. A shared schedule is read-only while it is under review, and importing it replaces the saved schedule for that semester. An invalid semester or unsupported URL action sends the user back to the active semester timetable. website/…/TimetableContainer.tsx• L164-290

Semester view

Each semester has its own timetable. The semester switcher changes both the selected semester and the timetable page, so the user can review schedules without mixing lesson choices across semesters. website/…/TimetableContainer.tsx• L137-161

References: website/…/TimetableContainer.tsx• L137-161 website/…/paths.ts• L19-45

The page combines the weekly schedule with a module list. The module list gives the user a place to add or remove courses and manage course-level display choices. The weekly view then reflects the selected lesson data for the same semester. website/…/TimetableContent.tsx• L355-490

References: website/…/TimetableContent.tsx• L355-490

Course selection

Course selection starts with a search over the modules available for the semester. The user selects a course from the results, and the system loads its lesson data before adding it with an initial lesson choice. The search is disabled while offline because adding a course needs course data that may not be present locally. website/…/ModulesSelectContainer.tsx• L27-63 website/…/timetables.ts• L72-97

When a course is first added, the timetable starts with one available class choice for each lesson type where a choice exists. The user can then replace those choices through the schedule or use course-level actions to hide the course, mark it as a TA course, change its color, or remove it. website/…/index.ts• L31-65 website/…/TimetableModulesTable.tsx• L59-168

After a course is removed, its row can show a removal notice with Dismiss and Undo actions. Dismiss clears the notice, while Undo restores the prior timetable state before clearing it. website/…/ModuleTombstone.tsx• L14-42 website/…/ModuleTombstone.test.tsx• L23-32

References: website/…/index.ts• L31-65 website/…/TimetableModulesTable.tsx• L59-168 website/…/ModuleTombstone.tsx• L14-42 website/…/ModuleTombstone.test.tsx• L23-32

Schedule controls

The timetable controls change how the schedule is viewed without changing its lesson choices. Users can switch between horizontal and vertical layouts, show or hide course titles in the horizontal layout, open an exam calendar when exam data is available, and reset the semester timetable. Export and share actions expose the current schedule to other systems or users. website/…/TimetableActions.tsx• L37-99

References: website/…/TimetableActions.tsx• L37-99

Lesson selection flow

The lesson selection flow maps compact saved choices to full lesson records, adds the state needed for user interaction, and arranges the visible lessons into a weekly schedule. This separation lets the timetable preserve a small schedule choice while still showing the lesson time, place, weeks, and course name.

The main flow is:

flowchart LR
    A[Selected module lessons] --> B[Load lesson records for semester]
    B --> C[Add course and interaction state]
    C --> D[Flatten visible lessons]
    D --> E[Group by day and place overlaps in rows]
    E --> F[Render weekly schedule]
    F --> G[Change lesson choice]
    G --> A

Lesson data

The saved timetable identifies a module and its lesson choices. The page expands those choices into full lessons from the module's semester data, then adds the module code and title needed by the user-facing view. website/…/timetables.ts• L13-16 website/…/lessonHydration.ts• L27-65

References: website/…/timetables.ts• L13-16 website/…/lessonHydration.ts• L27-65

The page removes courses marked hidden before it builds the interactive schedule. Hidden courses remain part of the user's course list and can be shown again. TA courses use a separate interaction mode so the user can select more than one lesson instance when needed. website/…/TimetableContent.tsx• L371-389 website/…/interactabilityHydration.ts• L73-92

References: website/…/TimetableContent.tsx• L371-389 website/…/interactabilityHydration.ts• L73-92

Lesson choices

The timetable presents only the lesson choices that fit the current selection context. With no active choice, a lesson with another class option can become the focus for editing. Once the user starts editing a module, the schedule exposes the relevant alternatives and marks lessons as active, available, or already selected. Read-only shared schedules do not expose editing choices. website/…/interactabilityHydration.ts• L118-163

References: website/…/interactabilityHydration.ts• L118-163

Clicking a lesson either starts an edit or applies the selected alternative. A click outside the schedule or the Escape key ends the edit. The page keeps the edited area near its earlier screen position so a change does not disorient the user when the visible lesson set changes. website/…/TimetableContent.tsx• L202-246

References: website/…/TimetableContent.tsx• L202-246

Weekly schedule

The weekly schedule is the primary user-facing result of the timetable state. It shows weekday columns by default and adds Saturday or Sunday when weekend lessons or a highlighted period need them. It places lesson blocks and the current-time marker in Singapore time, then adapts the layout to the selected orientation. The schedule can also highlight a venue period when another page uses the same timetable view. website/…/Timetable.tsx• L66-133

Lesson arrangement

The schedule first groups visible lessons by day. It then places overlapping lessons into separate rows within that day, which keeps each block readable while preserving time overlap information. website/…/lessonsArrangement.ts• L16-26 website/…/lessonsArrangement.ts• L29-80

References: website/…/lessonsArrangement.ts• L16-26 website/…/lessonsArrangement.ts• L29-80

The timetable keeps Saturday and Sunday together when either weekend day is needed. A Sunday lesson or Sunday highlight therefore shows both weekend columns, while a Saturday lesson alone shows only Saturday. The timetable also marks the current Singapore day and displays a highlighted venue period in the matching day column. website/…/Timetable.tsx• L66-133 website/…/Timetable.test.tsx• L20-97

References: website/…/Timetable.tsx• L66-133 website/…/Timetable.test.tsx• L20-97

Lesson information

Each lesson block identifies the course and lesson type, then gives the venue and teaching weeks. The week display explains regular, odd, even, and irregular lesson patterns so the user can tell when a block occurs instead of treating every block as weekly. website/…/TimetableCell.tsx• L67-109 website/…/TimetableCell.tsx• L117-189

References: website/…/TimetableCell.tsx• L67-109 website/…/TimetableCell.tsx• L117-189

The timetable experience has two focused areas that explain its internal contracts in more detail:

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to the semester timetable shape must stay aligned with lesson hydration, share-link import, and timetable validation.
  • Changes to hidden or TA course handling must keep the course list, visible lesson set, and imported shared timetable state in agreement.
  • Changes to lesson choice rules must preserve the distinction between normal class choices and TA lesson instances.
  • Changes to timetable URLs must keep semester selection, shared timetable import, and redirects aligned.
  • Changes to lesson timing or week data must preserve both weekly placement and the lesson details shown in each block.
  • Changes to weekend visibility must keep lesson columns and venue highlights present for Saturday and Sunday cases.

Important failure modes

TriggerConsequenceGuard
A shared timetable refers to modules that are not loadedThe shared view cannot show the complete scheduleLoad valid imported modules before deserializing and displaying the shared timetable. website/…/TimetableContainer.tsx• L197-246
A user opens an invalid semester or unsupported timetable actionThe requested page is not shownRedirect to the active semester timetable. website/…/TimetableContainer.tsx• L257-260
Lesson blocks overlap on one dayBlocks can cover each other in the weekly viewPlace overlapping lessons into separate rows before rendering. website/…/lessonsArrangement.ts• L36-61
A course is hidden but still selectedThe course remains in the saved course list but disappears from the weekly viewFilter hidden courses only when building the visible lesson arrangement. website/…/TimetableContent.tsx• L371-389
A user imports a shared timetableThe saved timetable is replaced for that semesterShow an explicit import prompt and provide an undo action. website/…/TimetableContainer.tsx• L70-93
A weekend lesson or venue highlight needs a weekend dayThe schedule can omit the day needed to show the lesson or highlightKeep both weekend columns when Sunday is present or highlighted, and add Saturday when it is needed. website/…/Timetable.tsx• L69-75

Key files

FileWhy to read it
website/…/TimetableContainer.tsxEntry point for semester routing, shared timetable review, and page-level data loading.
website/…/TimetableContent.tsxConnects saved choices, course controls, lesson interaction, and the weekly schedule.
website/…/Timetable.tsxDefines the weekly schedule surface and its day, time, weekend, and current-time behavior.
website/…/Timetable.test.tsxCaptures the weekend-column and Sunday-highlight rules that keep the weekly view complete.
website/…/ModulesSelectContainer.tsxShows how a user searches for and adds a course to a semester timetable.
website/…/TimetableModulesTable.tsxShows the course-level controls that shape the visible schedule.
website/…/ModuleTombstone.tsxShows the removal notice and the actions that dismiss or undo a course removal.
website/…/ModuleTombstone.test.tsxVerifies the user-facing removed-course notice and dismiss action.
website/…/timetables.tsDefines the user-level changes that add courses and change lesson choices.
website/…/lessonHydration.tsShows how saved lesson choices become full lesson data for display.
website/…/lessonsArrangement.tsShows how lessons become day groups and non-overlapping display rows.
website/…/interactabilityHydration.tsShows how the page decides which lesson blocks the user can select or change.