Skip to content

feat(website): add timetable slot comparison view - #4461

Open
eugenewong22 wants to merge 2 commits into
nusmodifications:masterfrom
eugenewong22:timetable-slots
Open

feat(website): add timetable slot comparison view#4461
eugenewong22 wants to merge 2 commits into
nusmodifications:masterfrom
eugenewong22:timetable-slots

Conversation

@eugenewong22

@eugenewong22 eugenewong22 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Stacked on #4460. This PR is built on top of the save-slots PR and includes its commit, so it should be reviewed and merged after that one. Until then its diff shows both the slots feature and the comparison view.

Context

Completes #4455: with multiple saved timetables (the save-slots PR), users also want to compare arrangements side-by-side instead of using OS split screen or screenshots.

What this does

  • Compare… in the slot switcher's menu (shown when a semester has ≥2 slots) replaces the timetable with two read-only grids side by side, defaulting to the active slot vs. the next one.
  • Each pane has a dropdown to pick any slot, a course count, and a Use this timetable button that switches to that slot and exits compare mode (the active slot's pane shows a disabled "Current timetable" instead).
  • Grids render in vertical orientation so they pair naturally; below the md breakpoint the Bootstrap columns stack, which is the mobile behaviour.
  • Compare mode is plain component state — no new route. (A ?compare= deep link is a possible future enhancement.) It resets on semester change.

Implementation

  • TimetableSlotsCompare renders the bare Timetable grid directly (the VenueDetails pattern) — the heavy interactive TimetableContent isn't involved. Per pane: getSlotTimetableDatahydrateSemTimetableWithLessons (hidden modules omitted) → colour via fillColorMapping with the slot's own saved colours → arrangeLessonsForWeek.
  • Slot modules are fetched on mount in case they're missing from the module bank; hydration tolerates missing modules while they load.

Testing

  • Component tests with a real store: two grids render from an active + an inactive slot, pane pickers, "Use this timetable" switches state and exits, close button.
  • pnpm run ci passes.
  • Manually verified in Chromium: enter/exit compare, correct modules in each pane, mobile stacking (screenshot), "Use this timetable" restores the right arrangement.
compare compare-mobile

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

@eugenewong22 is attempting to deploy a commit to the modsbot's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.86992% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.99%. Comparing base (988c6fd) to head (5e6e72a).
⚠️ Report is 264 commits behind head on master.

Files with missing lines Patch % Lines
website/src/views/timetable/TimetableContainer.tsx 56.52% 10 Missing ⚠️
...ite/src/views/timetable/TimetableSlotsSwitcher.tsx 86.66% 8 Missing ⚠️
website/src/actions/moduleBank-lru.ts 66.66% 1 Missing ⚠️
website/src/actions/timetables.ts 96.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4461      +/-   ##
==========================================
+ Coverage   54.52%   59.99%   +5.46%     
==========================================
  Files         274      318      +44     
  Lines        6076     7539    +1463     
  Branches     1455     1858     +403     
==========================================
+ Hits         3313     4523    +1210     
- Misses       2763     3016     +253     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Add "save slots" per semester (nusmodifications#4455): a tab switcher lets users keep
several timetable arrangements and switch between them instantly,
create blank or duplicated slots, and rename/delete via undoable
actions. Shared timetable links can now import into a new slot
instead of overwriting the saved one.

The active timetable stays in the existing lessons/colors/hidden/ta
maps, so existing timetable actions, selectors, undo, share and
export are unchanged. Inactive arrangements live in a new `slots` map
keyed by semester; switching snapshots the outgoing slot and loads
the target's data. A redux-persist v3 migration adds the new (empty)
maps for existing users, who implicitly keep their current timetable
as "Timetable 1". Slot modules are pinned against module bank LRU
eviction and prefetched before a switch loads them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant