From 897edd6c1e8a183b941af385bf8a80a082ba2927 Mon Sep 17 00:00:00 2001 From: James Embling Date: Tue, 10 Nov 2026 07:11:13 +0000 Subject: [PATCH 1/2] Polish the mobile UI to a 9/10 review on iPhone Two independent simulator reviews (Claude and Codex) iterated until both scored the phone UI at least 9/10. - Render combined date-times identically on server and Safari, removing the Dashboard and Profile hydration errors. - Give phone controls 44-px targets: buttons, inputs, tabs, dropdown items, drawer rows, dialog and sheet close buttons, text links and the replay scrubber. - Align values, icons and edges: tournament metrics, strategy row icons, "Prefer to Go", the import dialog, Match Summary and the dashboard totals. - Make create actions consistently primary and give Battle Logs a clear primary/secondary pair; tournament source actions form a 44-px grid. - Battle Replay on phones: all five Bench slots stay visible, controls stay pinned below the app bar and drawer, edges follow the page gutter, empty slots stay visible in dark mode, fallback card names fit their cards, the summary uses one row, and empty discard piles explain themselves. Co-Authored-By: Claude Opus 5.5 --- app/(app)/deck-lists/page.tsx | 5 +- app/(app)/decks/page.tsx | 4 +- app/(app)/tournaments/[id]/page.tsx | 3 +- app/(app)/tournaments/page.tsx | 2 +- components/battle-replay/BattleReplay.tsx | 17 +++- .../battle-replay/battle-replay.module.css | 82 ++++++++++++++++++- components/shadcn/button.tsx | 7 +- components/shadcn/dialog.tsx | 2 +- components/shadcn/dropdown-menu.tsx | 2 +- components/shadcn/input.tsx | 2 +- components/shadcn/sheet.tsx | 2 +- components/shadcn/sidebar.tsx | 2 +- components/ui/AdminPortalClient.tsx | 9 +- components/ui/AdminUsersTable.tsx | 9 +- components/ui/BattleLogSpritePicker.tsx | 2 +- components/ui/DeckStrategyCollection.tsx | 2 +- components/ui/ImportLogDialog.tsx | 2 +- components/ui/LogsManager.tsx | 8 +- components/ui/LogsWorkspaceFrame.tsx | 5 +- components/ui/MatchSummary.tsx | 5 +- components/ui/PageActions.tsx | 5 +- components/ui/ProfileForm.tsx | 3 +- components/ui/SegmentedControl.tsx | 4 +- components/ui/SharedLogPage.tsx | 12 ++- components/ui/Sidebar.tsx | 4 +- components/ui/TournamentSummaryList.tsx | 2 +- components/ui/account/profile.module.css | 5 ++ components/ui/dashboard/DashboardOverview.tsx | 8 +- components/ui/dashboard/UpcomingEvents.tsx | 3 +- components/ui/dashboard/dashboard.module.css | 16 ++++ .../ui/dashboard/upcoming-events.module.css | 2 + .../deck-strategy/matchup-header.module.css | 10 ++- .../ui/deck-strategy/strategy.module.css | 6 +- components/ui/social/PlayerProfile.tsx | 3 +- components/ui/stats/stats.module.css | 2 +- .../ui/tournament/collection.module.css | 2 +- lib/date-time.ts | 16 ++++ 37 files changed, 210 insertions(+), 65 deletions(-) diff --git a/app/(app)/deck-lists/page.tsx b/app/(app)/deck-lists/page.tsx index 7f853d62..96d8d600 100644 --- a/app/(app)/deck-lists/page.tsx +++ b/app/(app)/deck-lists/page.tsx @@ -23,11 +23,12 @@ export default async function DeckListsPage() {
+ } diff --git a/app/(app)/decks/page.tsx b/app/(app)/decks/page.tsx index 3af28da7..f9f33216 100644 --- a/app/(app)/decks/page.tsx +++ b/app/(app)/decks/page.tsx @@ -55,7 +55,7 @@ async function DecksContent({ - + } breadcrumb={[{ label: "Poke Notes", href: "/" }, { label: "Deck Strategy" }]} @@ -76,7 +76,7 @@ async function DecksContent({ {header} - +

No decks saved yet.

diff --git a/app/(app)/tournaments/[id]/page.tsx b/app/(app)/tournaments/[id]/page.tsx index 4ae22a13..64807236 100644 --- a/app/(app)/tournaments/[id]/page.tsx +++ b/app/(app)/tournaments/[id]/page.tsx @@ -273,7 +273,8 @@ export default async function TournamentDetailPage({ params }: TournamentDetailP
{isJudge ? null : resolvedTournamentDeckList ? ( -
+ // On phones the source actions form an even two-column grid of full-size buttons. +
} diff --git a/components/battle-replay/BattleReplay.tsx b/components/battle-replay/BattleReplay.tsx index 832d7082..e9ec377a 100644 --- a/components/battle-replay/BattleReplay.tsx +++ b/components/battle-replay/BattleReplay.tsx @@ -56,7 +56,13 @@ import { import styles from "./battle-replay.module.css"; function UnavailableArtwork({ name }: { name: string }) { - return {name}; + // Narrow cards size the name so its longest word fits on one line. + const longestWord = Math.max(1, ...name.split(/\s+/).map((word) => word.length)); + return ( + + {name} + + ); } const ATTACK_IMPACT_MS = 1194; @@ -1852,6 +1858,8 @@ export function BattleReplay({
+ {/* Phones keep the playback controls pinned above the boards while either board is inspected. */} +
{playbackControls}
@@ -1956,6 +1964,13 @@ export function BattleReplay({ {inspectedDiscardSide?.discardCount != null ? `${inspectedDiscardSide.discardCount} ${inspectedDiscardSide.discardCount === 1 ? "card" : "cards"} · ` : ""}Newest first + {inspectedDiscardSide && inspectedDiscardSide.discard.length === 0 ? ( +

+ {inspectedDiscardSide.discardCount + ? "The saved Battle Log doesn't name the discarded cards." + : "No cards in this discard pile yet."} +

+ ) : null}
    {(inspectedDiscard ? state[inspectedDiscard].discard diff --git a/components/battle-replay/battle-replay.module.css b/components/battle-replay/battle-replay.module.css index 1133f64f..34b36644 100644 --- a/components/battle-replay/battle-replay.module.css +++ b/components/battle-replay/battle-replay.module.css @@ -1,5 +1,5 @@ .replayContainer { --replay-board-card-width: 6.3rem; container-type: inline-size; container-name: replay; min-width: 0; } -.unavailableArtwork { display: flex; width: 100%; height: 100%; flex-direction: column; justify-content: center; gap: 0.25rem; padding: 0.3rem; background: var(--muted); color: var(--foreground); overflow-wrap: anywhere; text-align: center; font-size: 0.65rem; } +.unavailableArtwork { display: flex; width: 100%; height: 100%; flex-direction: column; justify-content: center; gap: 0.25rem; padding: 0.3rem; background: var(--muted); color: var(--foreground); overflow-wrap: break-word; hyphens: auto; text-align: center; font-size: 0.65rem; } .unavailableArtwork span { font-size: 0.55rem; } .healthStatus[data-tone="unknown"] { color: var(--muted-foreground); } @@ -43,8 +43,10 @@ } @container replay (max-width: 44rem) { + /* The matchup takes a row; result, prizes and turns share the next one. */ .matchMeta { - grid-template-columns: 1fr 1fr; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 0.9rem 1rem; } .matchMeta > div:first-child { @@ -2318,3 +2320,79 @@ button.pile:disabled { .stadium { width: 2rem; } .boardSupporter { transform: translateX(3.85rem); width: 2rem; } } + +/* Phones: every Bench slot stays visible, edges follow the page gutter, and controls stay in reach. */ +.mobileControlDock { display: none; } +@container replay (max-width: 40rem) { + .replayShell { overflow: clip; } + .replayStage { padding-inline: 1rem; } + .mobileControlDock { + position: sticky; + /* Sits directly below the sticky mobile app bar. */ + top: calc(3.75rem + 1px); + /* Above the boards, below the app bar (z-30) and the drawer and sheets (z-50). */ + z-index: 20; + display: block; + margin-inline: -1rem; + margin-bottom: 0.6rem; + padding: 0.4rem 1rem; + border-bottom: 1px solid var(--border); + background: color-mix(in oklab, var(--background) 92%, transparent); + backdrop-filter: blur(10px); + } + .mobileControlDock .controls { margin-inline: auto; justify-content: space-between; } + .playerHeader > .controls { display: none; } + .zonePiles { grid-area: piles; } + .bench, + .bench[data-capacity="8"] { + --replay-board-card-width: min(5.5rem, calc((100cqi - 4.6rem) / 5)); + grid-column: 1 / -1; + grid-template-columns: repeat(5, minmax(0, 1fr)); + justify-content: stretch; + overflow-x: visible; + gap: 0.4rem; + padding-inline: 0; + } + .bench[data-capacity="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); --replay-board-card-width: calc((100cqi - 5rem) / 6); } + .bench[data-capacity="7"] { grid-template-columns: repeat(7, minmax(0, 1fr)); --replay-board-card-width: calc((100cqi - 5.4rem) / 7); } + .bench[data-capacity="8"] { grid-template-columns: repeat(8, minmax(0, 1fr)); --replay-board-card-width: calc((100cqi - 5.8rem) / 8); } + .timelineHeader { padding-inline: 1rem; } + .timelineAction { padding-inline: 1.75rem 1rem; } + .timelineAction::before { left: 1rem; } +} + +.discardEmpty { margin: 0; padding: 1rem 1.25rem 1.5rem; color: var(--muted-foreground); font-size: 0.875rem; } + +/* Empty board positions keep a visible outline on dark boards. */ +:global(.dark) .benchSlot:not([data-populated]), +:global(.dark) .active:not([data-populated]) { + border-color: color-mix(in oklab, var(--replay-player-tint) 55%, var(--muted-foreground)); +} + +@container replay (max-width: 40rem) { + /* Narrow Bench slots keep a fallback card name whole. */ + .bench .unavailableArtwork { padding: 0.2rem; font-size: 0.55rem; } +} + +/* Fallback names size to the card width and break only between words. */ +.benchSlot .unavailableArtwork { + justify-content: center; + overflow: hidden; + padding: 0.1rem; + /* Bold sans needs up to about 0.72em per character, so the longest word stays inside the card. */ + font-size: clamp(0.42rem, calc((var(--replay-board-card-width) - 0.4rem) / (var(--fallback-word-chars, 10) * 0.72)), 0.8rem); + letter-spacing: -0.01em; + line-height: 1.15; + overflow-wrap: normal; + hyphens: manual; +} +.benchSlot .unavailableArtwork strong { font-weight: 700; } + +/* Enlarged previews show a fallback name at reading size. */ +.cardPreviewImage .unavailableArtwork { gap: 0.5rem; padding: 1rem; font-size: 1.35rem; } +.cardPreviewImage .unavailableArtwork span { font-size: 0.9rem; } + +@container replay (max-width: 40rem) { + /* The range input keeps a 44-px touch band around its track. */ + .scrubber input { height: 2.75rem; } +} diff --git a/components/shadcn/button.tsx b/components/shadcn/button.tsx index 90145b78..d4314ca8 100644 --- a/components/shadcn/button.tsx +++ b/components/shadcn/button.tsx @@ -20,18 +20,19 @@ const buttonVariants = cva( "border-[var(--color-loss-border)] bg-[var(--color-loss-bg)] text-loss-strong hover:bg-[var(--color-loss-border)] focus-visible:border-[var(--color-loss)] focus-visible:ring-[var(--color-loss-border)]", link: "text-primary underline-offset-4 hover:underline", }, + // Phones get 44-px touch targets; pointer layouts keep the compact sizes. size: { default: - "h-auto min-h-9 gap-1.5 px-4 py-2 text-[0.95rem] font-semibold", + "h-auto min-h-9 gap-1.5 px-4 py-2 text-[0.95rem] font-semibold max-sm:min-h-11", xs: "h-6 gap-1 rounded-[min(var(--radius),10px)] px-2 text-xs [&_svg:not([class*='size-'])]:size-3", sm: "h-7 gap-1 rounded-[min(var(--radius),12px)] px-2.5 text-[0.8rem] [&_svg:not([class*='size-'])]:size-3.5", lg: "h-9 gap-1.5 px-2.5", - icon: "size-8", + icon: "size-8 max-sm:size-11", "icon-xs": "size-6 rounded-[min(var(--radius),10px)] [&_svg:not([class*='size-'])]:size-3", "icon-sm": "size-7 rounded-[min(var(--radius),12px)]", - "icon-lg": "size-9", + "icon-lg": "size-9 max-sm:size-11", }, }, compoundVariants: [ diff --git a/components/shadcn/dialog.tsx b/components/shadcn/dialog.tsx index 8f3ddcb8..be873552 100644 --- a/components/shadcn/dialog.tsx +++ b/components/shadcn/dialog.tsx @@ -73,7 +73,7 @@ function DialogContent({
diff --git a/components/ui/ImportLogDialog.tsx b/components/ui/ImportLogDialog.tsx index 17080641..ba05c195 100644 --- a/components/ui/ImportLogDialog.tsx +++ b/components/ui/ImportLogDialog.tsx @@ -589,7 +589,7 @@ export function ImportLogDialog({ {renderHeader()}
{stage === "review" && review ? ( diff --git a/components/ui/LogsManager.tsx b/components/ui/LogsManager.tsx index 8d91ffcf..3ea0bb3b 100644 --- a/components/ui/LogsManager.tsx +++ b/components/ui/LogsManager.tsx @@ -10,7 +10,6 @@ import { loadMoreLogsAction } from "@/app/(app)/logs/actions"; import { Alert, AlertDescription, AlertTitle } from "@/components/shadcn/alert"; -import { Badge } from "@/components/shadcn/badge"; import { Button } from "@/components/shadcn/button"; import { ClientPerfPanel } from "@/components/ui/ClientPerfPanel"; import { ChevronIcon, PencilIcon } from "@/components/ui/icons"; @@ -660,12 +659,7 @@ export function LogsManager({ ) : null} -
-
-
- {!canLoadMore ? Current window complete : null} -
-
+
) : ( + - )} diff --git a/components/ui/MatchSummary.tsx b/components/ui/MatchSummary.tsx index 926d2109..3abc20bc 100644 --- a/components/ui/MatchSummary.tsx +++ b/components/ui/MatchSummary.tsx @@ -297,11 +297,10 @@ export function MatchSummary({ return (
-
+
- Match{" "} - Summary + Match Summary

{resultStyles.label} diff --git a/components/ui/PageActions.tsx b/components/ui/PageActions.tsx index c617ee99..32584bb4 100644 --- a/components/ui/PageActions.tsx +++ b/components/ui/PageActions.tsx @@ -17,7 +17,10 @@ export function PageActions({ *]:!rounded-lg max-sm:[&>*]:!border-l sm:w-fit sm:flex-row sm:gap-0" + : "w-fit", className )} > diff --git a/components/ui/ProfileForm.tsx b/components/ui/ProfileForm.tsx index 5d81656f..a023e5a4 100644 --- a/components/ui/ProfileForm.tsx +++ b/components/ui/ProfileForm.tsx @@ -11,9 +11,10 @@ import { PageTitle, SectionTitle } from "@/components/ui/Typography"; import { ProfileAvatarChooser } from "./account/ProfileAvatarChooser"; import styles from "./account/profile.module.css"; import type { UserProfile } from "@/types/index"; +import { createStableDateTimeFormatter } from "@/lib/date-time"; const initialProfileActionState: ProfileActionState = { error: null, success: null }; -const DATE_TIME_FORMATTER = new Intl.DateTimeFormat("en-GB", { dateStyle: "medium", timeStyle: "short", timeZone: "Europe/London" }); +const DATE_TIME_FORMATTER = createStableDateTimeFormatter({ dateStyle: "medium", timeZone: "Europe/London" }, { timeStyle: "short", timeZone: "Europe/London" }); function formatDateTime(value: string | undefined) { if (!value) return "Not available yet"; diff --git a/components/ui/SegmentedControl.tsx b/components/ui/SegmentedControl.tsx index efb556e0..78d5d306 100644 --- a/components/ui/SegmentedControl.tsx +++ b/components/ui/SegmentedControl.tsx @@ -43,7 +43,7 @@ export function SegmentedControl({ variant={appearance === "line" ? "line" : "default"} className={cn( appearance === "line" - ? "gap-6 rounded-none border-0 bg-transparent p-0 text-muted-foreground shadow-none" + ? "gap-6 rounded-none border-0 bg-transparent p-0 text-muted-foreground shadow-none max-sm:h-11" : "rounded-[var(--control-radius)] border border-[var(--control-border)] bg-[var(--control-bg)] p-1 text-[var(--control-text)] shadow-[var(--control-shadow)]", listSizeClasses[size], className @@ -54,7 +54,7 @@ export function SegmentedControl({ className={cn( "h-full font-semibold", appearance === "line" - ? "min-w-0 flex-none rounded-none border-x-0 border-t-0 border-b-2 px-0 text-sm data-[state=active]:border-b-card-foreground data-[state=active]:bg-transparent data-[state=active]:text-card-foreground dark:data-[state=active]:border-x-0 dark:data-[state=active]:border-t-0 dark:data-[state=active]:border-b-card-foreground dark:data-[state=active]:bg-transparent" + ? "min-w-0 flex-none max-sm:min-h-11 max-sm:min-w-11 rounded-none border-x-0 border-t-0 border-b-2 px-0 text-sm data-[state=active]:border-b-card-foreground data-[state=active]:bg-transparent data-[state=active]:text-card-foreground dark:data-[state=active]:border-x-0 dark:data-[state=active]:border-t-0 dark:data-[state=active]:border-b-card-foreground dark:data-[state=active]:bg-transparent" : cn("rounded-[calc(var(--control-radius)_-_2px)] data-[state=active]:bg-[var(--control-active-bg)] data-[state=active]:text-[var(--control-active-text)]", triggerSizeClasses[size]) )} key={value} diff --git a/components/ui/SharedLogPage.tsx b/components/ui/SharedLogPage.tsx index 7ed0bedc..2fe39697 100644 --- a/components/ui/SharedLogPage.tsx +++ b/components/ui/SharedLogPage.tsx @@ -13,14 +13,12 @@ import { projectPublicBattleLogDetail } from "@/lib/battle-log/detail-projection import { getSharedLogSnapshot } from "@/lib/db/log-shares"; import { requireSharedLogSnapshot } from "@/lib/shared-log-routing"; import type { PublicBattleLog } from "@/lib/db/log-shares"; +import { createStableDateTimeFormatter } from "@/lib/date-time"; -const SHARED_LOG_DATE_TIME_FORMATTER = new Intl.DateTimeFormat("en-GB", { - day: "numeric", - month: "short", - year: "numeric", - hour: "2-digit", - minute: "2-digit" -}); +const SHARED_LOG_DATE_TIME_FORMATTER = createStableDateTimeFormatter( + { day: "numeric", month: "short", year: "numeric" }, + { hour: "2-digit", minute: "2-digit" } +); const SHARED_LOG_DATE_FORMATTER = new Intl.DateTimeFormat("en-GB", { day: "numeric", diff --git a/components/ui/Sidebar.tsx b/components/ui/Sidebar.tsx index 28d3470d..c271b6b3 100644 --- a/components/ui/Sidebar.tsx +++ b/components/ui/Sidebar.tsx @@ -147,7 +147,7 @@ export function SidebarMobileTopbar() { const { setOpenMobile } = useSidebar(); return ( -

+