Files
gridpilot.gg/apps/website/lib/view-models/DriverRegistrationStatusViewModel.ts
Marc Mintel d97f50ed72
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 6m4s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-23 11:59:49 +01:00

38 lines
1.1 KiB
TypeScript

import { DriverRegistrationStatusDTO } from '@/lib/types/generated/DriverRegistrationStatusDTO';
import { ViewModel } from "../contracts/view-models/ViewModel";
export class DriverRegistrationStatusViewModel extends ViewModel {
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;
}
}