Skip to content

refactor(events): single-source the slot-category canon#14

Merged
mrwind-up-bird merged 1 commit into
mainfrom
feat/lineup-category-single-source
Jul 3, 2026
Merged

refactor(events): single-source the slot-category canon#14
mrwind-up-bird merged 1 commit into
mainfrom
feat/lineup-category-single-source

Conversation

@mrwind-up-bird

Copy link
Copy Markdown
Contributor

Was

Der Timetable-Slot-Kategorie-Kanon war an 4 Stellen dupliziert — das führte beim Hinzufügen von vortrag zum Drift (lineup.ts vergessen). Jetzt gibt es eine Quelle.

  • lib/lineup.ts: CATEGORY_LABELS ist die einzige Quelle. SLOT_CATEGORIES wird per Object.keys(CATEGORY_LABELS) abgeleitet; LINEUP_DEFAULT_CATEGORIES (= alle außer break) und DEFAULT_SLOT_CATEGORY liegen daneben.
  • lib/event-validation.ts: re-exportiert ALLOWED_SLOT_CATEGORIES (= SLOT_CATEGORIES) + DEFAULT_SLOT_CATEGORY aus lineup (Muster wie die bestehenden ./slug-Re-Exports) — Test bleibt unverändert lauffähig.
  • TimetableBuilder.tsx + admin/sections/page.tsx: nutzen SLOT_CATEGORIES statt eigener Literal-Arrays.

Effekt: Eine neue Kategorie = eine Zeile in CATEGORY_LABELS. Nebenbei ist die vorher uneinheitliche Reihenfolge (Dropdown vs. Filter-Checkboxen) jetzt überall identisch.

Kein Verhaltens- und kein Schema-Change; reines Refactoring.

Gates

npx tsc --noEmit + npm run build grün; npm test 23/23. Sanity-Grep: kein Slot-Kanon-Literal mehr außerhalb lineup.ts.

🤖 Generated with Claude Code

CATEGORY_LABELS is now the single source of truth; SLOT_CATEGORIES derives from
its keys via Object.keys, and LINEUP_DEFAULT_CATEGORIES/DEFAULT_SLOT_CATEGORY live
alongside it. event-validation re-exports ALLOWED_SLOT_CATEGORIES/DEFAULT_SLOT_CATEGORY
from lineup; TimetableBuilder and the sections editor consume SLOT_CATEGORIES
instead of their own literal arrays. Adding a category is now a one-line edit to
CATEGORY_LABELS — this removes the 4-place duplication that caused the vortrag
drift (lineup.ts forgotten). Also unifies the previously-inconsistent category
ordering across the timetable dropdown and the lineup filter.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mrwind-up-bird mrwind-up-bird merged commit 39477de into main Jul 3, 2026
1 check passed
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