Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/(app)/deck-lists/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ export default async function DeckListsPage() {
<div className={styles.page}>
<PageHeader
action={
<PageActions>
<PageActions className="w-full sm:w-fit">
<LazyDeckListEditorButton
defaultCreatedBy={defaultCreatedBy}
triggerClassName="w-full justify-center sm:w-auto"
triggerLabel="+ New Deck List"
triggerVariant="outline"
triggerVariant="default"
/>
</PageActions>
}
Expand Down
4 changes: 2 additions & 2 deletions app/(app)/decks/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function DecksContent({
<PageHeader
action={
<PageActions className="hidden sm:flex">
<LazyDeckEditorButton triggerLabel="+ New deck" />
<LazyDeckEditorButton triggerLabel="+ New Deck" />
</PageActions>
}
breadcrumb={[{ label: "Poke Notes", href: "/" }, { label: "Deck Strategy" }]}
Expand All @@ -76,7 +76,7 @@ async function DecksContent({
<RouteTimingMarker durationMs={decksTiming.durationMs} phase="route-data" />
{header}
<PageActions className="sm:hidden" mobile="stack">
<LazyDeckEditorButton triggerLabel="+ New deck" />
<LazyDeckEditorButton triggerLabel="+ New Deck" />
</PageActions>
<div className={styles.empty}>
<p>No decks saved yet.</p>
Expand Down
3 changes: 2 additions & 1 deletion app/(app)/tournaments/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ export default async function TournamentDetailPage({ params }: TournamentDetailP
</div>
<div className="flex w-full sm:w-auto sm:shrink-0">
{isJudge ? null : resolvedTournamentDeckList ? (
<div className="flex flex-wrap items-center gap-1">
// On phones the source actions form an even two-column grid of full-size buttons.
<div className="flex flex-wrap items-center gap-1 max-sm:grid max-sm:w-full max-sm:grid-cols-2 max-sm:gap-2 max-sm:[&>*]:w-full max-sm:[&_button]:min-h-11 max-sm:[&_button]:w-full max-sm:[&_button]:border max-sm:[&_button]:border-border">
<DeckListViewDialog
deckListName={resolvedTournamentDeckList?.name ?? "Tournament Deck List"}
rawList={resolvedTournamentDeckList?.rawList}
Expand Down
2 changes: 1 addition & 1 deletion app/(app)/tournaments/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default async function TournamentsPage() {
<LazyTournamentEditorButton
className="w-full justify-center sm:w-auto"
triggerLabel="+ New Tournament"
triggerVariant="outline"
triggerVariant="default"
/>
</PageActions>
}
Expand Down
19 changes: 18 additions & 1 deletion components/battle-replay/BattleReplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ import {
import styles from "./battle-replay.module.css";

function UnavailableArtwork({ name }: { name: string }) {
return <span className={styles.unavailableArtwork}><strong>{name}</strong></span>;
// 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 (
<span className={styles.unavailableArtwork} style={{ "--fallback-word-chars": longestWord } as React.CSSProperties}>
<strong>{name}</strong>
</span>
);
}

const ATTACK_IMPACT_MS = 1194;
Expand Down Expand Up @@ -1852,6 +1858,8 @@ export function BattleReplay({
</div>

<div className={styles.replayStage} ref={stageRef}>
{/* Phones keep the playback controls pinned above the boards while either board is inspected. */}
<div className={styles.mobileControlDock}>{playbackControls}</div>
<div className={styles.boardFrame} data-replay-board-frame data-transaction={popupTransaction && !inlineTransaction || undefined}>
<div className={styles.board} ref={boardRef}>
<PlayerBoard openingRevealed={openingRevealed} instantReveal={!atOpeningReveal || !animateOpeningReveal} controls={playbackControls} coinPhase={coinPhase} actor="opponent" abilities={abilityActivations} attackDamagePending={pendingAttackIndex === actionIndex} playedSupporter={trainerAction?.actor === "opponent" && trainerAction.type === "Supporter" && completedTrainerIndex !== actionIndex ? trainerAction.card : undefined} playedItem={trainerAction?.actor === "opponent" && trainerAction.type === "Item" && completedTrainerIndex !== actionIndex ? trainerAction.card : undefined} currentEvent={currentEvent} onInspectDiscard={inspectDiscard} onPreview={previewCard} previousSide={previousState.opponent} side={boardState.opponent} stadium={state.stadium} />
Expand Down Expand Up @@ -1956,6 +1964,15 @@ export function BattleReplay({
{inspectedDiscardSide?.discardCount != null ? `${inspectedDiscardSide.discardCount} ${inspectedDiscardSide.discardCount === 1 ? "card" : "cards"} · ` : ""}Newest first
</SheetDescription>
</SheetHeader>
{inspectedDiscardSide && inspectedDiscardSide.discard.length === 0 ? (
<p className={styles.discardEmpty}>
{inspectedDiscardSide.discardCount === 0
? "No cards in this discard pile yet."
: inspectedDiscardSide.discardCount == null
? "The saved Battle Log doesn't show how many cards are in this discard pile."
: "The saved Battle Log doesn't name the discarded cards."}
</p>
) : null}
<ol className={styles.discardList}>
{(inspectedDiscard
? state[inspectedDiscard].discard
Expand Down
82 changes: 80 additions & 2 deletions components/battle-replay/battle-replay.module.css
Original file line number Diff line number Diff line change
@@ -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); }

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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; }
}
7 changes: 4 additions & 3 deletions components/shadcn/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion components/shadcn/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function DialogContent({
<DialogPrimitive.Close data-slot="dialog-close" asChild>
<Button
variant="ghost"
className="absolute top-2 right-2"
className="absolute top-2 right-2 max-sm:top-1 max-sm:right-1 max-sm:size-11"
size="icon-sm"
>
<XIcon
Expand Down
2 changes: 1 addition & 1 deletion components/shadcn/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function DropdownMenuItem({
data-inset={inset}
data-variant={variant}
className={cn(
"group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-loss-strong data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-loss-strong dark:data-[variant=destructive]:focus:bg-destructive/20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-loss-strong",
"group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-none max-sm:min-h-11 select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-loss-strong data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-loss-strong dark:data-[variant=destructive]:focus:bg-destructive/20 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-loss-strong",
className
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion components/shadcn/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
type={type}
data-slot="input"
className={cn(
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
"h-8 max-sm:h-11 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
className
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion components/shadcn/sheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function SheetContent({
{showCloseButton ? (
<SheetPrimitive.Close asChild data-slot="sheet-close">
<Button
className="absolute right-3 top-3"
className="absolute right-3 top-3 max-sm:right-2 max-sm:top-2 max-sm:size-11"
size="icon-sm"
variant="ghost"
>
Expand Down
2 changes: 1 addition & 1 deletion components/shadcn/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ const sidebarMenuButtonVariants = cva(
"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]",
},
size: {
default: "h-8 text-sm",
default: "h-8 text-sm max-sm:h-11",
sm: "h-7 text-xs",
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0",
},
Expand Down
9 changes: 5 additions & 4 deletions components/ui/AdminPortalClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import { SidebarAccount, SidebarAccountFallback } from "@/components/ui/Sidebar"
import { SectionTitle } from "@/components/ui/Typography";
import type { AdminUser, AvatarColor, CatalogHealth } from "@/types/index";
import styles from "./admin/admin.module.css";
import { createStableDateTimeFormatter } from "@/lib/date-time";

const DATE_TIME_FORMATTER = new Intl.DateTimeFormat("en-GB", {
dateStyle: "medium",
timeStyle: "short"
});
const DATE_TIME_FORMATTER = createStableDateTimeFormatter(
{ dateStyle: "medium" },
{ timeStyle: "short" }
);
const COUNT_FORMATTER = new Intl.NumberFormat("en-GB");

type AdminDashboardBootstrap = {
Expand Down
9 changes: 5 additions & 4 deletions components/ui/AdminUsersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { AdminRoleControls } from "@/components/ui/AdminRoleControls";
import { ItemTitle } from "@/components/ui/Typography";
import type { AdminUser } from "@/types/index";
import styles from "./admin/admin.module.css";
import { createStableDateTimeFormatter } from "@/lib/date-time";

const DATE_TIME_FORMATTER = new Intl.DateTimeFormat("en-GB", {
dateStyle: "medium",
timeStyle: "short"
});
const DATE_TIME_FORMATTER = createStableDateTimeFormatter(
{ dateStyle: "medium" },
{ timeStyle: "short" }
);
const COUNT_FORMATTER = new Intl.NumberFormat("en-GB");

type AdminUsersTableProps = {
Expand Down
2 changes: 1 addition & 1 deletion components/ui/BattleLogSpritePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export function BattleLogSpritePicker({
</p>
</div>
<Button
className="gap-1 text-[0.9rem] font-medium text-foreground md:gap-2 md:text-sm"
className="gap-1 text-[0.9rem] font-medium text-foreground max-sm:min-h-11 md:gap-2 md:text-sm"
onClick={() => onChange(swapSpritePositions(sprites))}
size="sm"
type="button"
Expand Down
2 changes: 1 addition & 1 deletion components/ui/DeckStrategyCollection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export function DeckStrategyCollection({ decks }: DeckStrategyCollectionProps) {
className="w-fit shrink-0 sm:hidden"
mobile="stack"
>
<LazyDeckEditorButton triggerLabel="+ New deck" />
<LazyDeckEditorButton triggerLabel="+ New Deck" />
</PageActions>
</div>

Expand Down
2 changes: 1 addition & 1 deletion components/ui/ImportLogDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ export function ImportLogDialog({
{renderHeader()}

<div
className="min-h-0 min-w-0 flex-1 touch-pan-y overflow-y-auto overflow-x-hidden overscroll-contain p-4 pr-5 [-webkit-overflow-scrolling:touch] [scrollbar-gutter:stable] sm:px-6 sm:py-5 sm:pr-7 lg:px-8 lg:py-6 lg:pr-9"
className="min-h-0 min-w-0 flex-1 touch-pan-y overflow-y-auto overflow-x-hidden overscroll-contain px-3 py-4 pr-4 [-webkit-overflow-scrolling:touch] [scrollbar-gutter:stable] sm:px-6 sm:py-5 sm:pr-7 lg:px-8 lg:py-6 lg:pr-9"
ref={contentRef}
>
{stage === "review" && review ? (
Expand Down
8 changes: 1 addition & 7 deletions components/ui/LogsManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -660,12 +659,7 @@ export function LogsManager({
</Alert>
) : null}

<div className="flex flex-col gap-6 p-4 sm:p-5">
<div className="flex flex-col gap-3 sm:hidden">
<div className="flex flex-wrap items-center gap-2">
{!canLoadMore ? <Badge>Current window complete</Badge> : null}
</div>
</div>
<div className="flex flex-col gap-6 py-4 sm:p-5">

<ClientPerfPanel
expandedGroupCount={openGroupDates.length}
Expand Down
5 changes: 3 additions & 2 deletions components/ui/LogsWorkspaceFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,19 @@ export function LogsWorkspaceFrame({
// Reserves the mobile actions' height so the list does not jump when they appear.
<div aria-hidden="true" className="flex flex-col gap-2 sm:hidden">
<Skeleton className="h-11 rounded-lg" />
<Skeleton className="h-[2.645rem] rounded-lg" />
<Skeleton className="h-11 rounded-lg" />
</div>
) : (
<PageActions className="sm:hidden" mobile="stack">
<LazyImportLogButton className="min-h-11 w-full justify-center" />
<Button
aria-pressed={isManagementMode}
className="min-h-11 w-full justify-center"
onClick={toggleManagementMode}
variant="outline"
>
{isManagementMode ? "Done" : "Edit logs"}
</Button>
<LazyImportLogButton className="w-full justify-center" />
</PageActions>
)}

Expand Down
Loading
Loading