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-rendering-and-interaction

Timetable rendering and interaction

The timetable UI turns selected lessons into a weekly view that students can read, adjust, share, and export. It also reuses the same display model for course, venue, and day-focused views. This page explains the visible timetable surfaces and their user-facing relationships; timetable experience gives the wider product model, while timetable scheduling and lesson selection explains how lesson choices are made.

Timetable views

Weekly timetable

The weekly timetable is the main view for a semester. It presents school days against a shared time scale and places each lesson in its time range. It normally shows Monday through Friday, then adds Saturday when it has lessons or Sunday must be shown. Sunday appears when it has lessons or when a highlighted period belongs to Sunday. The view receives lessons that have already been arranged for the week, then adds display state such as module colour, hidden status, active lesson status, and the selected layout mode.

The rendering flow moves from semester data to an interactive schedule:

flowchart LR
    A[Semester timetable] --> B[Lesson display data]
    B --> C[Weekly day and row arrangement]
    C --> D[Time scale and day columns]
    D --> E[Lesson cells]
    E --> F[Selection, hover, and navigation]

Each lesson cell can show the module, lesson type, class number, venue, and week information. A course title can be shown in addition to the course code when the user enables title display. Lessons that occur only on some weeks expose the full date pattern through a tooltip.

References: website/…/TimetableContent.tsx• L371-443 website/…/Timetable.tsx• L66-125 website/…/Timetable.test.tsx• L20-97 website/…/TimetableCell.tsx• L117-189

Exam calendar

The exam calendar is an alternate timetable view for semesters with exam data. It groups visible courses by exam date and by morning, afternoon, or evening period. Each course remains a link to its course page, so the calendar supports planning as well as date checking.

Courses hidden from the timetable and courses marked as teaching-assistant work are not included in this calendar. If no visible course has an exam date, the view states that the semester has no final exams.

References: website/…/TimetableContent.tsx• L307-351 website/…/TimetableContent.tsx• L420-429 website/…/ExamCalendar.tsx• L31-60 website/…/ExamWeek.tsx• L71-100

Day schedule

The /today route gives a date-focused alternative to the weekly grid. It starts from the user's timetable, keeps lessons that occur on each Singapore date, and groups empty or non-instructional dates so the user can see breaks as well as classes. On the current day it removes ended lessons and marks the current time or the next lesson.

The day schedule uses Singapore time for the day boundary, lesson status, and countdown behavior. On larger screens it can show a map beside the schedule; on smaller screens the selected lesson can open its map in the day content.

References: website/…/TodayContainer.tsx• L180-267 website/…/TodayContainer.tsx• L269-329 website/…/TodayContainer.tsx• L332-357

Course and venue timetables

Course and venue pages reuse the weekly timetable display with a different meaning for each cell. A course page shows that course's lesson offerings for a selected semester and lets a user open a lesson's venue. A venue page shows classes held in one room and lets a user open the related course.

These views use colour and links to make the filtered context clear. A venue view can also mark a searched availability period, while the course view can switch between semesters that have timetable data.

References: website/…/LessonTimetable.tsx• L15-37 website/…/LessonTimetable.tsx• L40-53 website/…/VenueDetails.tsx• L29-45 website/…/VenueDetails.tsx• L47-96

Timetable layout

Horizontal layout

Horizontal mode reads like a conventional weekly calendar. Days form rows and time runs across each row. The time labels and day names stay aligned with the lesson cells, while the timetable keeps a minimum width so short cells remain readable.

The current time marker uses Singapore wall-clock time. It appears only on the current school day and only when the current time falls inside the visible timetable range. The current day also receives a light visual mark.

References: website/…/Timetable.tsx• L69-124 website/…/TimetableDay.tsx• L54-102 website/…/TimetableTimings.tsx• L12-30 website/…/CurrentTimeIndicator.tsx• L5-13

Vertical layout

Vertical mode is designed for narrow or tall layouts. Days form columns and time runs down each column, which lets the timetable use the available screen width without shrinking every lesson into a narrow cell. The same lesson data and interactions work in both modes.

The main timetable selects vertical mode from the saved display preference. Venue views use it automatically on narrower viewports, and the layout controls are disabled while the exam calendar is open because that calendar has its own grid.

References: website/…/TimetableContent.tsx• L391-443 website/…/TimetableActions.tsx• L37-86 website/…/VenueDetails.tsx• L47-95 website/…/TimetableDay.tsx• L30-67

Small-screen layout

Small screens keep the weekly grid scrollable instead of forcing all days into the viewport. The day label stays visible while the user scrolls across time, and the timetable wrapper avoids horizontal overscroll that could trigger browser page navigation.

The module search changes from an inline dropdown to a full-screen modal on small screens. This gives the search field and result list room to remain usable when the mobile keyboard is open. Toolbar groups also wrap to full width in small or vertical layouts.

References: website/…/TimetableContent.scss• L9-19 website/…/TimetableDay.scss• L35-79 website/…/ModulesSelect.tsx• L109-249 website/…/TimetableActions.scss• L44-66

User interactions

Lesson selection

A selectable lesson cell starts a modify flow rather than changing the schedule at once. The UI marks the active lesson, highlights compatible lesson choices, and lets the user choose a replacement. A click outside the timetable or the Escape key cancels the flow.

Teaching-assistant lessons are different because more than one lesson of the same type can be selected. Their cells use add and remove indicators, while ordinary lesson choices replace the active choice. After a change, the timetable restores the changed cell's approximate screen position so the user does not lose context.

References: website/…/TimetableContent.tsx• L179-246 website/…/TimetableContent.tsx• L395-443 website/…/TimetableCell.tsx• L122-181

Module management

The module search adds courses to the current semester timetable and shows whether a result is already present or still being added. It is available only when the user is online because adding a course may require module data that is not local.

The module table then acts as the control list for the displayed schedule. Users can remove a course, hide its lessons, mark it as teaching-assistant work, change its colour, open its course page, and choose the table order. When a module is removed, the table can keep a temporary row that names the removed module and offers Dismiss or Undo. Reset removes all courses for the current semester after confirmation.

References: website/…/ModulesSelectContainer.tsx• L27-61 website/…/ModulesSelect.tsx• L118-207 website/…/TimetableModulesTable.tsx• L59-168 website/…/ModuleTombstone.tsx• L8-42 website/…/ModuleTombstone.test.tsx• L12-33 website/…/ModulesTableFooter.tsx• L57-97 website/…/ResetTimetable.tsx• L31-64

Sharing and export

The timetable toolbar provides actions that move the current display beyond the page. Sharing creates a URL that carries the semester timetable and its hidden or teaching-assistant module choices. A recipient first sees the shared timetable in read-only form and must import it to replace the saved timetable.

Downloads provide an image, PDF, or iCalendar file. The share dialog also supports copying the URL, a QR code, email, and messaging links. These actions preserve the same timetable context so a shared or exported result matches what the user selected.

References: website/…/TimetableActions.tsx• L37-99 website/…/ShareTimetable.tsx• L101-160 website/…/ShareTimetable.tsx• L163-293 website/…/ExportMenu.tsx• L32-147 website/…/TimetableContainer.tsx• L41-133

Timetable routes

Semester routes

The main route is /timetable/:semester?/:action?. The semester path identifies the academic term, and the optional share action identifies a shared timetable import. An invalid semester or unsupported action redirects to the active semester's timetable rather than rendering an unknown schedule.

The root route redirects to /timetable, which makes the timetable the default entry point. The semester switcher changes both the selected semester and the URL so the visible schedule and browser location stay aligned.

References: website/…/Routes.tsx• L25-30 website/…/paths.ts• L19-45 website/…/TimetableContainer.tsx• L137-161 website/…/TimetableContainer.tsx• L257-290

The timetable display is also part of the /today, /venues/:venue?, and /courses/:moduleCode/:slug? experiences. These routes do not replace the saved weekly timetable. They present a filtered or date-aware view and use lesson cells to lead the user to the next useful context.

The route relationships are:

RouteTimetable purposeMain next context
/timetable/:semester?Edit and review the semester scheduleLesson choice, sharing, or export
/todaySee upcoming lessons by Singapore dateVenue map and lesson details
/venues/:venue?See classes in one venueCourse page
/courses/:moduleCode/:slug?See one course's lesson offeringsVenue page

References: website/…/Routes.tsx• L28-40 website/…/LessonTimetable.tsx• L22-36 website/…/VenueDetails.tsx• L47-95

Change checklist

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

  • Update the route helpers and the route table together when changing semester or share paths. Route changes also require the sitemap update noted in website/…/paths.ts and website/…/Routes.tsx.
  • Keep the lesson arrangement and cell interaction contract aligned across the main timetable, course timetable, and venue timetable. Each caller supplies a different navigation target.
  • Keep share serialization, import handling, and read-only rendering aligned when adding timetable fields. Shared links must reproduce hidden and teaching-assistant module state as well as lesson choices.
  • Review both horizontal and vertical layout behavior when changing timetable cell sizing or day headers. Small-screen scrolling depends on the grid retaining a readable minimum size.
  • Keep hidden and teaching-assistant filtering consistent between the weekly grid, module table, exam calendar, and unit counts.

Important failure modes

TriggerConsequenceGuard
Unknown semester or unsupported timetable action in the URLThe user does not see the requested schedule and is redirected to the active semesterValidate the path through semesterForTimetablePage and the supported share action before rendering
A shared timetable includes module codes that are not loadedImport data cannot be hydrated into a useful previewLoad valid missing modules before deserializing the shared timetable
The user imports a shared timetableThe saved timetable for that semester is replacedShow the read-only preview and require an explicit Import action; offer Undo after import
The timetable scroll position changes during lesson replacementThe selected lesson can move off screen and confuse the userRestore the changed cell's approximate position after the new lesson arrangement renders
A hidden or teaching-assistant course remains in exam display dataThe exam calendar or clash warning includes a course the user excludedApply the same visibility rules before building exam groups and clash lists
A viewer's local timezone differs from SingaporeThe current day, current-time marker, or upcoming lesson can be wrongDerive timetable day and time behavior from Singapore time

Key files

FileWhy to read it
website/…/TimetableContainer.tsxUnderstand semester routing, shared timetable preview, import confirmation, and read-only state
website/…/TimetableContent.tsxUnderstand how the weekly view, controls, module list, and exam calendar are assembled
website/…/Timetable.tsxUnderstand the common weekly grid used by several product views
website/…/TimetableDay.tsx and TimetableCell.tsxUnderstand day layout, lesson content, hover state, and selectable cells
website/…/TimetableActions.tsxUnderstand layout switching, title display, exam calendar, share, export, and reset controls
website/…/ModulesSelect.tsx and TimetableModulesTable.tsxUnderstand course search and the visible controls for each course
website/…/ModuleTombstone.tsxUnderstand the temporary removed-module row and its Dismiss and Undo actions
website/…/ExamCalendar.tsx and ExamWeek.tsxUnderstand the alternate exam-date view
website/…/TodayContainer.tsxUnderstand the date-focused schedule and Singapore-time behavior
website/…/VenueDetails.tsxUnderstand venue-filtered timetable rendering and course navigation
website/…/LessonTimetable.tsxUnderstand course-filtered timetable rendering and venue navigation
website/…/Routes.tsx and website/…/paths.tsUnderstand the public timetable and related route contracts