Skip to content

refactor: extract shared time-of-day filter logic out of Timeline/ListSchedule #166

Description

@chiptus

Problem

The "morning = hour 6-12, afternoon = 12-18, evening = 18-24" time-of-day bucket rule is hand-copied verbatim into two views, computed via getFestivalHour(startTime, festival.timezone):

  • src/pages/EditionView/tabs/ScheduleTab/horizontal/Timeline.tsx:62-78
  • src/pages/EditionView/tabs/ScheduleTab/list/ListSchedule.tsx:56-75

No src/lib module owns the "time-of-day bucket" concept — it can drift silently (e.g. if the "evening" boundary changes, a fix to one copy can miss the other).

Note: this is distinct from #154 (the "Jump to Time" button being a no-op stub) — that ticket covers wiring the button; this one covers the duplicated filter rule itself.

Fix

Extract a shared matchesTimeFilter(set, filter, timezone) (or getTimeOfDayBucket(hour)) to src/lib; both views call it instead of each carrying their own copy.

Architecture note

Filed from an architecture review (module/interface/depth vocabulary, see /codebase-design). Deleting either copy today concentrates nothing — they're independent; a shared module is the missing seam.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions