From 2b462a6bd99ca534106186b3aedc62e82bf12b72 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 23 Apr 2026 14:30:16 -0500 Subject: [PATCH] Append day labels to game titles --- PLAN.md | 1 + frontend/src/lib/teamsnapHelpers.ts | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/PLAN.md b/PLAN.md index be548b9..8ee0ecd 100644 --- a/PLAN.md +++ b/PLAN.md @@ -17,6 +17,7 @@ ## Completed UI Cleanup - 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. +- Game titles in the UI now include a day parenthetical such as `(sun 5/3)` wherever the shared formatter is used. ## Storage Status - Backend media persists in the `backend-media` named Docker volume. diff --git a/frontend/src/lib/teamsnapHelpers.ts b/frontend/src/lib/teamsnapHelpers.ts index 1cedc79..16427c5 100644 --- a/frontend/src/lib/teamsnapHelpers.ts +++ b/frontend/src/lib/teamsnapHelpers.ts @@ -75,14 +75,15 @@ export function findCurrentPlayer(externalUserId: string | number | null | undef export function formatGameTitle(game: TeamSnapEvent): string { const name = asDisplayText(game.name); + const dayLabel = formatGameDayLabel(game); if (name) { - return name; + return `${name}${dayLabel}`; } const opponentName = asDisplayText(game.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 { @@ -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[] { return [...events] .filter((event) => event.isGame)