From 4254c1bde12dad94a9ed3d91542f516885cc71e3 Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Wed, 11 Nov 2026 18:47:50 +0000 Subject: [PATCH] refactor(web): grid, add flow and detail pages as utilities The hero's backdrop scrim and the title placeholder stay in CSS: they are pseudo-element effects, not layout. Refs #280 Co-Authored-By: Claude Opus 5.5 (1M context) --- web/src/components.css | 426 ------------------------------------- web/src/detail.tsx | 49 +++-- web/src/look.ts | 43 ++++ web/src/rows.tsx | 17 +- web/src/style.css | 4 + web/src/ui.tsx | 6 +- web/src/views/Library.tsx | 8 +- web/src/views/Movie.tsx | 18 +- web/src/views/Search.tsx | 28 ++- web/src/views/Series.tsx | 14 +- web/src/views/Settings.tsx | 14 +- web/src/views/TvDeck.tsx | 10 +- 12 files changed, 139 insertions(+), 498 deletions(-) diff --git a/web/src/components.css b/web/src/components.css index 9321d17..8f7e6cf 100644 --- a/web/src/components.css +++ b/web/src/components.css @@ -313,180 +313,6 @@ body { letter-spacing: 0.06em; } -/* ---- poster grid (§9.6, issue 151) -------------------------------------- */ - -.grid-rows { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); - gap: var(--space-3); - padding-top: var(--space-3); -} - -.card { - display: flex; - flex-direction: column; - width: 100%; - height: 100%; - padding: 0; - font: inherit; - text-align: left; - color: inherit; - background: var(--panel); - border: 1px solid var(--line); - border-radius: var(--radius); - overflow: hidden; - cursor: pointer; - transition: border-color 150ms var(--ease-out); -} - -.card:hover { - border-color: var(--accent); -} - -.card-art { - display: block; - aspect-ratio: 2 / 3; - background: var(--panel-raised); -} - -.card-poster { - display: block; - width: 100%; - height: 100%; - object-fit: cover; -} - -/* same ratio as a poster, carrying the title: the grid never has a hole */ -.card-blank { - display: flex; - align-items: center; - justify-content: center; - width: 100%; - height: 100%; - padding: var(--space-3); -} - -.card-blank-title { - font-family: var(--font-display); - font-size: var(--text-base); - font-weight: 600; - text-align: center; - color: var(--ink-faint); -} - -.card-body { - display: grid; - gap: var(--space-1); - padding: var(--space-2); -} - -.card-name { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - font-size: var(--text-sm); - font-weight: 600; - color: var(--ink); -} - -.card-chips { - display: flex; - gap: var(--space-1); - min-height: var(--chip-h); - overflow: hidden; -} - -.card-skel .card-art { - background: var(--panel-raised); -} - -/* ---- search rows and the add flow (§9.2) ---------------------------------- */ - -.add-panel { - display: grid; - gap: var(--space-3); - padding: var(--space-3); - background: var(--panel); - border: 1px solid var(--line); - border-radius: var(--radius); - box-shadow: inset 0 1px var(--highlight); -} - -.add-roots { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); - gap: var(--space-2); -} - -.root-option { - display: grid; - gap: var(--space-1); - min-height: var(--control-h); - padding: var(--space-2) var(--space-3); - font: inherit; - text-align: left; - color: var(--ink); - background: var(--panel-raised); - border: 1px solid var(--line); - border-radius: var(--radius); - cursor: pointer; - transition: border-color 150ms var(--ease-out); -} - -.root-option:hover:not(:disabled) { - border-color: var(--line-strong); -} - -.root-option[aria-pressed="true"] { - border-color: var(--accent); -} - -.root-option:disabled { - cursor: default; - opacity: 0.6; -} - -.root-audience { - font-family: var(--font-display); - font-size: var(--text-md); - font-weight: 700; - text-transform: uppercase; - letter-spacing: 0.12em; - line-height: 1; -} - -.root-policy, -.root-path { - font-size: var(--text-xs); -} - -.add-actions { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: var(--space-3); -} - -.add-autotrack { - display: grid; - justify-items: start; - gap: var(--space-1); -} - -.add-note { - margin: 0; - font-size: var(--text-xs); - color: var(--ink-muted); -} - -.add-note[data-tone="fault"] { - color: var(--signal-fault); -} - -.add-note[data-tone="ok"] { - color: var(--signal-ok); -} - /* ---- title detail (§9.6) ---------------------------------------------------- */ /* the hero: back and title, then poster and what the title IS, over the @@ -532,37 +358,6 @@ body { z-index: 1; } -.page-head { - display: flex; - align-items: center; - gap: var(--space-2); - min-height: var(--control-h); - margin-bottom: var(--space-3); -} - -/* a detail page without a hero still gives its head room under the rail */ -.deck.detail > .page-head { - padding-top: var(--space-2); -} - -.page-id { - display: grid; - min-width: 0; -} - -.page-year, -.page-sub { - flex: none; - font-size: var(--text-xs); - color: var(--ink-muted); -} - -.page-sub { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - /* the title is known before the page is: a bar the title's own size */ .page-title:empty::before, [data-loading] .page-title::before { @@ -575,231 +370,10 @@ body { border-radius: 3px; } -.hero-body { - display: grid; - grid-template-columns: 6rem minmax(0, 1fr); - gap: var(--space-4); - align-items: start; -} - -/* the poster's box is there before the poster is */ -.hero-poster { - aspect-ratio: 2 / 3; - background: var(--panel-raised); - border: 1px solid var(--line-strong); - border-radius: var(--radius); - overflow: hidden; -} - -.movie-poster { - display: block; - width: 100%; - height: 100%; - object-fit: cover; - opacity: 0; - transition: opacity 300ms var(--ease-out); -} - -.movie-poster[data-loaded] { - opacity: 1; -} - -.hero-info { - display: grid; - gap: var(--space-2); - align-content: start; - min-width: 0; -} - -.hero-chips { - display: flex; - flex-wrap: wrap; - gap: var(--space-1); - min-height: var(--chip-h); -} - -/* each line keeps its height while empty, so the hero never grows in steps */ -.hero-rating, -.hero-meta { - display: flex; - align-items: center; - gap: var(--space-1); - min-height: 1.25rem; - margin: 0; - font-size: var(--text-xs); - color: var(--ink-muted); -} - -.hero-rating { - color: var(--ink); -} - -.hero-tagline { - display: none; - margin: 0; - font-family: var(--font-display); - font-size: var(--text-md); - font-weight: 600; - color: var(--ink-muted); -} - -/* three lines, reserved, a tap opens the rest */ -.hero-overview { - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 3; - min-height: 4.5em; - max-width: 65ch; - margin: 0; - overflow: hidden; - font-size: var(--text-sm); - color: var(--ink); - cursor: pointer; -} - -.hero-overview[data-full] { - -webkit-line-clamp: unset; -} - -.hero-note { - margin-top: var(--space-2); -} - -/* one action bar: the primary word, the links as glyphs, the rest behind ⋯ */ -.actionbar { - display: flex; - align-items: center; - gap: var(--space-2); - min-height: var(--control-h); - margin-bottom: var(--space-3); -} - -.actionbar-links { - display: flex; - flex: 1; - align-items: center; - gap: var(--space-2); - min-width: 0; -} - -.more-panel { - display: grid; - gap: var(--space-3); - margin-bottom: var(--space-4); - padding: var(--space-3); - background: var(--panel); - border: 1px solid var(--line); - border-radius: var(--radius); - box-shadow: inset 0 1px var(--highlight); -} - -.more-links { - display: flex; - flex-wrap: wrap; - gap: var(--space-2); -} - -.more-links:empty { - display: none; -} - -.more-toggles { - display: grid; - gap: var(--space-2); -} - -.more-field { - display: grid; -} - -.control-note { - margin: 0; - font-size: var(--text-xs); - color: var(--ink-muted); -} - @container (min-width: 40rem) { .hero { padding-top: var(--space-4); } - - .hero-body { - grid-template-columns: 9rem minmax(0, 1fr); - gap: var(--space-6); - } - - .hero-tagline { - display: block; - } - - .more-panel { - grid-template-columns: repeat(2, minmax(0, 1fr)); - align-items: end; - } - - .more-toggles { - grid-template-columns: repeat(2, minmax(0, 1fr)); - grid-column: 1 / -1; - } - - .more-panel > .remove-panel, - .more-panel > .more-links, - .more-panel > .control-note { - grid-column: 1 / -1; - } -} - -@container (min-width: 64rem) { - .hero-body { - grid-template-columns: 10.5rem minmax(0, 1fr); - } -} - -/* ---- removal confirmation (§7.4, issue 104) ------------------------------- */ - -.remove-body { - display: grid; - gap: var(--space-2); - padding: var(--space-3); - background: var(--panel-raised); - border: 1px solid var(--line); - border-radius: var(--radius); -} - -.remove-body[data-armed="true"] { - border-color: oklch(from var(--signal-warn) l c h / 55%); -} - -.remove-evidence, -.remove-path, -.remove-note { - margin: 0; - font-size: var(--text-xs); -} - -/* the folder is evidence: it wraps rather than truncating */ -.remove-path { - color: var(--ink-muted); - overflow-wrap: anywhere; - white-space: pre-line; -} - -.remove-note { - color: var(--ink-muted); -} - -.remove-note[data-tone="warn"] { - color: var(--signal-warn); -} - -.remove-note[data-tone="fault"] { - color: var(--signal-fault); -} - -.remove-actions { - display: flex; - flex-wrap: wrap; - gap: var(--space-2); } /* ---- release deck (§9.3) ------------------------------------------------- */ diff --git a/web/src/detail.tsx b/web/src/detail.tsx index 6476263..2152ac9 100644 --- a/web/src/detail.tsx +++ b/web/src/detail.tsx @@ -3,7 +3,11 @@ import { type CSSProperties, type ReactNode, useEffect, useRef, useState } from "react"; import { Icon, ProviderMark, Star } from "./icons"; -import { control, NOTE, type } from "./look"; +import { control, NOTE, detail as page, type } from "./look"; + +/** each line keeps its height while empty, so the hero never grows in steps */ +const HERO_LINE = "readout flex items-center gap-1 min-h-line m-0 text-xs"; + import { formatMetaLine, formatRating, formatVoteCount, tmdbImage } from "./movie"; import { type ActionOutcome, formatSize, totalSize } from "./releases"; import { cx, flag, IconControl, IconLink, type Note, NoteLine } from "./ui"; @@ -64,17 +68,17 @@ export function Hero({ aria-label="title metadata" data-bleed="" > -
+

{title === "" ? " " : title}

- {year === null ? "" : year} + {year === null ? "" : year}
-
-
+
+
{posterUrl setPosterBroken(true)} />
-
- {chips} -

+

+ {chips} +

{detail !== null && detail.vote_average !== null && ( <> @@ -93,15 +97,15 @@ export function Hero({ )}

-

+

{detail === null ? "" : formatMetaLine(detail.runtime, detail.genres)}

-

+

{tagline !== null && tagline !== undefined && tagline !== "" ? `“${tagline}”` : ""}

{/* biome-ignore lint/a11y/useKeyWithClickEvents: a reading aid; the full text is in the DOM either way */}

setOverviewFull(!overviewFull)} > @@ -246,19 +250,30 @@ export function RemovePanel({ return ( // biome-ignore lint/a11y/useSemanticElements: a fieldset brings its own border, padding and min-width, which this group does not want

-

{evidence}

-

{evidence}

+ -

+

{note.text}

-
+
{/* armed: the confirm turns caution amber with the rest of the panel */} diff --git a/web/src/style.css b/web/src/style.css index 052365e..523cb29 100644 --- a/web/src/style.css +++ b/web/src/style.css @@ -87,6 +87,10 @@ /* a row's poster thumbnail, 2:3 */ --spacing-poster: 2.25rem; --spacing-poster-h: 3.375rem; + /* a hero readout line, reserved while empty */ + --spacing-line: 1.25rem; + /* three lines of overview, reserved */ + --spacing-overview: 4.5em; --container-deck: var(--deck-max); --container-measure: var(--measure); diff --git a/web/src/ui.tsx b/web/src/ui.tsx index eb05c15..5e5aa34 100644 --- a/web/src/ui.tsx +++ b/web/src/ui.tsx @@ -18,6 +18,7 @@ import { import { Icon, type IconName, useArmed } from "./icons"; import { type ControlLook, + card, chip, control, cx, @@ -831,10 +832,7 @@ export function Rows({ children?: ReactNode; }) { return ( -
    +
      {children}
    ); diff --git a/web/src/views/Library.tsx b/web/src/views/Library.tsx index 2bbb157..1e809b1 100644 --- a/web/src/views/Library.tsx +++ b/web/src/views/Library.tsx @@ -10,7 +10,7 @@ import { movieNeedsAttention, seriesNeedsAttention, } from "../library"; -import { seg, segmented, skel } from "../look"; +import { card, seg, segmented, skel } from "../look"; import { MovieCard, MovieRow, SeriesCard, SeriesRow } from "../rows"; import { allRoots, type LibraryMovie, type Root } from "../search"; import { Deck, DeckHead, PageBar, Rows, Section, SkeletonRows, useStatus } from "../ui"; @@ -54,9 +54,9 @@ function GridSkeleton() { {Array.from({ length: 6 }, (_, index) => ( // biome-ignore lint/suspicious/noArrayIndexKey: placeholders have no identity
  • - - - + + + diff --git a/web/src/views/Movie.tsx b/web/src/views/Movie.tsx index 4d6bb5b..daa19e1 100644 --- a/web/src/views/Movie.tsx +++ b/web/src/views/Movie.tsx @@ -5,7 +5,7 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { Buckets, type DeckState, type ReleaseActions } from "../buckets"; import { LAYER, useEscape, useNav } from "../context"; import { Hero, ProviderLink, RemovePanel, type RemoveSubject, TrailerLink } from "../detail"; -import { control, SUB } from "../look"; +import { control, detail, SUB } from "../look"; import { fileName, imdbLink, @@ -431,11 +431,11 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases } /> -
    +
    - + {/* the trailer resolves from the metadata's own key — no second call. Hidden when absent rather than shown dead (§9.6). */} {metadata?.trailer && ( @@ -451,8 +451,8 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases onClick={() => setMoreOpen(!moreOpen)} />
    -