website refactor
This commit is contained in:
44
apps/website/lib/display-objects/RaceStatusDisplay.ts
Normal file
44
apps/website/lib/display-objects/RaceStatusDisplay.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* RaceStatusDisplay
|
||||
*
|
||||
* Deterministic display logic for race statuses.
|
||||
*/
|
||||
|
||||
export type RaceStatusVariant = 'info' | 'success' | 'neutral' | 'warning' | 'primary' | 'default';
|
||||
|
||||
export class RaceStatusDisplay {
|
||||
private static readonly CONFIG: Record<string, { variant: RaceStatusVariant; label: string; icon: string }> = {
|
||||
scheduled: {
|
||||
variant: 'primary',
|
||||
label: 'Scheduled',
|
||||
icon: 'Clock',
|
||||
},
|
||||
running: {
|
||||
variant: 'success',
|
||||
label: 'LIVE',
|
||||
icon: 'PlayCircle',
|
||||
},
|
||||
completed: {
|
||||
variant: 'default',
|
||||
label: 'Completed',
|
||||
icon: 'CheckCircle2',
|
||||
},
|
||||
cancelled: {
|
||||
variant: 'warning',
|
||||
label: 'Cancelled',
|
||||
icon: 'XCircle',
|
||||
},
|
||||
};
|
||||
|
||||
static getLabel(status: string): string {
|
||||
return this.CONFIG[status]?.label || status.toUpperCase();
|
||||
}
|
||||
|
||||
static getVariant(status: string): RaceStatusVariant {
|
||||
return this.CONFIG[status]?.variant || 'neutral';
|
||||
}
|
||||
|
||||
static getIconName(status: string): string {
|
||||
return this.CONFIG[status]?.icon || 'HelpCircle';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user