45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
/**
|
|
* 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';
|
|
}
|
|
}
|