Files
gridpilot.gg/core/racing/application/presenters/IDashboardOverviewPresenter.ts
2025-12-16 18:17:48 +01:00

91 lines
2.4 KiB
TypeScript

import type { Presenter } from '@core/shared/presentation';
import type { FeedItemType } from '@core/social/domain/types/FeedItemType';
export interface DashboardDriverSummaryViewModel {
id: string;
name: string;
country: string;
avatarUrl: string;
rating: number | null;
globalRank: number | null;
totalRaces: number;
wins: number;
podiums: number;
consistency: number | null;
}
export interface DashboardRaceSummaryViewModel {
id: string;
leagueId: string;
leagueName: string;
track: string;
car: string;
scheduledAt: string;
status: 'scheduled' | 'running' | 'completed' | 'cancelled';
isMyLeague: boolean;
}
export interface DashboardRecentResultViewModel {
raceId: string;
raceName: string;
leagueId: string;
leagueName: string;
finishedAt: string;
position: number;
incidents: number;
}
export interface DashboardLeagueStandingSummaryViewModel {
leagueId: string;
leagueName: string;
position: number;
totalDrivers: number;
points: number;
}
export interface DashboardFeedItemSummaryViewModel {
id: string;
type: FeedItemType;
headline: string;
body?: string;
timestamp: string;
ctaLabel?: string;
ctaHref?: string;
}
export interface DashboardFeedSummaryViewModel {
notificationCount: number;
items: DashboardFeedItemSummaryViewModel[];
}
export interface DashboardFriendSummaryViewModel {
id: string;
name: string;
country: string;
avatarUrl: string;
}
export interface DashboardOverviewViewModel {
currentDriver: DashboardDriverSummaryViewModel | null;
myUpcomingRaces: DashboardRaceSummaryViewModel[];
otherUpcomingRaces: DashboardRaceSummaryViewModel[];
/**
* All upcoming races for the driver, already sorted by scheduledAt ascending.
*/
upcomingRaces: DashboardRaceSummaryViewModel[];
/**
* Count of distinct leagues that are currently "active" for the driver,
* based on upcoming races and league standings.
*/
activeLeaguesCount: number;
nextRace: DashboardRaceSummaryViewModel | null;
recentResults: DashboardRecentResultViewModel[];
leagueStandingsSummaries: DashboardLeagueStandingSummaryViewModel[];
feedSummary: DashboardFeedSummaryViewModel;
friends: DashboardFriendSummaryViewModel[];
}
export type DashboardOverviewResultDTO = DashboardOverviewViewModel;
export interface IDashboardOverviewPresenter
extends Presenter<DashboardOverviewResultDTO, DashboardOverviewViewModel> {}