view data fixes
This commit is contained in:
@@ -19,9 +19,10 @@ export class AvatarDisplay {
|
||||
|
||||
/**
|
||||
* Determines if avatar data is valid for display.
|
||||
* Accepts base64-encoded string buffer.
|
||||
*/
|
||||
static hasValidData(buffer: ArrayBuffer, contentType: string): boolean {
|
||||
return buffer.byteLength > 0 && contentType.length > 0;
|
||||
static hasValidData(buffer: string, contentType: string): boolean {
|
||||
return buffer.length > 0 && contentType.length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* LeagueCreationStatusDisplay
|
||||
*
|
||||
* Deterministic mapping of league creation status to display messages.
|
||||
*/
|
||||
|
||||
export class LeagueCreationStatusDisplay {
|
||||
/**
|
||||
* Maps league creation success status to display message.
|
||||
*/
|
||||
static statusMessage(success: boolean): string {
|
||||
return success ? 'League created successfully!' : 'Failed to create league.';
|
||||
}
|
||||
}
|
||||
15
apps/website/lib/display-objects/RatingTrendDisplay.ts
Normal file
15
apps/website/lib/display-objects/RatingTrendDisplay.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export class RatingTrendDisplay {
|
||||
static getTrend(currentRating: number, previousRating: number | undefined): 'up' | 'down' | 'same' {
|
||||
if (!previousRating) return 'same';
|
||||
if (currentRating > previousRating) return 'up';
|
||||
if (currentRating < previousRating) return 'down';
|
||||
return 'same';
|
||||
}
|
||||
|
||||
static getChangeIndicator(currentRating: number, previousRating: number | undefined): string {
|
||||
const change = previousRating ? currentRating - previousRating : 0;
|
||||
if (change > 0) return `+${change}`;
|
||||
if (change < 0) return `${change}`;
|
||||
return '0';
|
||||
}
|
||||
}
|
||||
11
apps/website/lib/display-objects/SkillLevelIconDisplay.ts
Normal file
11
apps/website/lib/display-objects/SkillLevelIconDisplay.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export class SkillLevelIconDisplay {
|
||||
static getIcon(skillLevel: string): string {
|
||||
const icons: Record<string, string> = {
|
||||
beginner: '🥉',
|
||||
intermediate: '🥈',
|
||||
advanced: '🥇',
|
||||
expert: '👑',
|
||||
};
|
||||
return icons[skillLevel] || '🏁';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* TeamCreationStatusDisplay
|
||||
*
|
||||
* Deterministic mapping of team creation status to display messages.
|
||||
*/
|
||||
|
||||
export class TeamCreationStatusDisplay {
|
||||
/**
|
||||
* Maps team creation success status to display message.
|
||||
*/
|
||||
static statusMessage(success: boolean): string {
|
||||
return success ? 'Team created successfully!' : 'Failed to create team.';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user