website refactor
This commit is contained in:
70
apps/website/templates/view-data/DashboardViewData.ts
Normal file
70
apps/website/templates/view-data/DashboardViewData.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Dashboard ViewData
|
||||
*
|
||||
* SSR-safe data structure that can be built directly from DTO
|
||||
* without ViewModel instantiation. Contains formatted values
|
||||
* for display and ISO string timestamps for JSON serialization.
|
||||
*/
|
||||
|
||||
export interface DashboardViewData {
|
||||
currentDriver: {
|
||||
name: string;
|
||||
avatarUrl: string;
|
||||
country: string;
|
||||
rating: string;
|
||||
rank: string;
|
||||
totalRaces: string;
|
||||
wins: string;
|
||||
podiums: string;
|
||||
consistency: string;
|
||||
};
|
||||
nextRace: {
|
||||
id: string;
|
||||
track: string;
|
||||
car: string;
|
||||
scheduledAt: string; // ISO string
|
||||
formattedDate: string;
|
||||
formattedTime: string;
|
||||
timeUntil: string;
|
||||
isMyLeague: boolean;
|
||||
} | null;
|
||||
upcomingRaces: Array<{
|
||||
id: string;
|
||||
track: string;
|
||||
car: string;
|
||||
scheduledAt: string; // ISO string
|
||||
formattedDate: string;
|
||||
formattedTime: string;
|
||||
timeUntil: string;
|
||||
isMyLeague: boolean;
|
||||
}>;
|
||||
leagueStandings: Array<{
|
||||
leagueId: string;
|
||||
leagueName: string;
|
||||
position: string;
|
||||
points: string;
|
||||
totalDrivers: string;
|
||||
}>;
|
||||
feedItems: Array<{
|
||||
id: string;
|
||||
type: string;
|
||||
headline: string;
|
||||
body?: string;
|
||||
timestamp: string; // ISO string
|
||||
formattedTime: string;
|
||||
ctaHref?: string;
|
||||
ctaLabel?: string;
|
||||
}>;
|
||||
friends: Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
avatarUrl: string;
|
||||
country: string;
|
||||
}>;
|
||||
activeLeaguesCount: string;
|
||||
friendCount: string;
|
||||
hasUpcomingRaces: boolean;
|
||||
hasLeagueStandings: boolean;
|
||||
hasFeedItems: boolean;
|
||||
hasFriends: boolean;
|
||||
}
|
||||
16
apps/website/templates/view-data/ProfileLeaguesViewData.ts
Normal file
16
apps/website/templates/view-data/ProfileLeaguesViewData.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* ViewData for Profile Leagues page
|
||||
* Pure, JSON-serializable data structure for Template rendering
|
||||
*/
|
||||
|
||||
export interface ProfileLeaguesLeagueViewData {
|
||||
leagueId: string;
|
||||
name: string;
|
||||
description: string;
|
||||
membershipRole: 'owner' | 'admin' | 'steward' | 'member';
|
||||
}
|
||||
|
||||
export interface ProfileLeaguesViewData {
|
||||
ownedLeagues: ProfileLeaguesLeagueViewData[];
|
||||
memberLeagues: ProfileLeaguesLeagueViewData[];
|
||||
}
|
||||
40
apps/website/templates/view-data/TeamDetailViewData.ts
Normal file
40
apps/website/templates/view-data/TeamDetailViewData.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* TeamDetailViewData - Pure ViewData for TeamDetailTemplate
|
||||
* Contains only raw serializable data, no methods or computed properties
|
||||
*/
|
||||
|
||||
export interface TeamDetailData {
|
||||
id: string;
|
||||
name: string;
|
||||
tag: string;
|
||||
description?: string;
|
||||
ownerId: string;
|
||||
leagues: string[];
|
||||
createdAt?: string;
|
||||
specialization?: string;
|
||||
region?: string;
|
||||
languages?: string[];
|
||||
category?: string;
|
||||
membership?: {
|
||||
role: string;
|
||||
joinedAt: string;
|
||||
isActive: boolean;
|
||||
} | null;
|
||||
canManage: boolean;
|
||||
}
|
||||
|
||||
export interface TeamMemberData {
|
||||
driverId: string;
|
||||
driverName: string;
|
||||
role: 'owner' | 'manager' | 'member';
|
||||
joinedAt: string;
|
||||
isActive: boolean;
|
||||
avatarUrl: string;
|
||||
}
|
||||
|
||||
export interface TeamDetailViewData {
|
||||
team: TeamDetailData;
|
||||
memberships: TeamMemberData[];
|
||||
currentDriverId: string;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
16
apps/website/templates/view-data/TeamsViewData.ts
Normal file
16
apps/website/templates/view-data/TeamsViewData.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* TeamsViewData - Pure ViewData for TeamsTemplate
|
||||
* Contains only raw serializable data, no methods or computed properties
|
||||
*/
|
||||
|
||||
export interface TeamSummaryData {
|
||||
teamId: string;
|
||||
teamName: string;
|
||||
leagueName: string;
|
||||
memberCount: number;
|
||||
logoUrl?: string;
|
||||
}
|
||||
|
||||
export interface TeamsViewData {
|
||||
teams: TeamSummaryData[];
|
||||
}
|
||||
Reference in New Issue
Block a user