Append day labels to game titles

This commit is contained in:
Codex
2026-04-23 14:30:16 -05:00
parent 2011716654
commit 2b462a6bd9
2 changed files with 19 additions and 3 deletions

View File

@@ -17,6 +17,7 @@
## Completed UI Cleanup ## Completed UI Cleanup
- Home page now acts as a lightweight landing page with direct links to Library and Gameday. - Home page now acts as a lightweight landing page with direct links to Library and Gameday.
- Removed the old game-list-heavy dashboard content that was not useful as a landing surface. - Removed the old game-list-heavy dashboard content that was not useful as a landing surface.
- Game titles in the UI now include a day parenthetical such as `(sun 5/3)` wherever the shared formatter is used.
## Storage Status ## Storage Status
- Backend media persists in the `backend-media` named Docker volume. - Backend media persists in the `backend-media` named Docker volume.

View File

@@ -75,14 +75,15 @@ export function findCurrentPlayer(externalUserId: string | number | null | undef
export function formatGameTitle(game: TeamSnapEvent): string { export function formatGameTitle(game: TeamSnapEvent): string {
const name = asDisplayText(game.name); const name = asDisplayText(game.name);
const dayLabel = formatGameDayLabel(game);
if (name) { if (name) {
return name; return `${name}${dayLabel}`;
} }
const opponentName = asDisplayText(game.opponentName); const opponentName = asDisplayText(game.opponentName);
if (opponentName) { if (opponentName) {
return `vs ${opponentName}`; return `vs ${opponentName}${dayLabel}`;
} }
return `Game ${game.id}`; return `Game ${game.id}${dayLabel}`;
} }
export function formatGameDate(game: TeamSnapEvent): string { export function formatGameDate(game: TeamSnapEvent): string {
@@ -98,6 +99,20 @@ export function formatGameDate(game: TeamSnapEvent): string {
}); });
} }
function formatGameDayLabel(game: TeamSnapEvent): string {
const date = toDate(game.startDate);
if (!date) {
return "";
}
const weekday = date
.toLocaleDateString("en-US", { weekday: "short" })
.replace(/\./g, "")
.replace(/^./, (character) => character.toUpperCase());
const monthDay = date.toLocaleDateString("en-US", { month: "numeric", day: "numeric" });
return ` (${weekday} ${monthDay})`;
}
export function sortGames(events: TeamSnapEvent[]): TeamSnapEvent[] { export function sortGames(events: TeamSnapEvent[]): TeamSnapEvent[] {
return [...events] return [...events]
.filter((event) => event.isGame) .filter((event) => event.isGame)