Files
gridpilot.gg/apps/website/lib/view-models/DriverRegistrationStatusViewModel.ts
2025-12-18 00:08:47 +01:00

36 lines
1.0 KiB
TypeScript

import { DriverRegistrationStatusDTO } from '../types/generated/DriverRegistrationStatusDTO';
export class DriverRegistrationStatusViewModel implements DriverRegistrationStatusDTO {
isRegistered: boolean;
raceId: string;
driverId: string;
constructor(dto: DriverRegistrationStatusDTO) {
Object.assign(this, dto);
}
/** UI-specific: Status message */
get statusMessage(): string {
return this.isRegistered ? 'Registered for this race' : 'Not registered';
}
/** UI-specific: Status color */
get statusColor(): string {
return this.isRegistered ? 'green' : 'red';
}
/** UI-specific: Badge variant */
get statusBadgeVariant(): string {
return this.isRegistered ? 'success' : 'warning';
}
/** UI-specific: Registration button text */
get registrationButtonText(): string {
return this.isRegistered ? 'Withdraw' : 'Register';
}
/** UI-specific: Whether can register (assuming always can if not registered) */
get canRegister(): boolean {
return !this.isRegistered;
}
}