Files
gridpilot.gg/apps/website/lib/view-models/ActivityItemViewModel.ts
2025-12-19 23:18:53 +01:00

35 lines
830 B
TypeScript

/**
* Activity Item View Model
*
* View model for recent activity items.
*/
export class ActivityItemViewModel {
id: string;
type: 'race' | 'league' | 'team' | 'driver' | 'platform';
message: string;
time: string;
impressions?: number;
constructor(data: any) {
this.id = data.id;
this.type = data.type;
this.message = data.message;
this.time = data.time;
this.impressions = data.impressions;
}
get typeColor(): string {
const colors = {
race: 'bg-warning-amber',
league: 'bg-primary-blue',
team: 'bg-purple-400',
driver: 'bg-performance-green',
platform: 'bg-racing-red',
};
return colors[this.type] || 'bg-gray-500';
}
get formattedImpressions(): string | null {
return this.impressions ? this.impressions.toLocaleString() : null;
}
}