56 lines
2.0 KiB
TypeScript
56 lines
2.0 KiB
TypeScript
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import type { TeamSummaryViewData } from "../view-data/TeamSummaryViewData";
|
|
|
|
export class TeamSummaryViewModel extends ViewModel {
|
|
private readonly data: TeamSummaryViewData;
|
|
private readonly maxMembers = 10; // Assuming max members
|
|
|
|
constructor(data: TeamSummaryViewData) {
|
|
super();
|
|
this.data = data;
|
|
}
|
|
|
|
get id(): string { return this.data.id; }
|
|
get name(): string { return this.data.name; }
|
|
get tag(): string { return this.data.tag; }
|
|
get memberCount(): number { return this.data.memberCount; }
|
|
get description(): string | undefined { return this.data.description; }
|
|
get totalWins(): number { return this.data.totalWins || 0; }
|
|
get totalRaces(): number { return this.data.totalRaces || 0; }
|
|
get performanceLevel(): string { return this.data.performanceLevel || 'beginner'; }
|
|
get isRecruiting(): boolean { return this.data.isRecruiting; }
|
|
get specialization(): string | undefined { return this.data.specialization; }
|
|
get region(): string | undefined { return this.data.region; }
|
|
get languages(): string[] { return this.data.languages || []; }
|
|
get leagues(): string[] { return this.data.leagues || []; }
|
|
get logoUrl(): string | undefined { return this.data.logoUrl; }
|
|
get rating(): number | undefined { return this.data.rating; }
|
|
get category(): string | undefined { return this.data.category; }
|
|
|
|
/** UI-specific: Whether team is full */
|
|
get isFull(): boolean {
|
|
return this.memberCount >= this.maxMembers;
|
|
}
|
|
|
|
/** UI-specific: Tag display */
|
|
get tagDisplay(): string {
|
|
return `[${this.tag}]`;
|
|
}
|
|
|
|
/** 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';
|
|
}
|
|
}
|