Move the web stylesheet into Tailwind utilities #281

Merged
naps62-yolo merged 9 commits from 280-tailwind-utilities into main 2026-11-11 21:14:24 +00:00
14 changed files with 370 additions and 330 deletions
Showing only changes of commit db22e4a1d2 - Show all commits
+2 -1
View File
@@ -108,7 +108,8 @@ function checkCss(source, rel) {
}
}
const ARBITRARY = /(?:^|[\s"'`:])!?-?[a-z][\w-]*-\[([^\]\s]+)\]/g;
// a value, not a variant: `data-[tone=fault]:` selects, it does not style
const ARBITRARY = /(?:^|[\s"'`:])!?-?[a-z][\w-]*-\[([^\]\s]+)\](?!:)/g;
function checkPlain(source, rel) {
// Comments are prose, not styling — `checkCss` already ignores them, and
+27 -16
View File
@@ -19,7 +19,18 @@ import {
ruleLabel,
type WaiveOutcome,
} from "./releases";
import { Chip, Control, DeckHead, Disclosure, EmptyRow, Row, SkeletonRows, useNote } from "./ui";
import {
Chip,
Control,
DeckHead,
Disclosure,
EmptyRow,
Row,
Rows,
Section,
SkeletonRows,
useNote,
} from "./ui";
export type Bucket = "eligible" | "waived" | "rejected";
@@ -138,13 +149,13 @@ function CollapsedBucket({
}) {
const [open, setOpen] = useState(false);
return (
<section className="deck-group" hidden={releases.length === 0}>
<Section hidden={releases.length === 0}>
<DeckHead as="h4" label={label} count={releases.length === 0 ? "" : releases.length}>
<Disclosure count={releases.length} open={open} onToggle={() => setOpen(!open)} />
</DeckHead>
<div hidden={!open}>
<Colhead />
<ul className="deck-rows">
<Rows>
<Paged
items={releases}
keyOf={(release) => release.id}
@@ -157,9 +168,9 @@ function CollapsedBucket({
/>
)}
/>
</ul>
</Rows>
</div>
</section>
</Section>
);
}
@@ -171,17 +182,17 @@ export function Buckets({ state, actions }: { state: DeckState; actions: Release
if (state.kind !== "releases") {
return (
<div className="buckets">
<section className="deck-group" hidden={state.kind === "none"}>
<Section hidden={state.kind === "none"}>
<DeckHead as="h4" label="eligible" count="" />
<Colhead />
<ul className="deck-rows">{state.kind === "skeleton" && <SkeletonRows count={4} />}</ul>
</section>
<section className="deck-group" hidden>
<Rows>{state.kind === "skeleton" && <SkeletonRows count={4} />}</Rows>
</Section>
<Section hidden>
<DeckHead as="h4" label="below policy" count="" />
</section>
<section className="deck-group" hidden>
</Section>
<Section hidden>
<DeckHead as="h4" label="rejected" count="" />
</section>
</Section>
</div>
);
}
@@ -206,10 +217,10 @@ function PaintedBuckets({
const forceable = rejected.filter(overridable).length;
return (
<div className="buckets">
<section className="deck-group">
<Section>
<DeckHead as="h4" label="eligible" count={eligible.length} />
<Colhead />
<ul className="deck-rows">
<Rows>
{eligible.length === 0 ? (
<EmptyRow
text={
@@ -232,8 +243,8 @@ function PaintedBuckets({
)}
/>
)}
</ul>
</section>
</Rows>
</Section>
<CollapsedBucket
label="below policy"
releases={waived}
+6 -161
View File
@@ -91,6 +91,9 @@
--space-12: 3rem;
--radius: 4px;
--deck-max: 68rem;
/* a readable line of prose */
--measure: 65ch;
--ease-out: cubic-bezier(0.25, 1, 0.5, 1);
/* geometry: a 44px touch target, a 24px chip, one row height */
@@ -183,9 +186,8 @@ body {
outline: none;
}
/* hidden wins over every display rule a component sets; the one exception is
a status slot, which keeps its line while empty */
[hidden]:not(.deck-status) {
/* hidden wins over every display rule a component sets, utilities included */
[hidden] {
/* biome-ignore lint/complexity/noImportantStyles: `hidden` must beat component display rules */
display: none !important;
}
@@ -1081,151 +1083,6 @@ button.chip {
}
}
/* ---- decks, pages, sections --------------------------------------------- */
.deck {
container-type: inline-size;
width: 100%;
max-width: 68rem;
margin: 0 auto;
padding: var(--space-4) 0 var(--space-12);
flex: 1;
}
/* the gutter belongs to the content, so a hero can still reach both edges */
.deck > * {
margin-inline: var(--gutter);
}
.deck > section.hero {
margin-inline: 0;
}
.deck.detail {
padding-top: 0;
}
.page-bar .page-title {
text-transform: capitalize;
}
/* a page's line: title, count, a one-line status slot, the page's controls */
.page-bar {
display: flex;
align-items: center;
gap: var(--space-3);
min-height: var(--control-h);
margin-bottom: var(--space-4);
}
.page-bar .deck-count {
flex: none;
}
/* always laid out, so a message never pushes the page down */
.head-status {
flex: 1;
min-width: 0;
margin: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: var(--text-xs);
color: var(--ink-muted);
}
.head-status[data-tone="fault"] {
color: var(--signal-fault);
}
/* a section's status: one reserved line, wraps only when the sentence must */
.deck-status {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: var(--space-2) var(--space-3);
min-height: 1.5rem;
margin-bottom: var(--space-3);
font-size: var(--text-xs);
color: var(--ink-muted);
}
.deck-status[hidden] {
visibility: hidden;
}
.deck-status[data-tone="fault"],
.head-status[data-tone="fault"] {
color: var(--signal-fault);
}
.deck-status .lamp,
.head-status .lamp {
display: inline-block;
margin-right: var(--space-2);
}
.deck-group {
margin-bottom: var(--space-8);
}
.deck-head {
display: flex;
align-items: center;
gap: var(--space-3);
min-height: var(--control-h);
padding-bottom: var(--space-1);
border-bottom: 1px solid var(--line);
}
.deck-head .head-action,
.deck-head .disclose {
margin-left: auto;
}
/* nested heads inside a section are group labels, one step quieter */
.deck-group .deck-group .deck-head {
min-height: var(--chip-h);
padding-top: var(--space-3);
}
.deck-rows {
margin: 0;
padding: 0;
list-style: none;
}
/* one plain sentence, the long form behind a tap */
.group-note {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-1) var(--space-2);
padding: var(--space-2) 0 0;
font-size: var(--text-sm);
color: var(--ink-muted);
}
.group-note p {
margin: 0;
}
.group-note .group-note-more {
flex-basis: 100%;
max-width: 65ch;
font-size: var(--text-xs);
}
.group-note .control-icon {
width: var(--chip-h);
min-width: var(--chip-h);
min-height: var(--chip-h);
border-color: transparent;
background: none;
box-shadow: none;
color: var(--ink-faint);
}
/* ---- the row ------------------------------------------------------------------ */
/* lead | body | actions, then the tray full width. The body is minmax(0, 1fr):
@@ -1682,7 +1539,7 @@ button.chip {
/* ---- poster grid (§9.6, issue 151) -------------------------------------- */
.deck-rows.grid-rows {
.grid-rows {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
gap: var(--space-3);
@@ -2324,14 +2181,6 @@ button.chip {
border-radius: var(--radius);
}
.subs-panel .deck-group {
margin-bottom: var(--space-4);
}
.subs-panel .deck-group:last-child {
margin-bottom: 0;
}
.subs-present {
display: flex;
flex-wrap: wrap;
@@ -2384,10 +2233,6 @@ button.chip {
margin-top: var(--space-3);
}
.subs-buckets .deck-group {
margin-bottom: var(--space-3);
}
/* ---- settings (issue #116) -------------------------------------------- */
.form-grid {
+1
View File
@@ -61,6 +61,7 @@ export function Hero({
: ({ "--backdrop": `url("${backdropUrl}")` } as CSSProperties)
}
aria-label="title metadata"
data-bleed=""
>
<header className="page-head">
<IconControl glyph="back" label="back" onClick={onBack} />
+17
View File
@@ -52,6 +52,7 @@
--color-score-6: var(--score-6);
--color-status-airing: var(--status-airing);
--spacing-0: 0px;
--spacing-1: var(--space-1);
--spacing-2: var(--space-2);
--spacing-3: var(--space-3);
@@ -59,6 +60,22 @@
--spacing-6: var(--space-6);
--spacing-8: var(--space-8);
--spacing-12: var(--space-12);
--spacing-control-h: var(--control-h);
--spacing-chip-h: var(--chip-h);
--spacing-row-min: var(--row-min);
--spacing-toggle-w: var(--toggle-w);
--spacing-word-w: var(--word-w);
--spacing-rail-h: var(--rail-h);
--spacing-tabbar-h: var(--tabbar-h);
--spacing-gutter: var(--gutter);
--container-deck: var(--deck-max);
--container-measure: var(--measure);
/* container query widths for @row, @cells and @wide: the row grows its
action column, the release cells line up, the detail hero widens */
--container-row: 40rem;
--container-cells: 46rem;
--container-wide: 64rem;
--text-2xs: var(--text-2xs);
--text-xs: var(--text-xs);
+16 -14
View File
@@ -45,7 +45,9 @@ import {
type Note,
NoteLine,
Row,
Rows,
type Say,
Section,
useNote,
} from "./ui";
@@ -326,9 +328,9 @@ function CandidateBuckets({
const rejected = results.candidates.filter((c) => c.verdict !== "eligible");
return (
<div className="subs-buckets">
<section className="deck-group">
<Section spacing="mb-3">
<DeckHead as="h4" label="eligible" count={eligible.length} />
<ul className="deck-rows">
<Rows>
{eligible.length === 0 && (
<EmptyRow text="none — every candidate names the rule that rejected it below" />
)}
@@ -340,14 +342,14 @@ function CandidateBuckets({
fetchCandidate={fetchCandidate}
/>
))}
</ul>
</section>
<section className="deck-group" hidden={rejected.length === 0}>
</Rows>
</Section>
<Section spacing="mb-3" hidden={rejected.length === 0}>
<DeckHead as="h4" label="rejected" count={rejected.length}>
<Disclosure count={rejected.length} open={open} onToggle={() => setOpen(!open)} />
</DeckHead>
<div hidden={!open}>
<ul className="deck-rows">
<Rows>
{rejected.map((candidate) => (
<CandidateRow
key={`${candidate.provider}:${candidate.candidate_id}`}
@@ -356,9 +358,9 @@ function CandidateBuckets({
fetchCandidate={fetchCandidate}
/>
))}
</ul>
</Rows>
</div>
</section>
</Section>
</div>
);
}
@@ -731,7 +733,7 @@ export function useSubtitleSection(
const panel = (
<div className="subs-panel" id={panelId} hidden={!open}>
<section className="deck-group subs-lane">
<Section spacing="mb-4 last:mb-0">
<DeckHead label="on this file" />
<div className="subs-present">
{asked.map((subtitle) => (
@@ -760,9 +762,9 @@ export function useSubtitleSection(
)}
</div>
<NoteLine note={presentNote} className="subs-note readout" />
</section>
</Section>
<section className="deck-group subs-lane">
<Section spacing="mb-4 last:mb-0">
<DeckHead label="fetch" count={fetchCount} />
<div className="subs-controls">
<LanguagePicker
@@ -790,9 +792,9 @@ export function useSubtitleSection(
fetchCandidate={fetchCandidate}
/>
)}
</section>
</Section>
<section className="deck-group subs-lane">
<Section spacing="mb-4 last:mb-0">
<DeckHead label="translate" />
<div className="subs-controls">
<SubtitleField label="source">
@@ -872,7 +874,7 @@ export function useSubtitleSection(
{options === null ? "" : hint}
</p>
<NoteLine note={translateNote} className="subs-note readout" />
</section>
</Section>
</div>
);
+177 -17
View File
@@ -5,11 +5,14 @@
import {
type ComponentProps,
createContext,
type HTMLAttributes,
type KeyboardEvent,
type MouseEvent,
type ReactNode,
type Ref,
useCallback,
useContext,
useState,
} from "react";
import { Icon, type IconName, useArmed } from "./icons";
@@ -156,7 +159,7 @@ export function Disclosure({
return (
<button
type="button"
className="control control-quiet disclose"
className="control control-quiet disclose ml-auto"
aria-expanded={open}
onClick={onToggle}
>
@@ -212,16 +215,34 @@ export interface Status {
* A status slot. The slot is always laid out — an empty one keeps its line —
* so a message arriving or leaving never pushes the content below it.
*/
export function StatusSlot({ status, className }: { status: Status | null; className: string }) {
const SLOT = {
// a page bar's one line, ellipsised: a message never pushes the page down
head: "flex-1 min-w-0 m-0 overflow-hidden whitespace-nowrap text-ellipsis",
// a section's line: reserved, and wraps only when the sentence must
deck: "flex items-center flex-wrap gap-y-2 gap-x-3 min-h-chip-h mb-3",
} as const;
export function StatusSlot({
status,
variant,
}: {
status: Status | null;
variant: keyof typeof SLOT;
}) {
return (
<p
className={className}
className={cx(
"readout text-xs text-ink-muted data-[tone=fault]:text-signal-fault",
SLOT[variant],
)}
role="status"
data-empty={String(status === null)}
data-tone={status?.tone}
data-action={flag(status?.action !== undefined)}
>
{status?.busy && <span className="lamp" data-state="probing" aria-hidden="true" />}
{status?.busy && (
<span className="lamp inline-block mr-2" data-state="probing" aria-hidden="true" />
)}
{status?.text ?? ""}
{status?.action && <Control text={status.action.label} quiet onClick={status.action.run} />}
</p>
@@ -500,6 +521,107 @@ export function EmptyRow({
);
}
/* ---- page skeleton ------------------------------------------------------- */
/**
* A page: the one centred column, and a container, so a row answers to the
* page's width rather than the window's. The gutter belongs to the content;
* a child marked `data-bleed` (the detail hero) reaches both edges.
*/
export function Deck({
label,
detail = false,
hidden,
id,
ref,
onKeyDown,
children,
}: {
label: string;
/** A detail page opens on its hero, so the page drops its top padding. */
detail?: boolean;
hidden?: boolean;
id?: string;
ref?: Ref<HTMLElement>;
onKeyDown?: (event: KeyboardEvent<HTMLElement>) => void;
children: ReactNode;
}) {
return (
<main
className={cx(
"@container w-full max-w-deck mx-auto pb-12 flex-1 *:not-data-bleed:mx-gutter",
detail ? "pt-0" : "pt-4",
)}
aria-label={label}
hidden={hidden}
id={id}
ref={ref}
onKeyDown={onKeyDown}
>
{children}
</main>
);
}
/** A page's line: title, count, a one-line status slot, the page's controls. */
export function PageBar({
title,
count,
status,
children,
}: {
title: string;
/** Absent leaves the count's slot out entirely. */
count?: string;
status: Status | null;
children?: ReactNode;
}) {
return (
<header className="flex items-center gap-3 min-h-control-h mb-4">
<h2 className="page-title capitalize">{title}</h2>
{count !== undefined && <span className="deck-count readout flex-none">{count}</span>}
<StatusSlot status={status} variant="head" />
{children}
</header>
);
}
/** Whether a section sits inside another: its head is then a quieter group label. */
const Nested = createContext(false);
const InnerSection = createContext(false);
/** A section of a page; `spacing` replaces the default gap after it. */
export function Section({
spacing = "mb-8",
hidden,
labelledBy,
ref,
className,
children,
}: {
spacing?: string;
hidden?: boolean;
labelledBy?: string;
ref?: Ref<HTMLElement>;
/** A marker other rules still key on, such as `subs-lane`. */
className?: string;
children: ReactNode;
}) {
const outer = useContext(Nested);
return (
<section
className={cx(spacing, className)}
hidden={hidden}
aria-labelledby={labelledBy}
ref={ref}
>
<InnerSection.Provider value={outer}>
<Nested.Provider value={true}>{children}</Nested.Provider>
</InnerSection.Provider>
</section>
);
}
/** A section head: the engraved label, a count, then whatever acts on it. */
export function DeckHead({
label,
@@ -516,8 +638,15 @@ export function DeckHead({
count?: string | number | null;
children?: ReactNode;
}) {
// nested heads inside a section are group labels, one step quieter
const nested = useContext(InnerSection);
return (
<header className="deck-head">
<header
className={cx(
"flex items-center gap-3 pb-1 border-b border-b-line",
nested ? "min-h-chip-h pt-3" : "min-h-control-h",
)}
>
<Heading className={labelClass} id={labelId}>
{label}
</Heading>
@@ -527,21 +656,52 @@ export function DeckHead({
);
}
/** A list of rows, or of poster cards. */
export function Rows({
grid = false,
className,
hidden,
children,
}: {
grid?: boolean;
/** A marker other rules still key on, such as `seasons`. */
className?: string;
hidden?: boolean;
children?: ReactNode;
}) {
return (
<ul
className={cx("m-0 list-none", grid ? "grid-rows px-0 pb-0" : "p-0", className)}
aria-hidden={hidden}
>
{children}
</ul>
);
}
/** A group's one plain sentence, which opens to the long form on a tap. */
export function GroupNote({ short, more }: { short: string; more: string }) {
export function GroupNote({ short, more }: { short: string; more?: string }) {
const [open, setOpen] = useState(false);
return (
<div className="group-note" data-explain-group="">
<p>{short}</p>
<IconControl
glyph="info"
label="more about this list"
aria-expanded={open}
onClick={() => setOpen(!open)}
/>
<p className="group-note-more" hidden={!open}>
{more}
</p>
<div
className="flex flex-wrap items-center gap-y-1 gap-x-2 pt-2 text-sm text-ink-muted"
data-explain-group={more === undefined ? undefined : ""}
>
<p className="m-0">{short}</p>
{more !== undefined && (
<>
<IconControl
glyph="info"
label="more about this list"
aria-expanded={open}
onClick={() => setOpen(!open)}
className="size-chip-h min-w-chip-h min-h-chip-h border-transparent bg-none bg-transparent [box-shadow:none] text-ink-faint aria-expanded:border-accent aria-expanded:text-accent-bright"
/>
<p className="m-0 basis-full max-w-measure text-xs" hidden={!open}>
{more}
</p>
</>
)}
</div>
);
}
+27 -30
View File
@@ -12,7 +12,7 @@ import {
} from "../library";
import { MovieCard, MovieRow, SeriesCard, SeriesRow } from "../rows";
import { allRoots, type LibraryMovie, type Root } from "../search";
import { DeckHead, SkeletonRows, StatusSlot, useStatus } from "../ui";
import { Deck, DeckHead, PageBar, Rows, Section, SkeletonRows, useStatus } from "../ui";
type LibraryShape = "grid" | "list";
@@ -49,7 +49,7 @@ let cached: LibraryData | null = null;
function GridSkeleton() {
return (
<ul className="deck-rows grid-rows" aria-hidden="true">
<Rows grid hidden>
{Array.from({ length: 6 }, (_, index) => (
// biome-ignore lint/suspicious/noArrayIndexKey: placeholders have no identity
<li key={index}>
@@ -62,7 +62,7 @@ function GridSkeleton() {
</span>
</li>
))}
</ul>
</Rows>
);
}
@@ -162,13 +162,12 @@ export function LibraryView({ hidden }: { hidden: boolean }) {
}
return (
<main className="deck" aria-label="library" hidden={hidden}>
<header className="page-bar">
<h2 className="page-title">library</h2>
<span className="deck-count readout">
{total === 0 ? "" : `${total} ${total === 1 ? "title" : "titles"}`}
</span>
<StatusSlot status={status} className="head-status readout" />
<Deck label="library" hidden={hidden}>
<PageBar
title="library"
count={total === 0 ? "" : `${total} ${total === 1 ? "title" : "titles"}`}
status={status}
>
<fieldset className="segmented" aria-label="layout">
<button
type="button"
@@ -189,58 +188,56 @@ export function LibraryView({ hidden }: { hidden: boolean }) {
<Icon name="list" />
</button>
</fieldset>
</header>
</PageBar>
<div hidden={shown !== null && (shape === "list" || grid.length === 0)}>
{data === null && !failed && (shape === "grid" ? <GridSkeleton /> : <ListSkeleton />)}
{shown !== null &&
grid.map((section) => (
<section key={section.id} className="deck-group library-grid-group">
<Section key={section.id}>
<DeckHead label={section.label} count={section.items.length} />
<ul className="deck-rows grid-rows">
<Rows grid>
{section.items.map((item) => (
<Fragment key={item.key}>{item.node}</Fragment>
))}
</ul>
</section>
</Rows>
</Section>
))}
</div>
<section
className="deck-group"
<Section
hidden={shown === null || shape === "grid" || seriesShown.length === 0}
aria-labelledby="label-lib-series"
labelledBy="label-lib-series"
>
<DeckHead label="series" labelId="label-lib-series" count={seriesShown.length} />
<ul className="deck-rows">
<Rows>
{shape === "list" &&
seriesShown.map((series) => (
<SeriesRow key={series.id} series={series} roots={roots} open={nav.openSeries} />
))}
</ul>
</section>
</Rows>
</Section>
<section
className="deck-group"
<Section
hidden={shown === null || shape === "grid" || moviesShown.length === 0}
aria-labelledby="label-lib-movies"
labelledBy="label-lib-movies"
>
<DeckHead label="movies" labelId="label-lib-movies" count={moviesShown.length} />
<ul className="deck-rows">
<Rows>
{shape === "list" &&
moviesShown.map((movie) => (
<MovieRow key={movie.id} movie={movie} roots={roots} open={nav.openMovie} />
))}
</ul>
</section>
</main>
</Rows>
</Section>
</Deck>
);
}
function ListSkeleton() {
return (
<ul className="deck-rows">
<Rows>
<SkeletonRows count={6} />
</ul>
</Rows>
);
}
+13 -10
View File
@@ -45,12 +45,15 @@ import { useSubtitleSection } from "../subs-panel";
import { movieSubtitleStatus, type SubtitleStatus } from "../subtitles";
import {
Chip,
Deck,
DeckHead,
EmptyRow,
Expandable,
IconControl,
LampToggle,
Row,
Rows,
Section,
SkeletonRows,
StatusSlot,
useNote,
@@ -405,7 +408,7 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
const rootListed = movie !== null && movieRoots.some((root) => root.id === movie.root_id);
return (
<main className="deck detail" aria-label="movie detail">
<Deck detail label="movie detail">
<Hero
title={movie?.title ?? ""}
year={movie?.year ?? null}
@@ -543,16 +546,16 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
)}
</div>
</div>
<StatusSlot status={status} className="deck-status readout" />
<StatusSlot status={status} variant="deck" />
<section className="deck-group" aria-labelledby="label-disk">
<Section labelledBy="label-disk">
<DeckHead
label="on disk"
labelId="label-disk"
labelClass="section-title"
count={files?.kind === "files" ? files.files.length : ""}
/>
<ul className="deck-rows">
<Rows>
{files === null && <SkeletonRows count={1} withLead={false} />}
{files?.kind === "error" && (
<EmptyRow text={`files unreadable — ${files.detail}`} tone="fault" />
@@ -569,14 +572,14 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
refresh={refreshSubtitles}
/>
))}
</ul>
</section>
</Rows>
</Section>
<section className="deck-group" aria-labelledby="label-releases" ref={releasesSection}>
<Section labelledBy="label-releases" ref={releasesSection}>
<DeckHead label="releases" labelId="label-releases" labelClass="section-title" />
<StatusSlot status={releaseStatus} className="deck-status readout" />
<StatusSlot status={releaseStatus} variant="deck" />
<Buckets state={deck} actions={actions} />
</section>
</main>
</Section>
</Deck>
);
}
+14 -13
View File
@@ -25,12 +25,15 @@ import { missingChipLabel } from "../subtitles";
import {
Chip,
Control,
Deck,
DeckHead,
EmptyRow,
GroupNote,
PageBar,
Row,
Rows,
Section,
SkeletonRows,
StatusSlot,
useNote,
useStatus,
} from "../ui";
@@ -208,11 +211,11 @@ function QueueGroup({
hidden: boolean;
}) {
return (
<section className="deck-group" hidden={hidden} aria-labelledby={`label-${id}`}>
<Section hidden={hidden} labelledBy={`label-${id}`}>
<DeckHead label={label} labelId={`label-${id}`} count={count ?? ""} />
{note}
<ul className="deck-rows">{rows}</ul>
</section>
<Rows>{rows}</Rows>
</Section>
);
}
@@ -294,14 +297,12 @@ export function QueuesView({ hidden }: { hidden: boolean }) {
);
return (
<main className="deck" aria-label="attention queues" hidden={hidden}>
<header className="page-bar">
<h2 className="page-title">queues</h2>
<span className="deck-count readout">
{loaded === null || total === 0 ? "" : `${total} waiting`}
</span>
<StatusSlot status={status} className="head-status readout" />
</header>
<Deck label="attention queues" hidden={hidden}>
<PageBar
title="queues"
count={loaded === null || total === 0 ? "" : `${total} waiting`}
status={status}
/>
<QueueGroup
id="no-pt"
@@ -387,6 +388,6 @@ export function QueuesView({ hidden }: { hidden: boolean }) {
</>,
)}
/>
</main>
</Deck>
);
}
+26 -23
View File
@@ -18,7 +18,19 @@ import {
type TmdbMovie,
type TmdbSeries,
} from "../search";
import { Chip, Control, DeckHead, flag, LampToggle, Row, StatusSlot, useStatus } from "../ui";
import {
Chip,
Control,
Deck,
DeckHead,
flag,
LampToggle,
PageBar,
Row,
Rows,
Section,
useStatus,
} from "../ui";
/** Which kind the deck is showing. `all` is both, and the default. */
type KindFilter = "all" | "movie" | "series";
@@ -395,17 +407,8 @@ export function SearchView({
all.filter((hit) => filter === "all" || hit.kind === filter).length;
return (
<main
className="deck"
id="deck"
aria-label="search results"
hidden={hidden}
onKeyDown={onKeyDown}
>
<header className="page-bar">
<h2 className="page-title">search</h2>
<StatusSlot status={status} className="head-status readout" />
</header>
<Deck id="deck" label="search results" hidden={hidden} onKeyDown={onKeyDown}>
<PageBar title="search" status={status} />
<div
className="segmented deck-filter"
@@ -436,9 +439,9 @@ export function SearchView({
))}
</div>
<section className="deck-group" hidden={library.length === 0} aria-labelledby="label-library">
<Section hidden={library.length === 0} labelledBy="label-library">
<DeckHead label="in library" labelId="label-library" count={library.length || ""} />
<ul className="deck-rows">
<Rows>
{/* §9.2: in-library hits read as whatever they are — a movie or a
series — and hold the order the API ranked them in. */}
{library.map((hit) =>
@@ -448,22 +451,22 @@ export function SearchView({
<SeriesHitRow key={`s${hit.id}`} series={hit} roots={roots} open={nav.openSeries} />
),
)}
</ul>
</section>
</Rows>
</Section>
<section className="deck-group" hidden={tmdbHits.length === 0} aria-labelledby="label-tmdb">
<Section hidden={tmdbHits.length === 0} labelledBy="label-tmdb">
<DeckHead label="on tmdb" labelId="label-tmdb" count={tmdbHits.length || ""} />
<ul className="deck-rows">
<Rows>
{tmdbHits.map((hit) => (
<TmdbRow key={`${hit.kind}${hit.tmdb_id}`} hit={hit} fetchRoots={fetchRoots} />
))}
</ul>
</section>
</Rows>
</Section>
<section className="deck-group" hidden={manual === null} aria-labelledby="label-manual">
<Section hidden={manual === null} labelledBy="label-manual">
<DeckHead label="manual grab" labelId="label-manual" />
{manual !== null && <ManualIntake kind={manual.kind} raw={manual.raw} />}
</section>
</main>
</Section>
</Deck>
);
}
+10 -7
View File
@@ -52,11 +52,14 @@ import {
ArmedDeleteWord,
Chip,
Control,
Deck,
DeckHead,
EmptyRow,
IconControl,
LampToggle,
Row,
Rows,
Section,
SkeletonRows,
StatusSlot,
useNote,
@@ -695,7 +698,7 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
const rootListed = series !== null && tvRoots.some((root) => root.id === series.root_id);
return (
<main className="deck detail" aria-label="series detail" hidden={covered} ref={view}>
<Deck detail label="series detail" hidden={covered} ref={view}>
<Hero
title={series?.title ?? ""}
year={series?.year ?? null}
@@ -809,11 +812,11 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
)}
</div>
</div>
<StatusSlot status={status} className="deck-status readout" />
<StatusSlot status={status} variant="deck" />
<section className="deck-group" aria-labelledby="label-seasons">
<Section labelledBy="label-seasons">
<DeckHead label="seasons" labelId="label-seasons" labelClass="section-title" />
<ul className="deck-rows seasons">
<Rows className="seasons">
{seasons === null && <SkeletonRows count={4} />}
{seasons?.map((season) => (
<SeasonRow
@@ -833,8 +836,8 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
/>
))}
{seasons !== null && seasons.length === 0 && seasonsEmpty}
</ul>
</section>
</main>
</Rows>
</Section>
</Deck>
);
}
+28 -33
View File
@@ -34,13 +34,16 @@ import {
Chip,
Control,
cx,
Deck,
DeckHead,
GroupNote,
IconControl,
type Note,
NoteLine,
PageBar,
Row,
StatusSlot,
Rows,
Section,
useNote,
useStatus,
} from "../ui";
@@ -1116,33 +1119,31 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
const reload = () => void load();
return (
<main className="deck" aria-label="settings" hidden={hidden}>
<header className="page-bar">
<h2 className="page-title">settings</h2>
<span className="deck-count readout">
{loaded === null
? ""
: `${loaded.roots.length} roots · ${loaded.policies.length} policies`}
</span>
<StatusSlot status={status} className="head-status readout" />
</header>
<Deck label="settings" hidden={hidden}>
<PageBar
title="settings"
count={
loaded === null ? "" : `${loaded.roots.length} roots · ${loaded.policies.length} policies`
}
status={status}
/>
<section className="deck-group" aria-labelledby="label-chain">
<Section labelledBy="label-chain">
<DeckHead label="signal chain" labelId="label-chain" labelClass="section-title" />
<Chain />
</section>
</Section>
<section className="deck-group" hidden={loaded === null} aria-labelledby="label-roots">
<Section hidden={loaded === null} labelledBy="label-roots">
<DeckHead label="roots" labelId="label-roots" labelClass="section-title">
<button
type="button"
className="control control-quiet head-action"
className="control control-quiet head-action ml-auto"
onClick={() => setAddingRoot(true)}
>
add root
</button>
</DeckHead>
<ul className="deck-rows" key={loaded?.paint}>
<Rows key={loaded?.paint}>
{loaded?.roots.map((root) => (
<SettingsRow
key={root.id}
@@ -1161,7 +1162,7 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
)}
/>
))}
</ul>
</Rows>
{addingRoot && loaded !== null && (
<RootPanel
root={null}
@@ -1173,22 +1174,20 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
onCancel={() => setAddingRoot(false)}
/>
)}
</section>
</Section>
<section className="deck-group" hidden={loaded === null} aria-labelledby="label-policies">
<Section hidden={loaded === null} labelledBy="label-policies">
<DeckHead label="policies" labelId="label-policies" labelClass="section-title">
<button
type="button"
className="control control-quiet head-action"
className="control control-quiet head-action ml-auto"
onClick={() => setAddingPolicy(true)}
>
add policy
</button>
</DeckHead>
<div className="group-note">
<p>Editing a policy rescores every title's releases straight away.</p>
</div>
<ul className="deck-rows" key={loaded?.paint}>
<GroupNote short="Editing a policy rescores every title's releases straight away." />
<Rows key={loaded?.paint}>
{loaded?.policies.map((policy) => {
const bandCount = Object.keys(policy.size_bands).length;
return (
@@ -1207,7 +1206,7 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
/>
);
})}
</ul>
</Rows>
{addingPolicy && (
<PolicyPanel
policy={null}
@@ -1218,13 +1217,9 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
onCancel={() => setAddingPolicy(false)}
/>
)}
</section>
</Section>
<section
className="deck-group"
hidden={loaded === null}
aria-labelledby="label-settings-subtitles"
>
<Section hidden={loaded === null} labelledBy="label-settings-subtitles">
<DeckHead label="subtitles" labelId="label-settings-subtitles" labelClass="section-title" />
<GroupNote
short="Provider logins and translator keys are not shown here."
@@ -1235,7 +1230,7 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
<SubtitlesPanel key={loaded.paint} settings={loaded.subtitles} onSaved={reload} />
)}
</div>
</section>
</main>
</Section>
</Deck>
);
}
+6 -5
View File
@@ -16,7 +16,7 @@ import {
type SeasonPackState,
} from "../releases";
import { waiveAndGrabTv } from "../series";
import { IconControl, type Status, StatusSlot } from "../ui";
import { Deck, IconControl, type Status, StatusSlot } from "../ui";
/** §6.2: the sweep runs on the daemon's cadence. Poll modestly, give up softly. */
const TV_SWEEP_POLL_MS = 5000;
@@ -358,8 +358,9 @@ export function TvDeckView({ request }: { request: TvDeckRequest }) {
}
return (
<main className="deck detail" aria-label="season and episode releases">
<header className="page-head">
<Deck detail label="season and episode releases">
{/* a detail page without a hero still gives its head room under the rail */}
<header className="page-head pt-2">
<IconControl glyph="back" label="back" ref={back} onClick={nav.close} />
<div className="page-id">
<h2 className="page-title">{request.title}</h2>
@@ -376,7 +377,7 @@ export function TvDeckView({ request }: { request: TvDeckRequest }) {
search indexers
</button>
</div>
<StatusSlot status={status} className="deck-status readout" />
<StatusSlot status={status} variant="deck" />
<section
className="deck-notice"
hidden={failure === null}
@@ -403,6 +404,6 @@ export function TvDeckView({ request }: { request: TvDeckRequest }) {
</p>
</section>
<Buckets state={deck} actions={actions} />
</main>
</Deck>
);
}