refactor(schedule): extract shared pure schedule filter#198
Conversation
Timeline and ListSchedule each had their own inline day/time/stage filter predicates. Extract filterScheduleDays into src/lib/scheduleFilter.ts so both views share one pure, unit-tested implementation, and remove a stray debug console.log from ListSchedule in the process. Closes #190 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AziTqr3f12fxALYD6jhrW8
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR refactors duplicated schedule filtering logic (day, time-of-day in festival timezone, and stage selection) out of the Timeline and List Schedule views into a shared pure helper (filterScheduleDays) in src/lib/scheduleFilter.ts, with unit tests to lock behavior and enable upcoming vote-type filtering work.
Changes:
- Extracted shared filter predicates into
filterScheduleDays(scheduleDays, criteria, timezone). - Updated Timeline and ListSchedule to use the shared filter helper (and removed the stray debug
console.login ListSchedule). - Added dedicated unit tests covering day/time/stage predicates and combinations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/pages/EditionView/tabs/ScheduleTab/list/ListSchedule.tsx | Replaces inline filtering with filterScheduleDays and removes debug logging. |
| src/pages/EditionView/tabs/ScheduleTab/horizontal/Timeline.tsx | Replaces inline filtering with the shared filterScheduleDays helper. |
| src/lib/scheduleFilter.ts | Introduces the pure shared filter function and criteria type (timezone-aware time buckets). |
| src/lib/scheduleFilter.test.ts | Adds unit tests validating day/time/stage filtering behavior and non-mutation. |
Extracts the duplicated day/time-of-day/stage filter predicates from Timeline and ListSchedule into one pure
filterScheduleDaysfunction insrc/lib/scheduleFilter.ts, so upcoming vote-type filtering (parent PRD #188) can be added in a single place.No behavior change; also removes a stray debug
console.logfrom ListSchedule.Closes #190
Verification
pnpm vitest run src/lib/scheduleFilter.test.tscovers day, festival-timezone time-of-day, and stage predicates plus combinations, without rendering the DOM.pnpm run lint,pnpm run typecheck, andpnpm vitest run(full suite, 364 tests) all pass.Generated by Claude Code