refactor(events): single-source the slot-category canon#14
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was
Der Timetable-Slot-Kategorie-Kanon war an 4 Stellen dupliziert — das führte beim Hinzufügen von
vortragzum Drift (lineup.tsvergessen). Jetzt gibt es eine Quelle.lib/lineup.ts:CATEGORY_LABELSist die einzige Quelle.SLOT_CATEGORIESwird perObject.keys(CATEGORY_LABELS)abgeleitet;LINEUP_DEFAULT_CATEGORIES(= alle außer break) undDEFAULT_SLOT_CATEGORYliegen daneben.lib/event-validation.ts: re-exportiertALLOWED_SLOT_CATEGORIES(=SLOT_CATEGORIES) +DEFAULT_SLOT_CATEGORYaus lineup (Muster wie die bestehenden./slug-Re-Exports) — Test bleibt unverändert lauffähig.TimetableBuilder.tsx+admin/sections/page.tsx: nutzenSLOT_CATEGORIESstatt 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 buildgrün;npm test23/23. Sanity-Grep: kein Slot-Kanon-Literal mehr außerhalblineup.ts.🤖 Generated with Claude Code