68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
// Note: No generated DTO available for TeamSummary yet
|
|
interface TeamSummaryDTO {
|
|
id: string;
|
|
name: string;
|
|
logoUrl?: string;
|
|
memberCount: number;
|
|
rating: number;
|
|
}
|
|
|
|
export class TeamSummaryViewModel {
|
|
id: string;
|
|
name: string;
|
|
logoUrl?: string;
|
|
memberCount: number;
|
|
rating: number;
|
|
description?: string;
|
|
totalWins: number = 0;
|
|
totalRaces: number = 0;
|
|
performanceLevel: string = '';
|
|
isRecruiting: boolean = false;
|
|
specialization?: string;
|
|
region?: string;
|
|
languages: string[] = [];
|
|
|
|
private maxMembers = 10; // Assuming max members
|
|
|
|
constructor(dto: TeamSummaryDTO & { description?: string; totalWins?: number; totalRaces?: number; performanceLevel?: string; isRecruiting?: boolean; specialization?: string; region?: string; languages?: string[] }) {
|
|
this.id = dto.id;
|
|
this.name = dto.name;
|
|
if (dto.logoUrl !== undefined) this.logoUrl = dto.logoUrl;
|
|
this.memberCount = dto.memberCount;
|
|
this.rating = dto.rating;
|
|
this.description = dto.description;
|
|
this.totalWins = dto.totalWins ?? 0;
|
|
this.totalRaces = dto.totalRaces ?? 0;
|
|
this.performanceLevel = dto.performanceLevel ?? '';
|
|
this.isRecruiting = dto.isRecruiting ?? false;
|
|
this.specialization = dto.specialization;
|
|
this.region = dto.region;
|
|
this.languages = dto.languages ?? [];
|
|
}
|
|
|
|
/** UI-specific: Whether team is full */
|
|
get isFull(): boolean {
|
|
return this.memberCount >= this.maxMembers;
|
|
}
|
|
|
|
/** UI-specific: Rating display */
|
|
get ratingDisplay(): string {
|
|
return this.rating.toFixed(0);
|
|
}
|
|
|
|
/** UI-specific: Member count display */
|
|
get memberCountDisplay(): string {
|
|
return `${this.memberCount}/${this.maxMembers}`;
|
|
}
|
|
|
|
/** UI-specific: Status indicator */
|
|
get statusIndicator(): string {
|
|
if (this.isFull) return 'Full';
|
|
return 'Open';
|
|
}
|
|
|
|
/** UI-specific: Status color */
|
|
get statusColor(): string {
|
|
return this.isFull ? 'red' : 'green';
|
|
}
|
|
} |