feat(app): event status transitions on detail header

Add transition buttons from allowed_transitions with Dutch labels,
confirmation dialog, TanStack mutation + cache invalidation, and
422/generic error handling via notification store.

Made-with: Cursor
This commit is contained in:
2026-04-12 22:20:36 +02:00
parent f6e3568011
commit 1172c41d33
4 changed files with 184 additions and 4 deletions

View File

@@ -0,0 +1,39 @@
import type { EventStatus } from '@/types/event'
const STATUS_ORDER: Record<EventStatus, number> = {
draft: 0,
published: 1,
registration_open: 2,
buildup: 3,
showday: 4,
teardown: 5,
closed: 6,
}
export const EVENT_STATUS_LABEL_NL: Record<EventStatus, string> = {
draft: 'Concept',
published: 'Gepubliceerd',
registration_open: 'Registratie open',
buildup: 'Opbouw',
showday: 'Showdag',
teardown: 'Afbouw',
closed: 'Afgesloten',
}
export function eventStatusLabelNl(status: EventStatus): string {
return EVENT_STATUS_LABEL_NL[status]
}
/** UI styling: forward in lifecycle, rollback, or closing the event. */
export function transitionVisualKind(
currentStatus: EventStatus,
targetStatus: EventStatus,
): 'forward' | 'backward' | 'dangerous' {
if (targetStatus === 'closed')
return 'dangerous'
const current = STATUS_ORDER[currentStatus]
const next = STATUS_ORDER[targetStatus]
return next < current ? 'backward' : 'forward'
}