Move the web stylesheet into Tailwind utilities #281
@@ -40,7 +40,8 @@ function walk(dir, out = []) {
|
||||
}
|
||||
|
||||
const COLOR_LITERAL = /#[0-9a-fA-F]{3,8}\b|\b(?:oklch|oklab|lab|lch|rgba?|hsla?|hwb|color)\(/;
|
||||
const RELATIVE_FROM_TOKEN = /\b(?:oklch|oklab|lab|lch|rgb|hsl|hwb|color)\(\s*from\s+var\(--/g;
|
||||
// `_` is a space inside a Tailwind arbitrary value
|
||||
const RELATIVE_FROM_TOKEN = /\b(?:oklch|oklab|lab|lch|rgb|hsl|hwb|color)\([\s_]*from[\s_]+var\(--/g;
|
||||
const SPACING_PROP = /^(?:margin|padding|gap|row-gap|column-gap|inset)(?:-[a-z-]+)?$/;
|
||||
const SPACING_VALUE = /^(?:var\(--[\w-]+\)|0|auto|-?[\d.]+%)$/;
|
||||
const FONT_SIZE_VALUE = /^var\(--text-[\w-]+\)$/;
|
||||
@@ -108,7 +109,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
|
||||
|
||||
+56
-26
@@ -16,6 +16,7 @@ import { LAYER, LiveContext, type Nav, NavContext, type TvDeckRequest, useEscape
|
||||
import { type Download, fetchDownloads } from "./downloads";
|
||||
import { type Probe, probeHealth } from "./health";
|
||||
import { Icon, type IconName } from "./icons";
|
||||
import { control, cx } from "./look";
|
||||
import { two } from "./parts";
|
||||
import {
|
||||
currentRoute,
|
||||
@@ -158,6 +159,14 @@ function restoreFocus(target: HTMLElement | null) {
|
||||
});
|
||||
}
|
||||
|
||||
/** A rail destination: engraved mono words, an accent rule under the current one. */
|
||||
const NAV_LINK =
|
||||
"inline-flex items-center gap-2 min-h-control-h py-0 px-3 font-readout text-xs font-semibold uppercase tracking-label text-ink-muted no-underline border-b-2 border-b-transparent hover:text-accent-bright aria-[current=page]:text-accent aria-[current=page]:border-b-accent";
|
||||
|
||||
/** A tab bar destination: glyph over word, a short accent rule on top of the current one. */
|
||||
const TAB =
|
||||
"relative grid place-items-center content-center gap-1 text-2xs font-semibold uppercase tracking-wide text-ink-faint no-underline aria-[current=page]:text-accent aria-[current=page]:before:absolute aria-[current=page]:before:top-0 aria-[current=page]:before:inset-x-3/10 aria-[current=page]:before:h-rule aria-[current=page]:before:bg-accent";
|
||||
|
||||
function TabGlyph({ name }: { name: IconName }) {
|
||||
return (
|
||||
<span aria-hidden="true">
|
||||
@@ -466,14 +475,18 @@ export function App() {
|
||||
return (
|
||||
<LiveContext.Provider value={live}>
|
||||
<NavContext.Provider value={nav}>
|
||||
<header className="rail" data-searching={flag(railSearching)}>
|
||||
<div className="rail-inner">
|
||||
<div className="rail-id">
|
||||
<header
|
||||
className="group/rail sticky top-0 z-20 pt-(--safe-top) border-b border-b-line bg-panel [box-shadow:inset_0_1px_var(--highlight)]"
|
||||
data-searching={flag(railSearching)}
|
||||
>
|
||||
<div className="flex items-center gap-3 w-full max-w-deck h-rail-h mx-auto px-gutter">
|
||||
{/* phone search mode: the field takes the rail, the identity steps aside */}
|
||||
<div className="flex flex-none items-center gap-3 mr-auto group-data-searching/rail:hidden sm:mr-0 sm:group-data-searching/rail:flex">
|
||||
<span className="lamp" data-state={masterState} aria-hidden="true" />
|
||||
{/* §9.7: the wordmark is a link home — intercepted so it navigates
|
||||
the SPA instead of reloading, but still a real anchor */}
|
||||
<a
|
||||
className="wordmark"
|
||||
className="font-display text-xl font-bold tracking-wide leading-none text-ink no-underline hover:text-accent-bright focus-visible:text-accent-bright"
|
||||
href="/"
|
||||
id="wordmark"
|
||||
ref={wordmark}
|
||||
@@ -485,11 +498,11 @@ export function App() {
|
||||
arr
|
||||
</a>
|
||||
</div>
|
||||
<nav className="rail-nav" aria-label="destinations">
|
||||
<nav className="hidden sm:flex sm:items-center sm:gap-1" aria-label="destinations">
|
||||
<NavLink
|
||||
destination="library"
|
||||
current={destination}
|
||||
className="nav-link"
|
||||
className={NAV_LINK}
|
||||
href="/"
|
||||
onGo={go}
|
||||
>
|
||||
@@ -498,13 +511,13 @@ export function App() {
|
||||
<NavLink
|
||||
destination="queues"
|
||||
current={destination}
|
||||
className="nav-link"
|
||||
className={NAV_LINK}
|
||||
href="/queues"
|
||||
onGo={go}
|
||||
>
|
||||
queues
|
||||
<span
|
||||
className="nav-count readout"
|
||||
className="readout text-xs text-signal-warn"
|
||||
data-role="queues-count"
|
||||
hidden={badge === null}
|
||||
>
|
||||
@@ -514,21 +527,24 @@ export function App() {
|
||||
<NavLink
|
||||
destination="settings"
|
||||
current={destination}
|
||||
className="nav-link"
|
||||
className={NAV_LINK}
|
||||
href="/settings"
|
||||
onGo={go}
|
||||
>
|
||||
settings
|
||||
</NavLink>
|
||||
</nav>
|
||||
<div className="rail-search">
|
||||
<span className="rail-search-glyph" aria-hidden="true">
|
||||
<div className="relative hidden flex-1 items-center min-w-0 group-data-searching/rail:flex sm:flex sm:max-w-search sm:ml-auto">
|
||||
<span
|
||||
className="absolute left-3 text-ink-faint pointer-events-none"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<Icon name="search" />
|
||||
</span>
|
||||
<input
|
||||
ref={inputRef}
|
||||
id="search"
|
||||
className="search-input readout"
|
||||
className="readout w-full min-h-control-h py-0 px-8 text-base text-ink bg-ground border border-line rounded-panel [box-shadow:inset_0_1px_var(--lowlight)] caret-accent [transition:border-color_150ms_var(--ease-out)] placeholder:text-ink-faint placeholder:opacity-100 hover:border-line-strong focus:border-accent focus:outline-none sm:text-sm"
|
||||
type="text"
|
||||
spellCheck={false}
|
||||
autoComplete="off"
|
||||
@@ -562,12 +578,16 @@ export function App() {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<span className="search-hint readout" aria-hidden="true" hidden={inputFocused}>
|
||||
<span
|
||||
className="readout absolute right-3 hidden py-0 px-1 text-2xs text-ink-faint border border-line rounded-panel pointer-events-none lg:inline"
|
||||
aria-hidden="true"
|
||||
hidden={inputFocused}
|
||||
>
|
||||
/
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
className="control control-icon rail-search-close"
|
||||
className={cx(control({ shape: "icon" }), "flex-none ml-2 sm:hidden")}
|
||||
aria-label="close search"
|
||||
onClick={() => {
|
||||
setSearching(false);
|
||||
@@ -579,55 +599,65 @@ export function App() {
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="control control-icon rail-search-open"
|
||||
className={cx(
|
||||
control({ shape: "icon" }),
|
||||
"group-data-searching/rail:hidden sm:hidden",
|
||||
)}
|
||||
aria-label="search"
|
||||
onClick={openSearch}
|
||||
>
|
||||
<Icon name="search" />
|
||||
</button>
|
||||
<span className="readout dim rail-version" data-testid="version">
|
||||
<span className="readout dim hidden text-xs lg:inline" data-testid="version">
|
||||
{version}
|
||||
</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<nav className="tabbar" aria-label="destinations">
|
||||
<NavLink destination="library" current={destination} className="tab" href="/" onGo={go}>
|
||||
<nav
|
||||
className="fixed inset-x-0 bottom-0 z-20 grid grid-cols-4 h-(--tabbar-space) pb-(--safe-bottom) bg-panel border-t border-t-line sm:hidden"
|
||||
aria-label="destinations"
|
||||
>
|
||||
<NavLink destination="library" current={destination} className={TAB} href="/" onGo={go}>
|
||||
<TabGlyph name="library" />
|
||||
<span className="tab-label">library</span>
|
||||
<span>library</span>
|
||||
</NavLink>
|
||||
<NavLink
|
||||
destination="search"
|
||||
current={destination}
|
||||
className="tab"
|
||||
className={TAB}
|
||||
href="/search"
|
||||
onGo={go}
|
||||
>
|
||||
<TabGlyph name="search" />
|
||||
<span className="tab-label">search</span>
|
||||
<span>search</span>
|
||||
</NavLink>
|
||||
<NavLink
|
||||
destination="queues"
|
||||
current={destination}
|
||||
className="tab"
|
||||
className={TAB}
|
||||
href="/queues"
|
||||
onGo={go}
|
||||
>
|
||||
<TabGlyph name="warning" />
|
||||
<span className="tab-label">queues</span>
|
||||
<span className="tab-badge readout" data-role="queues-count" hidden={badge === null}>
|
||||
<span>queues</span>
|
||||
<span
|
||||
className="readout absolute top-1 left-11/20 min-w-badge h-badge py-0 px-1 rounded-pill text-2xs font-bold leading-(--spacing-badge) text-center text-ground bg-signal-warn"
|
||||
data-role="queues-count"
|
||||
hidden={badge === null}
|
||||
>
|
||||
{badge ?? ""}
|
||||
</span>
|
||||
</NavLink>
|
||||
<NavLink
|
||||
destination="settings"
|
||||
current={destination}
|
||||
className="tab"
|
||||
className={TAB}
|
||||
href="/settings"
|
||||
onGo={go}
|
||||
>
|
||||
<TabGlyph name="cog" />
|
||||
<span className="tab-label">settings</span>
|
||||
<span>settings</span>
|
||||
</NavLink>
|
||||
</nav>
|
||||
|
||||
|
||||
+64
-36
@@ -2,6 +2,7 @@
|
||||
// and rejected collapsed to counts. Shared by the movie page and the tv deck.
|
||||
|
||||
import { Fragment, type ReactNode, useEffect, useRef, useState } from "react";
|
||||
import { CELLS, cx, ROW_RULE, score } from "./look";
|
||||
import {
|
||||
blacklistAdvice,
|
||||
blacklistClass,
|
||||
@@ -19,7 +20,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";
|
||||
|
||||
@@ -93,7 +105,7 @@ function Paged<T>({
|
||||
<Fragment key={keyOf(item)}>{render(item)}</Fragment>
|
||||
))}
|
||||
{rest > 0 && (
|
||||
<li className="bucket-more">
|
||||
<li className="pt-3">
|
||||
<Control
|
||||
text={`show ${rest} more`}
|
||||
quiet
|
||||
@@ -106,18 +118,26 @@ function Paged<T>({
|
||||
);
|
||||
}
|
||||
|
||||
const COLHEAD_LABEL = "font-readout text-2xs uppercase tracking-title text-ink-faint";
|
||||
|
||||
/** The column header the release cells line up under, from 46rem. */
|
||||
function Colhead() {
|
||||
return (
|
||||
<div className="colhead" aria-hidden="true">
|
||||
<span className="colhead-score">score</span>
|
||||
<span className="colhead-cells">
|
||||
<span>res</span>
|
||||
<span>source</span>
|
||||
<span className="num">size</span>
|
||||
<span>hdr</span>
|
||||
<span>audio</span>
|
||||
<span className="num">seed</span>
|
||||
<div
|
||||
className={cx(
|
||||
"hidden @cells:grid [grid-template-columns:var(--control-h)_minmax(0,1fr)_var(--word-w)] gap-x-3 pt-2 pb-1",
|
||||
ROW_RULE,
|
||||
)}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span className={COLHEAD_LABEL}>score</span>
|
||||
<span className={cx("col-start-2 grid", CELLS)}>
|
||||
<span className={COLHEAD_LABEL}>res</span>
|
||||
<span className={COLHEAD_LABEL}>source</span>
|
||||
<span className={cx(COLHEAD_LABEL, "text-right")}>size</span>
|
||||
<span className={COLHEAD_LABEL}>hdr</span>
|
||||
<span className={COLHEAD_LABEL}>audio</span>
|
||||
<span className={cx(COLHEAD_LABEL, "text-right")}>seed</span>
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
@@ -138,13 +158,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 +177,9 @@ function CollapsedBucket({
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</ul>
|
||||
</Rows>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -170,18 +190,18 @@ function CollapsedBucket({
|
||||
export function Buckets({ state, actions }: { state: DeckState; actions: ReleaseActions }) {
|
||||
if (state.kind !== "releases") {
|
||||
return (
|
||||
<div className="buckets">
|
||||
<section className="deck-group" hidden={state.kind === "none"}>
|
||||
<div className="@container">
|
||||
<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>
|
||||
);
|
||||
}
|
||||
@@ -205,11 +225,11 @@ function PaintedBuckets({
|
||||
// forcing; a row below policy is offered already.
|
||||
const forceable = rejected.filter(overridable).length;
|
||||
return (
|
||||
<div className="buckets">
|
||||
<section className="deck-group">
|
||||
<div className="@container">
|
||||
<Section>
|
||||
<DeckHead as="h4" label="eligible" count={eligible.length} />
|
||||
<Colhead />
|
||||
<ul className="deck-rows">
|
||||
<Rows>
|
||||
{eligible.length === 0 ? (
|
||||
<EmptyRow
|
||||
text={
|
||||
@@ -232,8 +252,8 @@ function PaintedBuckets({
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</ul>
|
||||
</section>
|
||||
</Rows>
|
||||
</Section>
|
||||
<CollapsedBucket
|
||||
label="below policy"
|
||||
releases={waived}
|
||||
@@ -361,7 +381,7 @@ function ReleaseRow({
|
||||
lead={
|
||||
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: the score's name is read with its row, not as a control
|
||||
<span
|
||||
className="score"
|
||||
className={score(stop)}
|
||||
data-score={stop === null ? undefined : String(stop)}
|
||||
aria-label={`score ${formatScore(release.score)}`}
|
||||
>
|
||||
@@ -384,7 +404,7 @@ function ReleaseRow({
|
||||
</>
|
||||
}
|
||||
beforeSub={
|
||||
<div className="r-cells" aria-hidden="true">
|
||||
<div className={cx("hidden @cells:grid", CELLS)} aria-hidden="true">
|
||||
{(
|
||||
[
|
||||
[values.res, false],
|
||||
@@ -400,11 +420,11 @@ function ReleaseRow({
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: see above
|
||||
key={index}
|
||||
title={value}
|
||||
className={
|
||||
[numeric ? "num" : "", value === "—" ? "unclaimed" : ""]
|
||||
.filter(Boolean)
|
||||
.join(" ") || undefined
|
||||
}
|
||||
className={cx(
|
||||
"truncate font-readout text-xs tabular-nums",
|
||||
numeric && "text-right",
|
||||
value === "—" ? "text-ink-faint" : "text-ink-muted",
|
||||
)}
|
||||
>
|
||||
{value}
|
||||
</span>
|
||||
@@ -415,7 +435,15 @@ function ReleaseRow({
|
||||
subExpands
|
||||
afterSub={
|
||||
blacklisted && (
|
||||
<span className="r-why readout" data-blacklist={blacklisted}>
|
||||
<span
|
||||
className={cx(
|
||||
"readout text-xs",
|
||||
blacklisted === "release"
|
||||
? "[color:oklch(from_var(--signal-fault)_0.78_0.1_h)]"
|
||||
: "text-ink-muted",
|
||||
)}
|
||||
data-blacklist={blacklisted}
|
||||
>
|
||||
{blacklistAdvice(release.blacklist_reason)}
|
||||
</span>
|
||||
)
|
||||
|
||||
+7
-2336
File diff suppressed because it is too large
Load Diff
+42
-23
@@ -3,6 +3,11 @@
|
||||
|
||||
import { type CSSProperties, type ReactNode, useEffect, useRef, useState } from "react";
|
||||
import { Icon, ProviderMark, Star } from "./icons";
|
||||
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";
|
||||
@@ -61,18 +66,19 @@ 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} />
|
||||
<h2 className="page-title" tabIndex={-1} ref={heading}>
|
||||
<header className={page.pageHead}>
|
||||
<IconControl glyph="back" label="back" look="bare" onClick={onBack} />
|
||||
<h2 className={cx(type.pageTitle, "flex-initial")} tabIndex={-1} ref={heading}>
|
||||
{title === "" ? " " : title}
|
||||
</h2>
|
||||
<span className="page-year readout">{year === null ? "" : year}</span>
|
||||
<span className={page.pageMeta}>{year === null ? "" : year}</span>
|
||||
</header>
|
||||
<div className="hero-body">
|
||||
<div className="hero-poster">
|
||||
<div className="grid [grid-template-columns:6rem_minmax(0,1fr)] gap-4 [align-items:start] @row:[grid-template-columns:9rem_minmax(0,1fr)] @row:gap-6 @wide:[grid-template-columns:10.5rem_minmax(0,1fr)]">
|
||||
<div className="aspect-2/3 bg-panel-raised border border-line-strong rounded-panel overflow-hidden">
|
||||
<img
|
||||
className="movie-poster"
|
||||
className="block w-full h-full object-cover opacity-0 [transition:opacity_300ms_var(--ease-out)] data-loaded:opacity-100"
|
||||
alt={posterUrl === null || posterBroken ? "" : `${title} poster`}
|
||||
src={posterUrl === null || posterBroken ? undefined : posterUrl}
|
||||
data-loaded={flag(posterLoaded && !posterBroken)}
|
||||
@@ -80,9 +86,9 @@ export function Hero({
|
||||
onError={() => setPosterBroken(true)}
|
||||
/>
|
||||
</div>
|
||||
<div className="hero-info">
|
||||
<span className="hero-chips">{chips}</span>
|
||||
<p className="hero-rating readout">
|
||||
<div className="grid gap-2 content-start min-w-0">
|
||||
<span className="flex flex-wrap gap-1 min-h-chip-h">{chips}</span>
|
||||
<p className={cx(HERO_LINE, "text-ink")}>
|
||||
{detail !== null && detail.vote_average !== null && (
|
||||
<>
|
||||
<Star />
|
||||
@@ -91,15 +97,15 @@ export function Hero({
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
<p className="hero-meta readout">
|
||||
<p className={cx(HERO_LINE, "text-ink-muted")}>
|
||||
{detail === null ? "" : formatMetaLine(detail.runtime, detail.genres)}
|
||||
</p>
|
||||
<p className="hero-tagline">
|
||||
<p className="hidden @row:block m-0 font-display text-md font-semibold text-ink-muted">
|
||||
{tagline !== null && tagline !== undefined && tagline !== "" ? `“${tagline}”` : ""}
|
||||
</p>
|
||||
{/* biome-ignore lint/a11y/useKeyWithClickEvents: a reading aid; the full text is in the DOM either way */}
|
||||
<p
|
||||
className="hero-overview"
|
||||
className="line-clamp-3 min-h-overview max-w-measure m-0 text-sm text-ink cursor-pointer data-full:[-webkit-line-clamp:unset]"
|
||||
data-full={flag(overviewFull)}
|
||||
onClick={() => setOverviewFull(!overviewFull)}
|
||||
>
|
||||
@@ -107,7 +113,7 @@ export function Hero({
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<NoteLine note={note} className="r-note hero-note readout" />
|
||||
<NoteLine note={note} className={cx(NOTE, "mt-2")} />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -115,9 +121,9 @@ export function Hero({
|
||||
/** The trailer: the play glyph, and the word wherever there is room for it. */
|
||||
export function TrailerLink({ href, title }: { href: string; title: string }) {
|
||||
return (
|
||||
<IconLink className="trailer-link" label={`watch the ${title} trailer`} href={href}>
|
||||
<IconLink shape="trailer" label={`watch the ${title} trailer`} href={href}>
|
||||
<Icon name="play" />
|
||||
<span className="control-word">trailer</span>
|
||||
<span className="hidden @row:inline">trailer</span>
|
||||
</IconLink>
|
||||
);
|
||||
}
|
||||
@@ -244,29 +250,42 @@ 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
|
||||
<div
|
||||
className="remove-body"
|
||||
className={cx(
|
||||
"grid gap-2 p-3 bg-panel-raised border rounded-panel",
|
||||
hasFiles ? "[border-color:oklch(from_var(--signal-warn)_l_c_h/55%)]" : "border-line",
|
||||
)}
|
||||
role="group"
|
||||
aria-label={`remove ${subject.title}`}
|
||||
data-armed={String(hasFiles)}
|
||||
>
|
||||
<p className="remove-evidence readout dim">{evidence}</p>
|
||||
<p className="remove-path readout" hidden={path === null}>
|
||||
<p className="readout dim m-0 text-xs">{evidence}</p>
|
||||
<p
|
||||
className="readout m-0 text-xs text-ink-muted [overflow-wrap:anywhere] whitespace-pre-line"
|
||||
hidden={path === null}
|
||||
>
|
||||
{path ?? ""}
|
||||
</p>
|
||||
<p className="remove-note readout" id="remove-note" role="status" data-tone={note.tone}>
|
||||
<p
|
||||
className="readout m-0 text-xs text-ink-muted data-[tone=warn]:text-signal-warn data-[tone=fault]:text-signal-fault"
|
||||
id="remove-note"
|
||||
role="status"
|
||||
data-tone={note.tone}
|
||||
>
|
||||
{note.text}
|
||||
</p>
|
||||
<div className="remove-actions">
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{/* armed: the confirm turns caution amber with the rest of the panel */}
|
||||
<button
|
||||
type="button"
|
||||
className="control"
|
||||
className={control({ state: hasFiles ? "warn" : null })}
|
||||
data-tone={hasFiles ? "warn" : undefined}
|
||||
aria-describedby="remove-note"
|
||||
disabled={busy}
|
||||
onClick={confirm}
|
||||
>
|
||||
remove and delete files
|
||||
</button>
|
||||
<button type="button" className="control" ref={keep} disabled={busy} onClick={onCancel}>
|
||||
<button type="button" className={control()} ref={keep} disabled={busy} onClick={onCancel}>
|
||||
keep
|
||||
</button>
|
||||
</div>
|
||||
|
||||
+18
-5
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { control, microControl } from "./look";
|
||||
|
||||
// The shared icon-only control block (#230), consumed by the title pages,
|
||||
// decks and readouts, the settings rows (#231) and the subtitle chips and
|
||||
@@ -64,9 +65,14 @@ const ICON_PATHS = {
|
||||
export type IconName = keyof typeof ICON_PATHS;
|
||||
|
||||
/** Stroke glyph on the shared 16-grid; the control's aria-label carries the meaning. */
|
||||
export function Icon({ name }: { name: IconName }) {
|
||||
export function Icon({ name, className }: { name: IconName; className?: string }) {
|
||||
return (
|
||||
<svg viewBox="0 0 16 16" className="icon" aria-hidden="true" data-icon={name}>
|
||||
<svg
|
||||
viewBox="0 0 16 16"
|
||||
className={className === undefined ? "icon" : `icon ${className}`}
|
||||
aria-hidden="true"
|
||||
data-icon={name}
|
||||
>
|
||||
{ICON_PATHS[name].map((d) => (
|
||||
<path key={d} d={d} />
|
||||
))}
|
||||
@@ -99,7 +105,7 @@ export function ProviderMark({ name }: { name: "tmdb" | "tvdb" | "imdb" | "rt" }
|
||||
/** The drawn star before a TMDB rating — no glyph standing in for an icon. */
|
||||
export function Star() {
|
||||
return (
|
||||
<svg viewBox="0 0 12 12" className="star" aria-hidden="true">
|
||||
<svg viewBox="0 0 12 12" className="size-lamp flex-none fill-ink" aria-hidden="true">
|
||||
<path d="M6 0.8 L7.5 4.2 L11.2 4.6 L8.4 7.1 L9.2 10.8 L6 8.9 L2.8 10.8 L3.6 7.1 L0.8 4.6 L4.5 4.2 Z" />
|
||||
</svg>
|
||||
);
|
||||
@@ -186,7 +192,11 @@ export function ArmedDeleteIcon({
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={compact ? "control-micro" : "control control-icon"}
|
||||
className={
|
||||
compact
|
||||
? microControl(armed)
|
||||
: control({ shape: "icon", danger: true, state: armed ? "armed" : null })
|
||||
}
|
||||
data-kind="delete"
|
||||
data-armed={armed ? "true" : undefined}
|
||||
aria-label={armed ? `confirm — ${label}` : label}
|
||||
@@ -202,7 +212,10 @@ export function ArmedDeleteIcon({
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon name={armed ? "check" : "trash"} />
|
||||
<Icon
|
||||
name={armed ? "check" : "trash"}
|
||||
className={compact ? "size-3 [stroke-width:1.7]" : undefined}
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
+372
@@ -0,0 +1,372 @@
|
||||
// The control vocabulary as Tailwind class lists. Each builder takes the
|
||||
// control's whole state and returns one list with no two classes fighting
|
||||
// over a property: Tailwind orders its output by variant, not by the order
|
||||
// classes are written, so a conflict here would be settled by accident.
|
||||
|
||||
export function cx(...names: (string | false | null | undefined)[]): string {
|
||||
return names.filter(Boolean).join(" ");
|
||||
}
|
||||
|
||||
const TRANSITION =
|
||||
"[transition:border-color_150ms_var(--ease-out),color_150ms_var(--ease-out),background_150ms_var(--ease-out)]";
|
||||
|
||||
export interface ControlLook {
|
||||
/**
|
||||
* primary: cyan word on a raised plate, one per header or panel.
|
||||
* quiet: secondary actions — cancel, add, back, retry. Never a toggle.
|
||||
* bare: no plate, for a page head's back control.
|
||||
* lead: a row's leading disclosure, muted.
|
||||
* faint: a chip-sized info glyph beside a group's note.
|
||||
*/
|
||||
look?: "primary" | "quiet" | "bare" | "lead" | "faint";
|
||||
/**
|
||||
* word: a label. fixed: a label that changes but keeps one width.
|
||||
* icon: a square glyph. trailer: a glyph that grows its word from 40rem.
|
||||
* disclose: show / hide, chevron at the far end. chip: a glyph at chip height.
|
||||
*/
|
||||
shape?: "word" | "fixed" | "icon" | "trailer" | "disclose" | "chip";
|
||||
/** Full width with the content at the start: a phone tray or a settings panel. */
|
||||
fill?: boolean;
|
||||
/** Destructive: rests red so delete never reads like the glyph beside it. */
|
||||
danger?: boolean;
|
||||
/**
|
||||
* armed: the next tap fires — amber, whatever else it was (`data-armed`).
|
||||
* warn: the confirm of a removal that deletes files (`data-tone="warn"`).
|
||||
* busy, done and failed need no look: `data-busy` and friends carry them.
|
||||
*/
|
||||
state?: "armed" | "warn" | null;
|
||||
}
|
||||
|
||||
const SHAPE = {
|
||||
word: "min-h-control-h py-0 px-4",
|
||||
fixed: "min-h-control-h py-0 px-4 min-w-word-w",
|
||||
icon: "min-h-control-h w-control-h min-w-control-h p-0",
|
||||
trailer: "min-h-control-h w-control-h min-w-control-h p-0 @row:w-auto @row:px-4",
|
||||
disclose: "min-h-control-h py-0 px-4 min-w-disclose",
|
||||
chip: "min-h-chip-h size-chip-h min-w-chip-h p-0",
|
||||
} as const;
|
||||
|
||||
const LOOK = {
|
||||
primary:
|
||||
"text-accent bg-panel-raised border-line-strong [box-shadow:inset_0_1px_var(--highlight)]",
|
||||
quiet: "text-ink bg-transparent border-line [box-shadow:none]",
|
||||
bare: "text-accent bg-transparent border-transparent [box-shadow:none] flex-none",
|
||||
lead: "text-ink-muted bg-transparent border-line [box-shadow:none]",
|
||||
faint: "text-ink-faint bg-transparent border-transparent [box-shadow:none]",
|
||||
} as const;
|
||||
|
||||
/** The class list for a control in one state. */
|
||||
export function control({
|
||||
look = "primary",
|
||||
shape = "word",
|
||||
fill = false,
|
||||
danger = false,
|
||||
state = null,
|
||||
}: ControlLook = {}): string {
|
||||
let tone: string;
|
||||
if (state === "armed") {
|
||||
tone =
|
||||
"data-[armed=true]:not-disabled:text-ground data-[armed=true]:not-disabled:bg-signal-warn data-[armed=true]:not-disabled:border-signal-warn" +
|
||||
// armed from the keyboard, the delete's red focus still shows on the amber
|
||||
" data-[armed=true]:not-disabled:focus-visible:not-hover:text-signal-fault data-[armed=true]:not-disabled:focus-visible:not-hover:border-signal-fault";
|
||||
} else if (state === "warn") {
|
||||
tone =
|
||||
"data-[tone=warn]:not-disabled:text-signal-warn data-[tone=warn]:not-disabled:[border-color:oklch(from_var(--signal-warn)_l_c_h/55%)]";
|
||||
} else if (danger) {
|
||||
tone =
|
||||
"data-[kind=delete]:not-disabled:text-signal-fault data-[kind=delete]:not-disabled:hover:border-signal-fault data-[kind=delete]:not-disabled:focus-visible:border-signal-fault";
|
||||
} else {
|
||||
tone = cx(
|
||||
"not-disabled:hover:border-accent not-disabled:hover:text-accent-bright",
|
||||
// a row's lead disclosure keeps its muted plate open or closed
|
||||
look !== "lead" && "aria-expanded:border-accent aria-expanded:text-accent-bright",
|
||||
);
|
||||
}
|
||||
return cx(
|
||||
"inline-flex items-center gap-2 font-readout text-xs font-semibold tabular-nums leading-none uppercase tracking-label whitespace-nowrap no-underline border rounded-panel",
|
||||
fill ? "w-full justify-start" : shape === "disclose" ? "justify-between" : "justify-center",
|
||||
SHAPE[shape],
|
||||
LOOK[look],
|
||||
TRANSITION,
|
||||
"cursor-pointer disabled:text-ink-faint disabled:border-line disabled:cursor-default",
|
||||
"not-disabled:active:[box-shadow:inset_0_1px_var(--lowlight)]",
|
||||
// a request's outcome, read off the control's own data attributes
|
||||
"data-busy:border-dashed data-busy:text-ink-faint data-busy:cursor-progress",
|
||||
"data-done:text-signal-ok data-done:[border-color:oklch(from_var(--signal-ok)_l_c_h/55%)]",
|
||||
"data-failed:not-hover:text-signal-fault data-failed:not-hover:[border-color:oklch(from_var(--signal-fault)_l_c_h/55%)]",
|
||||
tone,
|
||||
);
|
||||
}
|
||||
|
||||
/** The chip-scale delete (#251): no plate, the armed glyph does the word's job. */
|
||||
export function microControl(armed: boolean): string {
|
||||
return cx(
|
||||
"inline-flex items-center justify-center size-4 p-0 ms-1 [border:0] rounded-micro cursor-pointer disabled:opacity-50",
|
||||
armed
|
||||
? "text-ground bg-signal-warn"
|
||||
: "text-ink-faint bg-transparent not-disabled:hover:text-signal-fault not-disabled:hover:[background:oklch(from_var(--signal-fault)_l_c_h/15%)] focus-visible:text-signal-fault focus-visible:[background:oklch(from_var(--signal-fault)_l_c_h/15%)]",
|
||||
);
|
||||
}
|
||||
|
||||
/** A rule that is on or off; `fill` stretches it across a tray. */
|
||||
export function toggle(pressed: boolean, fill = false): string {
|
||||
return cx(
|
||||
"inline-flex items-center gap-2 min-h-control-h py-0 px-3 font-readout text-xs font-semibold leading-none uppercase tracking-label whitespace-nowrap bg-transparent border rounded-panel cursor-pointer [transition:border-color_150ms_var(--ease-out),color_150ms_var(--ease-out)] not-disabled:hover:border-accent disabled:cursor-progress disabled:opacity-60",
|
||||
pressed ? "text-ink border-line-strong" : "text-ink-muted border-line",
|
||||
fill && "w-full justify-start",
|
||||
);
|
||||
}
|
||||
|
||||
export function toggleLamp(pressed: boolean): string {
|
||||
return cx(
|
||||
"w-2 h-2 flex-none rounded-round [transition:background_300ms_var(--ease-out),box-shadow_300ms_var(--ease-out)]",
|
||||
pressed ? "bg-accent [box-shadow:0_0_6px_oklch(from_var(--accent)_l_c_h/60%)]" : "bg-lamp-off",
|
||||
);
|
||||
}
|
||||
|
||||
export function toggleState(pressed: boolean): string {
|
||||
return cx("min-w-state ml-auto text-left", pressed ? "text-accent" : "text-ink-faint");
|
||||
}
|
||||
|
||||
/** One choice of a few, the engaged side lit; `wrap` lets a long set break lines. */
|
||||
export function segmented(wrap = false): string {
|
||||
return wrap
|
||||
? "flex flex-wrap flex-none gap-1 min-w-0 m-0 p-0 [border:0]"
|
||||
: "inline-flex flex-none min-w-0 m-0 p-0 [border:0]";
|
||||
}
|
||||
|
||||
export function seg(pressed: boolean, icon = false): string {
|
||||
return cx(
|
||||
"inline-flex items-center justify-center gap-2 min-h-control-h font-readout text-xs font-semibold uppercase tracking-label border border-line cursor-pointer [transition:border-color_150ms_var(--ease-out),color_150ms_var(--ease-out)] first:rounded-l-panel last:rounded-r-panel not-first:border-l-0 hover:text-accent-bright",
|
||||
icon ? "w-control-h p-0" : "py-0 px-3",
|
||||
// the lit edge is drawn inside, so the joined borders never double
|
||||
pressed
|
||||
? "text-accent-bright bg-panel-raised [box-shadow:inset_0_0_0_1px_var(--accent)]"
|
||||
: "text-ink-muted bg-transparent",
|
||||
);
|
||||
}
|
||||
|
||||
/* ---- type roles ---------------------------------------------------------- */
|
||||
|
||||
/** One role per job: page title, section title, group label, count. */
|
||||
export const type = {
|
||||
pageTitle:
|
||||
"page-title m-0 min-w-0 font-display text-lg @row:text-xl font-bold tracking-title leading-tight overflow-hidden whitespace-nowrap text-ellipsis",
|
||||
sectionTitle:
|
||||
"m-0 font-display text-md font-semibold tracking-label uppercase leading-snug text-ink-muted",
|
||||
/** The engraved micro-label: a group inside a section, never a kicker. */
|
||||
label: "m-0 text-2xs font-semibold uppercase tracking-engraved",
|
||||
count: "readout text-xs text-ink-faint",
|
||||
} as const;
|
||||
|
||||
/* ---- chips --------------------------------------------------------------- */
|
||||
|
||||
/** What a chip says about itself, as the data attributes it carries. */
|
||||
export interface ChipState {
|
||||
verdict?: string;
|
||||
blacklist?: string;
|
||||
movieState?: string;
|
||||
wanted?: string;
|
||||
dlPhase?: string;
|
||||
status?: string;
|
||||
counts?: string;
|
||||
flag?: string;
|
||||
mt?: string;
|
||||
tone?: string;
|
||||
/** Hidden below 40rem: the phone's line keeps only what decides. */
|
||||
secondary?: boolean;
|
||||
/** Taps to explain itself, or opens a panel. */
|
||||
interactive?: boolean;
|
||||
/** Taps to explain itself: its edge lights while hovered or open. */
|
||||
explain?: boolean;
|
||||
/** The whole label is a glyph. */
|
||||
glyph?: boolean;
|
||||
/** A live download: fixed width, so 9% → 10% never moves a neighbour. */
|
||||
download?: boolean;
|
||||
/** A release attribute: from 46rem the aligned cells carry it instead. */
|
||||
cell?: boolean;
|
||||
}
|
||||
|
||||
const OK = "text-signal-ok [border-color:oklch(from_var(--signal-ok)_l_c_h/45%)]";
|
||||
const AIRING = "text-status-airing [border-color:oklch(from_var(--status-airing)_l_c_h/45%)]";
|
||||
const WARN = "text-signal-warn [border-color:oklch(from_var(--signal-warn)_l_c_h/55%)]";
|
||||
const FAULT = "text-signal-fault [border-color:oklch(from_var(--signal-fault)_l_c_h/55%)]";
|
||||
const ON_IT = "text-ink border-line-strong";
|
||||
|
||||
/**
|
||||
* The chip's colour: the last of these that applies wins, in the order the
|
||||
* board always resolved them — a verdict, then a blacklist, media state,
|
||||
* download phase, library status, counts, a vanished flag, and a fault.
|
||||
*/
|
||||
function chipTone(state: ChipState): string {
|
||||
let tone = "text-ink-muted border-line";
|
||||
const verdict = {
|
||||
eligible: "text-verdict-eligible [border-color:oklch(from_var(--verdict-eligible)_l_c_h/45%)]",
|
||||
// the dashed border is the visible mark of a relaxed rule
|
||||
waived: "text-verdict-waived [border-color:oklch(from_var(--verdict-waived)_l_c_h/55%)]",
|
||||
rejected: "text-verdict-rejected border-line",
|
||||
// a subtitle wanted and not yet on disk is the system's errand, not yours
|
||||
wanted: ON_IT,
|
||||
}[state.verdict ?? ""];
|
||||
if (verdict) tone = verdict;
|
||||
// #227: the policy's own floor (amber, act on it) or the release itself broken
|
||||
if (state.blacklist === "policy") tone = WARN;
|
||||
if (state.blacklist === "release") tone = FAULT;
|
||||
// §4.2: green on disk, violet downloading; wanted-and-missing is the system's
|
||||
if (state.movieState === "available") tone = OK;
|
||||
if (state.movieState === "downloading") tone = AIRING;
|
||||
const dl = { downloading: AIRING, stalled: WARN, errored: FAULT, seeding: OK }[
|
||||
state.download ? (state.dlPhase ?? "") : ""
|
||||
];
|
||||
if (dl) tone = dl;
|
||||
// violet while live, green once complete; incomplete and waiting are neutral
|
||||
if (state.status === "airing") tone = AIRING;
|
||||
if (state.status === "incomplete") tone = ON_IT;
|
||||
if (state.status === "complete" || state.status === "ended" || state.counts === "complete") {
|
||||
tone = OK;
|
||||
}
|
||||
if (state.counts === "partial") tone = "text-ink border-line";
|
||||
// issue 122: gone upstream while its file remained — a conflict
|
||||
if (state.flag === "vanished") tone = WARN;
|
||||
if (state.tone === "fault") tone = FAULT;
|
||||
if (state.movieState === "missing" && state.wanted === "true") tone = ON_IT;
|
||||
return tone;
|
||||
}
|
||||
|
||||
/** A label, not a target: shorter than a control, one line always. */
|
||||
export function chip(state: ChipState = {}): string {
|
||||
const dashed = state.verdict === "waived" || state.flag === "vanished" || state.mt === "true";
|
||||
return cx(
|
||||
"flex-none items-center gap-1 h-chip-h bg-panel-raised border rounded-chip font-readout text-2xs whitespace-nowrap",
|
||||
state.secondary ? "hidden @row:inline-flex" : "inline-flex",
|
||||
state.cell && "@cells:hidden",
|
||||
state.glyph ? "min-w-chip-h justify-center py-0 px-1" : "py-0 px-2",
|
||||
state.download && "min-w-dl justify-center",
|
||||
// a chip that explains itself on tap: §9.6 tooltips have no touch
|
||||
state.interactive
|
||||
? // a button's font is the page's, then the chip's face and size on top
|
||||
"[font-style:inherit] [font-weight:inherit] [font-stretch:inherit] [font-variant:inherit] [line-height:inherit] cursor-pointer [transition:color_150ms_var(--ease-out),border-color_150ms_var(--ease-out)]"
|
||||
: "leading-none tabular-nums",
|
||||
chipTone(state),
|
||||
dashed && "border-dashed",
|
||||
state.explain &&
|
||||
!(state.movieState === "missing" && state.wanted === "true") &&
|
||||
"hover:border-current aria-expanded:border-current",
|
||||
);
|
||||
}
|
||||
|
||||
/** A glyph inside a chip: smaller, and drawn a touch heavier to hold the size. */
|
||||
export const CHIP_ICON = "size-3 [stroke-width:1.7]";
|
||||
|
||||
/* ---- the row ------------------------------------------------------------- */
|
||||
|
||||
/** A list line's hairline: the line colour, softened. */
|
||||
export const ROW_RULE = "border-b [border-bottom-color:oklch(from_var(--line)_l_c_h/60%)]";
|
||||
|
||||
/** A row's status line, and every note written the same way. */
|
||||
export const NOTE =
|
||||
"readout m-0 text-xs text-ink-muted data-[tone=fault]:text-signal-fault data-[tone=warn]:text-signal-warn";
|
||||
|
||||
/** The secondary line: truncated, and the full string on a tap. */
|
||||
export const SUB =
|
||||
"readout min-w-0 truncate text-2xs leading-row text-ink-faint data-full:whitespace-normal data-full:[overflow-wrap:anywhere]";
|
||||
|
||||
/** Placeholder bars: the row's own geometry, no shimmer (Dead-Air). */
|
||||
export const skel = {
|
||||
lead: "block bg-panel-raised rounded-chip w-poster h-poster-h",
|
||||
line: "block bg-panel-raised rounded-chip w-7/10 h-3",
|
||||
short: "block bg-panel-raised rounded-chip w-2/5 h-3",
|
||||
} as const;
|
||||
|
||||
/** The release's lead, on the list-relative heat scale (issue 111). */
|
||||
const SCORE_TONE = [
|
||||
"text-score-0 [border-color:oklch(from_var(--score-0)_l_c_h/50%)]",
|
||||
"text-score-1 [border-color:oklch(from_var(--score-1)_l_c_h/50%)]",
|
||||
"text-score-2 [border-color:oklch(from_var(--score-2)_l_c_h/50%)]",
|
||||
"text-score-3 [border-color:oklch(from_var(--score-3)_l_c_h/50%)]",
|
||||
"text-score-4 [border-color:oklch(from_var(--score-4)_l_c_h/50%)]",
|
||||
"text-score-5 [border-color:oklch(from_var(--score-5)_l_c_h/50%)]",
|
||||
"text-score-6 [border-color:oklch(from_var(--score-6)_l_c_h/50%)]",
|
||||
] as const;
|
||||
|
||||
export function score(stop: number | null): string {
|
||||
return cx(
|
||||
"inline-grid place-items-center size-control-h font-readout text-sm font-bold tabular-nums border rounded-panel",
|
||||
stop === null ? "text-ink-muted border-line" : SCORE_TONE[stop],
|
||||
);
|
||||
}
|
||||
|
||||
/** The §9.3 fixed columns release attributes line up in, from 46rem. */
|
||||
export const CELLS = "[grid-template-columns:4rem_4.5rem_4.5rem_6rem_7rem_3.5rem] gap-4";
|
||||
|
||||
/* ---- panels -------------------------------------------------------------- */
|
||||
|
||||
/** An inline panel: the add flow, an edit form, the subtitle settings. */
|
||||
export const PANEL =
|
||||
"grid gap-3 p-3 bg-panel border border-line rounded-panel [box-shadow:inset_0_1px_var(--highlight)]";
|
||||
|
||||
/** A panel's save line: the controls, then what happened. */
|
||||
export const PANEL_ACTIONS = "flex flex-wrap items-center gap-3";
|
||||
|
||||
/** A panel's note, green once the thing it describes is done. */
|
||||
export const PANEL_NOTE =
|
||||
"m-0 text-xs text-ink-muted data-[tone=fault]:text-signal-fault data-[tone=ok]:text-signal-ok";
|
||||
|
||||
/* ---- poster grid --------------------------------------------------------- */
|
||||
|
||||
export const card = {
|
||||
grid: "grid [grid-template-columns:repeat(auto-fill,minmax(9rem,1fr))] gap-3 pt-3 px-0 pb-0",
|
||||
card: "flex flex-col w-full h-full p-0 [font:inherit] text-left text-inherit bg-panel border border-line rounded-panel overflow-hidden cursor-pointer [transition:border-color_150ms_var(--ease-out)] hover:border-accent",
|
||||
art: "block aspect-2/3 bg-panel-raised",
|
||||
poster: "block w-full h-full object-cover",
|
||||
/** Same ratio as a poster, carrying the title: the grid never has a hole. */
|
||||
blank: "flex items-center justify-center w-full h-full p-3",
|
||||
blankTitle: "font-display text-base font-semibold text-center text-ink-faint",
|
||||
body: "grid gap-1 p-2",
|
||||
name: "truncate text-sm font-semibold text-ink",
|
||||
chips: "flex gap-1 min-h-chip-h overflow-hidden",
|
||||
} as const;
|
||||
|
||||
/* ---- detail pages -------------------------------------------------------- */
|
||||
|
||||
export const detail = {
|
||||
pageHead: "flex items-center gap-2 min-h-control-h mb-3",
|
||||
pageMeta: "readout flex-none text-xs text-ink-muted",
|
||||
/** one action bar: the primary word, the links as glyphs, the rest behind ⋯ */
|
||||
actionbar: "flex items-center gap-2 min-h-control-h mb-3",
|
||||
actionbarLinks: "flex flex-1 items-center gap-2 min-w-0",
|
||||
morePanel:
|
||||
"grid gap-3 mb-4 p-3 bg-panel border border-line rounded-panel [box-shadow:inset_0_1px_var(--highlight)] @row:grid-cols-2 @row:[align-items:end]",
|
||||
moreLinks: "flex flex-wrap gap-2 empty:hidden @row:col-span-full",
|
||||
moreToggles: "grid gap-2 @row:grid-cols-2 @row:col-span-full",
|
||||
controlNote: "readout m-0 text-xs text-ink-muted @row:col-span-full",
|
||||
} as const;
|
||||
|
||||
/* ---- forms --------------------------------------------------------------- */
|
||||
|
||||
const INPUT =
|
||||
"min-h-control-h py-0 px-3 font-readout text-base sm:text-sm text-ink bg-ground border border-line rounded-panel [box-shadow:inset_0_1px_var(--lowlight)] caret-accent [transition:border-color_150ms_var(--ease-out)] hover:border-line-strong focus:border-accent focus:outline-none disabled:text-ink-faint disabled:border-line data-invalid:border-signal-fault";
|
||||
|
||||
export const form = {
|
||||
grid: "grid [grid-template-columns:repeat(auto-fit,minmax(13rem,1fr))] gap-3 [align-items:end]",
|
||||
field: "grid gap-1",
|
||||
label: "text-2xs font-semibold uppercase tracking-engraved text-ink-muted",
|
||||
input: `w-full ${INPUT}`,
|
||||
/** An input that brings its own width and flex, such as a band's number. */
|
||||
inputBare: INPUT,
|
||||
/** A select draws its own chevron: appearance is gone, so the shape returns. */
|
||||
select:
|
||||
"appearance-none pr-8 bg-no-repeat [background-size:0.3rem_0.3rem] [background-position:calc(100%_-_1.1rem)_50%,calc(100%_-_0.8rem)_50%] [background-image:linear-gradient(45deg,transparent_50%,var(--ink-muted)_50%),linear-gradient(135deg,var(--ink-muted)_50%,transparent_50%)]",
|
||||
} as const;
|
||||
|
||||
/* ---- the signal chain ---------------------------------------------------- */
|
||||
|
||||
export const chain = {
|
||||
module: "min-w-0 border rounded-panel [box-shadow:inset_0_1px_var(--highlight)] pt-4 px-4 pb-3",
|
||||
head: "flex items-center flex-wrap gap-y-1 gap-x-2",
|
||||
name: "m-0 font-display font-bold uppercase tracking-engraved leading-none",
|
||||
status:
|
||||
"readout ml-auto pl-3 text-ink-muted data-[tone=ok]:text-signal-ok data-[tone=warn]:text-signal-warn data-[tone=fault]:text-signal-fault",
|
||||
role: "mt-2 mx-0 mb-0 text-2xs font-semibold uppercase tracking-engraved text-ink-muted",
|
||||
detail: "readout mt-1 mx-0 mb-0 min-h-detail text-xs text-ink-muted",
|
||||
} as const;
|
||||
+18
-10
@@ -6,6 +6,12 @@ import { useLive } from "./context";
|
||||
import { downloadChipDetail, downloadChipLabel, findDownload } from "./downloads";
|
||||
import { Icon, Star } from "./icons";
|
||||
import { waiverLabel } from "./library";
|
||||
import { CHIP_ICON } from "./look";
|
||||
|
||||
/** A row's lead thumbnail at 2:3; a missing one keeps the same box. */
|
||||
const POSTER =
|
||||
"block w-poster aspect-2/3 flex-none object-cover bg-panel-raised border border-line rounded-chip";
|
||||
|
||||
import { formatRating, formatVoteCount, tmdbImage } from "./movie";
|
||||
import { Chip, type Say } from "./ui";
|
||||
|
||||
@@ -38,7 +44,9 @@ export function TitleText({ title, year }: { title: string; year: number | null
|
||||
return (
|
||||
<span>
|
||||
{title}
|
||||
{year !== null && <span className="yr">{year}</span>}
|
||||
{year !== null && (
|
||||
<span className="ml-2 font-readout text-xs font-normal text-ink-faint">{year}</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -54,7 +62,7 @@ export function MediaStateChip({ state, wanted }: { state: string; wanted: boole
|
||||
// makes the word reachable once the glyph replaced it
|
||||
return (
|
||||
<Chip role="img" aria-label={state} data-movie-state={state} data-wanted={String(wanted)}>
|
||||
<Icon name="check" />
|
||||
<Icon name="check" className={CHIP_ICON} />
|
||||
</Chip>
|
||||
);
|
||||
}
|
||||
@@ -78,13 +86,13 @@ export function WaiverChip({ waiver, say }: { waiver: unknown; say?: Say }) {
|
||||
}
|
||||
return (
|
||||
<Chip
|
||||
base="chip chip-glyph"
|
||||
glyph
|
||||
data-verdict="waived"
|
||||
aria-label={label}
|
||||
role={say ? undefined : "img"}
|
||||
explain={say ? { text: `imported below policy — ${label}`, say, tone: "warn" } : undefined}
|
||||
>
|
||||
<Icon name="warning" />
|
||||
<Icon name="warning" className={CHIP_ICON} />
|
||||
</Chip>
|
||||
);
|
||||
}
|
||||
@@ -109,10 +117,10 @@ export function DownloadChip({
|
||||
const { downloads } = useLive();
|
||||
const download = findDownload(downloads, targetKind, targetId);
|
||||
return (
|
||||
<span className="dl-slot" data-dl-kind={targetKind} data-dl-id={targetId}>
|
||||
<span className="contents" data-dl-kind={targetKind} data-dl-id={targetId}>
|
||||
{download !== null && (
|
||||
<Chip
|
||||
className="dl-chip"
|
||||
download
|
||||
data-dl-phase={download.phase}
|
||||
aria-label={`download ${downloadChipDetail(download)}`}
|
||||
explain={say ? { text: `download ${downloadChipDetail(download)}`, say } : undefined}
|
||||
@@ -148,7 +156,7 @@ export function CountsChip({
|
||||
}) {
|
||||
return (
|
||||
<Chip data-counts={countsTone(available, total)} aria-label={ariaLabel}>
|
||||
{glyph && <Icon name="disk" />}
|
||||
{glyph && <Icon name="disk" className={CHIP_ICON} />}
|
||||
{label}
|
||||
</Chip>
|
||||
);
|
||||
@@ -200,11 +208,11 @@ export function RatingChip({
|
||||
export function RowPoster({ posterPath, title }: { posterPath: string | null; title: string }) {
|
||||
const [broken, setBroken] = useState(false);
|
||||
if (posterPath === null || broken) {
|
||||
return <span className="row-poster-blank" aria-hidden="true" />;
|
||||
return <span className={POSTER} aria-hidden="true" />;
|
||||
}
|
||||
return (
|
||||
<img
|
||||
className="row-poster"
|
||||
className={POSTER}
|
||||
loading="lazy"
|
||||
src={tmdbImage(posterPath, "w92") ?? ""}
|
||||
alt={`${title} poster`}
|
||||
@@ -217,7 +225,7 @@ export function RowPoster({ posterPath, title }: { posterPath: string | null; ti
|
||||
/** The amber lamp that leads every attention-queue row. */
|
||||
export function AttentionLamp() {
|
||||
return (
|
||||
<span className="lead-lamp">
|
||||
<span className="flex w-4 justify-center">
|
||||
<span className="lamp" data-state="warn" aria-hidden="true" />
|
||||
</span>
|
||||
);
|
||||
|
||||
+9
-8
@@ -3,6 +3,7 @@
|
||||
import { type ReactNode, useState } from "react";
|
||||
import type { LibrarySeries } from "./library";
|
||||
import { seriesStatusChipRedundant } from "./library";
|
||||
import { card } from "./look";
|
||||
import { tmdbImage } from "./movie";
|
||||
import {
|
||||
audienceOf,
|
||||
@@ -142,15 +143,15 @@ function LibraryCard({
|
||||
const [broken, setBroken] = useState(false);
|
||||
return (
|
||||
<li>
|
||||
<button type="button" className="card" onClick={(event) => open(event.currentTarget)}>
|
||||
<span className="card-art">
|
||||
<button type="button" className={card.card} onClick={(event) => open(event.currentTarget)}>
|
||||
<span className={card.art}>
|
||||
{posterPath === null || broken ? (
|
||||
<span className="card-blank">
|
||||
<span className="card-blank-title">{title}</span>
|
||||
<span className={card.blank}>
|
||||
<span className={card.blankTitle}>{title}</span>
|
||||
</span>
|
||||
) : (
|
||||
<img
|
||||
className="card-poster"
|
||||
className={card.poster}
|
||||
loading="lazy"
|
||||
src={tmdbImage(posterPath, "w342") ?? ""}
|
||||
alt={`${title} poster`}
|
||||
@@ -159,9 +160,9 @@ function LibraryCard({
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
<span className="card-body">
|
||||
<span className="card-name">{title}</span>
|
||||
<span className="card-chips">{chips}</span>
|
||||
<span className={card.body}>
|
||||
<span className={card.name}>{title}</span>
|
||||
<span className={card.chips}>{chips}</span>
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
|
||||
+71
-1
@@ -13,6 +13,10 @@
|
||||
@import "./components.css" layer(components);
|
||||
@import "tailwindcss/utilities.css" layer(utilities) source(none);
|
||||
|
||||
/* hover as the board always had it: on any pointer, not only where the
|
||||
device reports hover — Tailwind's default would drop the tap feedback */
|
||||
@custom-variant hover (&:hover);
|
||||
|
||||
/* utilities are generated from the app's own source only, never from scripts/ */
|
||||
@source "./";
|
||||
|
||||
@@ -52,6 +56,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 +64,52 @@
|
||||
--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);
|
||||
/* the 2px rule under an active destination */
|
||||
--spacing-rule: 2px;
|
||||
/* a count badge's round */
|
||||
--spacing-badge: 1.1rem;
|
||||
--spacing-disclose: 9rem;
|
||||
/* a toggle's on / off word */
|
||||
--spacing-state: 3ch;
|
||||
/* a download chip: 100% at its widest */
|
||||
--spacing-dl: 7ch;
|
||||
/* a lamp's dot, and the rating star the same size */
|
||||
--spacing-lamp: 0.625rem;
|
||||
--spacing-chevron: 0.875rem;
|
||||
/* 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;
|
||||
/* a subtitle select: its least width, and where it starts from */
|
||||
--spacing-field: 9rem;
|
||||
--spacing-field-basis: 12rem;
|
||||
--spacing-band-label: 3.5rem;
|
||||
--spacing-budget: 5.5rem;
|
||||
--spacing-detail: 1.2em;
|
||||
|
||||
--container-deck: var(--deck-max);
|
||||
--container-measure: var(--measure);
|
||||
--container-search: 26rem;
|
||||
--container-notice: 68ch;
|
||||
--container-select: 18rem;
|
||||
--container-select-narrow: 11rem;
|
||||
--container-band: 4.5rem;
|
||||
/* 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);
|
||||
@@ -72,7 +123,26 @@
|
||||
--font-readout: var(--font-readout);
|
||||
--font-display: var(--font-display);
|
||||
|
||||
--radius-token: var(--radius);
|
||||
--radius-panel: var(--radius);
|
||||
--radius-pill: 999px;
|
||||
--radius-round: 50%;
|
||||
--radius-micro: 2px;
|
||||
--radius-chip: 3px;
|
||||
|
||||
--font-weight-normal: 400;
|
||||
--font-weight-semibold: 600;
|
||||
--font-weight-bold: 700;
|
||||
|
||||
/* tracking, by how loudly a label is engraved */
|
||||
--tracking-title: 0.04em;
|
||||
--tracking-label: 0.08em;
|
||||
--tracking-wide: 0.1em;
|
||||
--tracking-engraved: 0.12em;
|
||||
|
||||
--leading-none: 1;
|
||||
--leading-tight: 1.1;
|
||||
--leading-snug: 1.2;
|
||||
--leading-row: 1.3;
|
||||
--ease-out: var(--ease-out);
|
||||
|
||||
/* the board's own breakpoints: tab bar to rail, column header, dense pointer */
|
||||
|
||||
+70
-37
@@ -4,6 +4,7 @@
|
||||
|
||||
import { type ReactNode, useEffect, useRef, useState } from "react";
|
||||
import { ArmedDeleteIcon, Icon } from "./icons";
|
||||
import { CHIP_ICON, chip as chipLook, control, cx, form, seg, segmented } from "./look";
|
||||
import { fileName } from "./movie";
|
||||
import {
|
||||
cachedSubtitleOptions,
|
||||
@@ -45,10 +46,15 @@ import {
|
||||
type Note,
|
||||
NoteLine,
|
||||
Row,
|
||||
Rows,
|
||||
type Say,
|
||||
Section,
|
||||
useNote,
|
||||
} from "./ui";
|
||||
|
||||
/** One sentence of a lane's state, in the deck's own voice. */
|
||||
const SUBS_NOTE = "readout m-0 mt-2 text-xs text-ink-muted data-[tone=fault]:text-signal-fault";
|
||||
|
||||
/** How often an open title re-reads a running translation's status. */
|
||||
const TRANSLATION_POLL_MS = 5000;
|
||||
|
||||
@@ -150,12 +156,12 @@ function LanguagePicker({
|
||||
}) {
|
||||
return (
|
||||
// biome-ignore lint/a11y/useSemanticElements: a fieldset brings its own border, padding and min-width, which this group does not want
|
||||
<div className="segmented subs-langs" role="group" aria-label={label}>
|
||||
<div className={segmented(true)} role="group" aria-label={label}>
|
||||
{languages.map((language) => (
|
||||
<button
|
||||
key={language}
|
||||
type="button"
|
||||
className="seg"
|
||||
className={seg(language === choice)}
|
||||
data-language={language}
|
||||
aria-pressed={language === choice}
|
||||
disabled={language === barred}
|
||||
@@ -192,8 +198,14 @@ function SubtitleField({
|
||||
}) {
|
||||
return (
|
||||
// biome-ignore lint/a11y/noLabelWithoutControl: the select is the child
|
||||
<label className={narrow ? "field subs-field subs-field-narrow" : "field subs-field"}>
|
||||
<span className="field-label readout dim">{label}</span>
|
||||
<label
|
||||
className={cx(
|
||||
form.field,
|
||||
"shrink min-w-field",
|
||||
narrow ? "grow-0 basis-field max-w-select-narrow" : "grow basis-field-basis max-w-select",
|
||||
)}
|
||||
>
|
||||
<span className={cx("readout dim", form.label)}>{label}</span>
|
||||
{children}
|
||||
</label>
|
||||
);
|
||||
@@ -325,10 +337,10 @@ function CandidateBuckets({
|
||||
const eligible = results.candidates.filter((c) => c.verdict === "eligible");
|
||||
const rejected = results.candidates.filter((c) => c.verdict !== "eligible");
|
||||
return (
|
||||
<div className="subs-buckets">
|
||||
<section className="deck-group">
|
||||
<div className="mt-3">
|
||||
<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 +352,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 +368,9 @@ function CandidateBuckets({
|
||||
fetchCandidate={fetchCandidate}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</Rows>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -536,7 +548,13 @@ export function useSubtitleSection(
|
||||
const chip = (
|
||||
<button
|
||||
type="button"
|
||||
className="chip subs-chip"
|
||||
className={cx(
|
||||
chipLook({
|
||||
verdict: summary.satisfied ? "eligible" : "wanted",
|
||||
interactive: true,
|
||||
}),
|
||||
"subs-chip hover:border-current focus-visible:border-current aria-expanded:border-current",
|
||||
)}
|
||||
aria-expanded={open}
|
||||
aria-controls={panelId}
|
||||
data-verdict={summary.satisfied ? "eligible" : "wanted"}
|
||||
@@ -548,14 +566,23 @@ export function useSubtitleSection(
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon name="captions" />
|
||||
<Icon name="captions" className={cx(CHIP_ICON, "opacity-70")} />
|
||||
{/* the codes read as one string — the chip's own flex gap would otherwise
|
||||
open a space in front of every comma. The run is as wide as the wanted
|
||||
set can ever need, so the chips after it stay in column. */}
|
||||
<span className="subs-chip-langs" style={{ width: `${summaryWidth(wanted)}ch` }}>
|
||||
<span
|
||||
className="inline-flex items-baseline flex-none overflow-hidden whitespace-nowrap"
|
||||
style={{ width: `${summaryWidth(wanted)}ch` }}
|
||||
>
|
||||
{summary.languages.length === 0 && <span className="dim">none</span>}
|
||||
{summary.languages.map((entry, index) => (
|
||||
<span key={entry.language} data-mt={entry.translated ? "true" : undefined}>
|
||||
<span
|
||||
key={entry.language}
|
||||
data-mt={entry.translated ? "true" : undefined}
|
||||
className={
|
||||
entry.translated ? "underline decoration-dotted underline-offset-2" : undefined
|
||||
}
|
||||
>
|
||||
{index === 0 ? entry.language : `,${entry.language}`}
|
||||
</span>
|
||||
))}
|
||||
@@ -564,7 +591,9 @@ export function useSubtitleSection(
|
||||
{/* §4.2's one glyph exemption: everything wanted is on disk, drawn as a
|
||||
check. The slot is there either way, so a check appearing never
|
||||
moves the row's other chips. */}
|
||||
<span className="subs-chip-mark">{summary.satisfied && <Icon name="check" />}</span>
|
||||
<span className="inline-flex flex-none justify-center w-3">
|
||||
{summary.satisfied && <Icon name="check" className={cx(CHIP_ICON, "opacity-70")} />}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
|
||||
@@ -730,10 +759,14 @@ export function useSubtitleSection(
|
||||
const rest = subtitles.filter((subtitle) => !asked.includes(subtitle));
|
||||
|
||||
const panel = (
|
||||
<div className="subs-panel" id={panelId} hidden={!open}>
|
||||
<section className="deck-group subs-lane">
|
||||
<div
|
||||
className="@container min-w-0 p-3 bg-panel border border-line rounded-panel"
|
||||
id={panelId}
|
||||
hidden={!open}
|
||||
>
|
||||
<Section spacing="mb-4 last:mb-0">
|
||||
<DeckHead label="on this file" />
|
||||
<div className="subs-present">
|
||||
<div className="flex flex-wrap items-center gap-1 pt-3">
|
||||
{asked.map((subtitle) => (
|
||||
<SubtitleChip
|
||||
key={subtitle.id}
|
||||
@@ -756,27 +789,27 @@ export function useSubtitleSection(
|
||||
/>
|
||||
))}
|
||||
{subtitles.length === 0 && missing.length === 0 && (
|
||||
<p className="readout dim">no subtitles on this file yet.</p>
|
||||
<p className="readout dim m-0 text-xs">no subtitles on this file yet.</p>
|
||||
)}
|
||||
</div>
|
||||
<NoteLine note={presentNote} className="subs-note readout" />
|
||||
</section>
|
||||
<NoteLine note={presentNote} className={SUBS_NOTE} />
|
||||
</Section>
|
||||
|
||||
<section className="deck-group subs-lane">
|
||||
<Section spacing="mb-4 last:mb-0">
|
||||
<DeckHead label="fetch" count={fetchCount} />
|
||||
<div className="subs-controls">
|
||||
<div className="flex flex-wrap items-end gap-y-2 gap-x-3 pt-3">
|
||||
<LanguagePicker
|
||||
label="language to search for"
|
||||
languages={languages}
|
||||
choice={searchChoice}
|
||||
onPick={setSearchLanguage}
|
||||
/>
|
||||
<button type="button" className="control" disabled={searching} onClick={search}>
|
||||
<button type="button" className={control()} disabled={searching} onClick={search}>
|
||||
search
|
||||
</button>
|
||||
</div>
|
||||
<p
|
||||
className="subs-note readout"
|
||||
className={SUBS_NOTE}
|
||||
role="status"
|
||||
data-tone={searchNote?.tone}
|
||||
hidden={searchNote?.hidden}
|
||||
@@ -790,14 +823,14 @@ 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">
|
||||
<div className="flex flex-wrap items-end gap-y-2 gap-x-3 pt-3">
|
||||
<SubtitleField label="source">
|
||||
<select
|
||||
className="form-input"
|
||||
className={cx(form.input, form.select)}
|
||||
value={source}
|
||||
disabled={empty || extracting}
|
||||
onChange={(event) => {
|
||||
@@ -842,7 +875,7 @@ export function useSubtitleSection(
|
||||
/>
|
||||
<SubtitleField label="engine" narrow>
|
||||
<select
|
||||
className="form-input"
|
||||
className={cx(form.input, form.select)}
|
||||
value={engineDisabled ? "" : engine}
|
||||
disabled={engineDisabled}
|
||||
onChange={(event) => setEngine(event.target.value)}
|
||||
@@ -857,7 +890,7 @@ export function useSubtitleSection(
|
||||
</SubtitleField>
|
||||
<button
|
||||
type="button"
|
||||
className="control"
|
||||
className={control()}
|
||||
disabled={translateDisabled}
|
||||
onClick={translate}
|
||||
>
|
||||
@@ -865,14 +898,14 @@ export function useSubtitleSection(
|
||||
</button>
|
||||
</div>
|
||||
<p
|
||||
className="subs-note readout"
|
||||
className={SUBS_NOTE}
|
||||
role="status"
|
||||
data-tone={empty ? undefined : hintFault === null ? undefined : "fault"}
|
||||
>
|
||||
{options === null ? "" : hint}
|
||||
</p>
|
||||
<NoteLine note={translateNote} className="subs-note readout" />
|
||||
</section>
|
||||
<NoteLine note={translateNote} className={SUBS_NOTE} />
|
||||
</Section>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
+397
-77
@@ -5,21 +5,36 @@
|
||||
|
||||
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";
|
||||
import {
|
||||
type ControlLook,
|
||||
card,
|
||||
chip,
|
||||
control,
|
||||
cx,
|
||||
NOTE,
|
||||
ROW_RULE,
|
||||
SUB,
|
||||
skel,
|
||||
toggle,
|
||||
toggleLamp,
|
||||
toggleState,
|
||||
type,
|
||||
} from "./look";
|
||||
|
||||
export type Tone = "fault" | "warn";
|
||||
|
||||
/** Joins class names, dropping the falsy ones. */
|
||||
export function cx(...names: (string | false | null | undefined)[]): string {
|
||||
return names.filter(Boolean).join(" ");
|
||||
}
|
||||
export { cx } from "./look";
|
||||
|
||||
/** A boolean data attribute: present (empty) or absent. */
|
||||
export function flag(on: boolean | undefined): "" | undefined {
|
||||
@@ -37,6 +52,10 @@ export interface ControlProps extends ComponentProps<"button"> {
|
||||
glyph?: IconName;
|
||||
/** Fixed width, so a label that changes (GRAB → SENDING → SENT) never moves the row. */
|
||||
fixed?: boolean;
|
||||
/** Full width, content at the start: a phone tray or a settings panel. */
|
||||
fill?: boolean;
|
||||
danger?: boolean;
|
||||
state?: ControlLook["state"];
|
||||
busy?: boolean;
|
||||
done?: boolean;
|
||||
failed?: boolean;
|
||||
@@ -48,6 +67,9 @@ export function Control({
|
||||
quiet,
|
||||
glyph,
|
||||
fixed,
|
||||
fill,
|
||||
danger,
|
||||
state,
|
||||
busy,
|
||||
done,
|
||||
failed,
|
||||
@@ -57,14 +79,23 @@ export function Control({
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={cx("control", quiet && "control-quiet", fixed && "control-fixed", className)}
|
||||
className={cx(
|
||||
control({
|
||||
look: quiet ? "quiet" : "primary",
|
||||
shape: fixed ? "fixed" : "word",
|
||||
fill,
|
||||
danger,
|
||||
state,
|
||||
}),
|
||||
className,
|
||||
)}
|
||||
data-busy={flag(busy)}
|
||||
data-done={flag(done)}
|
||||
data-failed={flag(failed)}
|
||||
{...rest}
|
||||
>
|
||||
{glyph && <Icon name={glyph} />}
|
||||
<span className="control-word">{text}</span>
|
||||
{glyph && <Icon name={glyph} className={fill ? "mr-1" : undefined} />}
|
||||
<span>{text}</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -73,17 +104,27 @@ export function Control({
|
||||
export function IconControl({
|
||||
glyph,
|
||||
label,
|
||||
look,
|
||||
shape = "icon",
|
||||
className,
|
||||
iconClassName,
|
||||
...rest
|
||||
}: ComponentProps<"button"> & { glyph: IconName; label: string }) {
|
||||
}: ComponentProps<"button"> & {
|
||||
glyph: IconName;
|
||||
label: string;
|
||||
/** The glyph's own classes, e.g. a disclosure's turn. */
|
||||
iconClassName?: string;
|
||||
look?: ControlLook["look"];
|
||||
shape?: "icon" | "chip";
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={cx("control control-icon", className)}
|
||||
className={cx(control({ look, shape }), className)}
|
||||
aria-label={label}
|
||||
{...rest}
|
||||
>
|
||||
<Icon name={glyph} />
|
||||
<Icon name={glyph} className={iconClassName} />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -92,17 +133,17 @@ export function IconControl({
|
||||
export function IconLink({
|
||||
label,
|
||||
href,
|
||||
className,
|
||||
shape = "icon",
|
||||
children,
|
||||
}: {
|
||||
label: string;
|
||||
href: string;
|
||||
className?: string;
|
||||
shape?: "icon" | "trailer";
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<a
|
||||
className={cx("control control-icon", className)}
|
||||
className={control({ shape })}
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
@@ -121,17 +162,20 @@ export function IconLink({
|
||||
export function LampToggle({
|
||||
label,
|
||||
pressed,
|
||||
fill = false,
|
||||
...rest
|
||||
}: ComponentProps<"button"> & {
|
||||
label: string;
|
||||
pressed: boolean;
|
||||
/** Full width, content at the start: a phone tray or a settings panel. */
|
||||
fill?: boolean;
|
||||
"data-focus-id"?: string;
|
||||
}) {
|
||||
return (
|
||||
<button type="button" className="toggle" aria-pressed={pressed} {...rest}>
|
||||
<span className="toggle-lamp" aria-hidden="true" />
|
||||
<span className="toggle-label">{label}</span>
|
||||
<span className="toggle-state" aria-hidden="true">
|
||||
<button type="button" className={toggle(pressed, fill)} aria-pressed={pressed} {...rest}>
|
||||
<span className={toggleLamp(pressed)} aria-hidden="true" />
|
||||
<span>{label}</span>
|
||||
<span className={toggleState(pressed)} aria-hidden="true">
|
||||
{pressed ? "on" : "off"}
|
||||
</span>
|
||||
</button>
|
||||
@@ -156,14 +200,18 @@ export function Disclosure({
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="control control-quiet disclose"
|
||||
className={cx(control({ look: "quiet", shape: "disclose" }), "ml-auto")}
|
||||
aria-expanded={open}
|
||||
onClick={onToggle}
|
||||
>
|
||||
<span className="control-word">
|
||||
{`${open ? "hide" : "show"} ${count}${noun === "" ? "" : ` ${noun}`}`}
|
||||
</span>
|
||||
<Icon name="chevronDown" />
|
||||
<span>{`${open ? "hide" : "show"} ${count}${noun === "" ? "" : ` ${noun}`}`}</span>
|
||||
<Icon
|
||||
name="chevronDown"
|
||||
className={cx(
|
||||
"[transition:transform_200ms_var(--ease-out)]",
|
||||
open && "[transform:rotate(180deg)]",
|
||||
)}
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -185,6 +233,9 @@ export function ArmedDeleteWord({
|
||||
text={armed ? `tap again to ${label}` : label}
|
||||
glyph={armed ? "check" : "trash"}
|
||||
quiet
|
||||
fill
|
||||
danger
|
||||
state={armed ? "armed" : null}
|
||||
data-kind="delete"
|
||||
data-armed={armed ? "true" : undefined}
|
||||
disabled={spent}
|
||||
@@ -212,16 +263,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>
|
||||
@@ -307,17 +376,43 @@ function useExplain(explain: Explain | undefined) {
|
||||
}
|
||||
|
||||
export interface ChipProps extends HTMLAttributes<HTMLSpanElement> {
|
||||
/** `chip readout` by default; a glyph chip drops the readout face. */
|
||||
base?: string;
|
||||
/** The whole label is a glyph. */
|
||||
glyph?: boolean;
|
||||
/** A live download's chip. */
|
||||
download?: boolean;
|
||||
explain?: Explain;
|
||||
[data: `data-${string}`]: string | undefined;
|
||||
}
|
||||
|
||||
/** A chip, the §9.3 column unit. */
|
||||
export function Chip({ base = "chip readout", className, explain, children, ...rest }: ChipProps) {
|
||||
/** A chip, the §9.3 column unit. Its look is read off its own data attributes. */
|
||||
export function Chip({ glyph, download, className, explain, children, ...rest }: ChipProps) {
|
||||
const explainProps = useExplain(explain);
|
||||
return (
|
||||
<span className={cx(base, className)} {...rest} {...explainProps}>
|
||||
<span
|
||||
className={cx(
|
||||
chip({
|
||||
verdict: rest["data-verdict"],
|
||||
blacklist: rest["data-blacklist"],
|
||||
movieState: rest["data-movie-state"],
|
||||
wanted: rest["data-wanted"],
|
||||
dlPhase: rest["data-dl-phase"],
|
||||
status: rest["data-status"],
|
||||
counts: rest["data-counts"],
|
||||
flag: rest["data-flag"],
|
||||
mt: rest["data-mt"],
|
||||
tone: rest["data-tone"],
|
||||
secondary: rest["data-pri"] === "2",
|
||||
interactive: explain !== undefined || rest.role === "button",
|
||||
explain: explain !== undefined,
|
||||
glyph,
|
||||
download,
|
||||
cell: rest["data-cell"] !== undefined,
|
||||
}),
|
||||
className,
|
||||
)}
|
||||
{...rest}
|
||||
{...explainProps}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
@@ -334,14 +429,17 @@ export interface ActionSlot {
|
||||
wide?: boolean;
|
||||
/** Shown below 40rem only — an empty cell that keeps a phone column aligned. */
|
||||
narrow?: boolean;
|
||||
/** A word or toggle control fills its column; an input keeps its own width. */
|
||||
fill?: boolean;
|
||||
}
|
||||
|
||||
export interface RowProps {
|
||||
/** `data-row`: which kind of row, for the few rules that differ by kind. */
|
||||
/** `data-row`: which kind of row. */
|
||||
kind: string;
|
||||
lead?: ReactNode;
|
||||
title?: ReactNode;
|
||||
titleClassName?: string;
|
||||
/** readout: a path or a key in the mono face. season: an engraved display name. */
|
||||
titleStyle?: "plain" | "readout" | "season";
|
||||
/** The chip line. */
|
||||
meta?: ReactNode;
|
||||
sub?: ReactNode;
|
||||
@@ -351,7 +449,7 @@ export interface RowProps {
|
||||
beforeSub?: ReactNode;
|
||||
/** Body content after the sub line. */
|
||||
afterSub?: ReactNode;
|
||||
bodyClassName?: string;
|
||||
/** The body as a whole toggles something, e.g. a season's episodes. */
|
||||
onBodyClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
||||
actions?: ActionSlot[];
|
||||
/** The phone tray: labelled, full-width versions of the wide-only actions. */
|
||||
@@ -382,6 +480,18 @@ export function Expandable({ className, children }: { className: string; childre
|
||||
);
|
||||
}
|
||||
|
||||
const TITLE = {
|
||||
plain: "text-sm @row:text-base font-semibold",
|
||||
readout: "readout text-sm @row:text-base font-semibold",
|
||||
season: "font-display text-base font-bold tracking-label uppercase",
|
||||
} as const;
|
||||
|
||||
const SLOT_WIDTH = {
|
||||
icon: "w-control-h",
|
||||
toggle: "w-toggle-w",
|
||||
word: "min-w-word-w",
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* The one row: `lead | body | actions`, plus a full-width tray. The body is
|
||||
* `minmax(0, 1fr)`, so a long title or a run of chips is clipped inside it
|
||||
@@ -390,52 +500,93 @@ export function Expandable({ className, children }: { className: string; childre
|
||||
export function Row(props: RowProps) {
|
||||
const [moreOpen, setMoreOpen] = useState(false);
|
||||
const { open, actions = [] } = props;
|
||||
// the row as a link: a stretched button under everything; real controls
|
||||
// sit above it, everything else lets the tap through
|
||||
const above = open ? "relative z-1 pointer-events-none" : undefined;
|
||||
return (
|
||||
<li className="r" data-row={props.kind} data-nolead={flag(!props.lead)}>
|
||||
<li
|
||||
className={cx(
|
||||
"relative grid items-center gap-x-3 min-h-row-min py-2",
|
||||
ROW_RULE,
|
||||
props.lead
|
||||
? "[grid-template-columns:auto_minmax(0,1fr)_auto] [grid-template-areas:'lead_body_act'_'tray_tray_tray']"
|
||||
: "[grid-template-columns:minmax(0,1fr)_auto] [grid-template-areas:'body_act'_'tray_tray']",
|
||||
open && "[&_:is(button,a,select,input,[role=button])]:pointer-events-auto",
|
||||
)}
|
||||
data-row={props.kind}
|
||||
>
|
||||
{open && (
|
||||
<button
|
||||
type="button"
|
||||
className={cx("r-link", open.className)}
|
||||
className={cx(
|
||||
"r-link absolute inset-0 z-0 p-0 bg-transparent [border:0] cursor-pointer [transition:background_150ms_var(--ease-out)] hover:bg-highlight focus-visible:[outline-offset:-2px]",
|
||||
open.className,
|
||||
)}
|
||||
aria-label={open.label}
|
||||
aria-expanded={open.expanded}
|
||||
aria-disabled={open.disabled ? "true" : undefined}
|
||||
onClick={(event) => open.run(event.currentTarget)}
|
||||
/>
|
||||
)}
|
||||
{props.lead && <div className="r-lead">{props.lead}</div>}
|
||||
{props.lead && (
|
||||
<div className={cx("[grid-area:lead] flex items-center justify-center", above)}>
|
||||
{props.lead}
|
||||
</div>
|
||||
)}
|
||||
{/* biome-ignore lint/a11y/noStaticElementInteractions: the season name expands it too — the chevron stays the accessible control */}
|
||||
{/* biome-ignore lint/a11y/useKeyWithClickEvents: same */}
|
||||
<div className={cx("r-body", props.bodyClassName)} onClick={props.onBodyClick}>
|
||||
<div
|
||||
className={cx("[grid-area:body] grid content-center gap-1 min-w-0", above)}
|
||||
onClick={props.onBodyClick}
|
||||
>
|
||||
{props.title !== undefined && props.title !== null && (
|
||||
<div className={cx("r-title", props.titleClassName)}>{props.title}</div>
|
||||
<div
|
||||
className={cx(
|
||||
"min-w-0 truncate leading-row text-ink",
|
||||
TITLE[props.titleStyle ?? "plain"],
|
||||
)}
|
||||
>
|
||||
{props.title}
|
||||
</div>
|
||||
)}
|
||||
<div className="r-meta">{props.meta}</div>
|
||||
{/* one line of chips; what does not fit fades out at the edge rather
|
||||
than being cut through a word */}
|
||||
<div className="flex items-center flex-nowrap gap-1 min-w-0 overflow-hidden [mask-image:linear-gradient(to_right,var(--ink)_calc(100%_-_1.5rem),transparent)] empty:hidden">
|
||||
{props.meta}
|
||||
</div>
|
||||
{props.beforeSub}
|
||||
{props.sub !== undefined &&
|
||||
props.sub !== null &&
|
||||
(props.subExpands ? (
|
||||
<Expandable className="r-sub readout">{props.sub}</Expandable>
|
||||
<Expandable className={SUB}>{props.sub}</Expandable>
|
||||
) : (
|
||||
<div className="r-sub readout">{props.sub}</div>
|
||||
<div className={SUB}>{props.sub}</div>
|
||||
))}
|
||||
{props.afterSub}
|
||||
</div>
|
||||
<div className="r-act">
|
||||
{/* every slot has its width whether or not it holds a control, so a row
|
||||
of a kind keeps one action column */}
|
||||
<div className={cx("[grid-area:act] flex items-center justify-end gap-1", above)}>
|
||||
{actions.map((slot, index) => (
|
||||
<span
|
||||
// the column is positional: a slot is its index
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: see above
|
||||
key={index}
|
||||
className="r-slot"
|
||||
className={cx(
|
||||
"flex-none items-center justify-center",
|
||||
slot.wide ? "hidden @row:flex" : "flex",
|
||||
slot.narrow && "@row:hidden",
|
||||
SLOT_WIDTH[slot.width],
|
||||
// a word or a toggle fills its column, so every row's plates line up
|
||||
slot.width !== "icon" && slot.fill !== false && "*:w-full",
|
||||
)}
|
||||
data-width={slot.width}
|
||||
data-wide={flag(slot.wide)}
|
||||
data-narrow={flag(slot.narrow)}
|
||||
>
|
||||
{slot.node}
|
||||
</span>
|
||||
))}
|
||||
{props.more && (
|
||||
<span className="r-slot" data-width="icon" data-narrow="">
|
||||
<span className="flex flex-none items-center justify-center w-control-h @row:hidden">
|
||||
<IconControl
|
||||
glyph="more"
|
||||
label="more actions"
|
||||
@@ -445,15 +596,23 @@ export function Row(props: RowProps) {
|
||||
</span>
|
||||
)}
|
||||
{open && open.chevron !== false && actions.length === 0 && (
|
||||
<span className="r-slot r-chevron" data-width="icon" aria-hidden="true">
|
||||
<Icon name="chevronRight" />
|
||||
<span
|
||||
className="flex flex-none items-center justify-center w-control-h text-ink-faint"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<Icon name="chevronRight" className="size-chevron" />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="r-tray">
|
||||
<NoteLine note={props.note ?? null} className="r-note readout" />
|
||||
<div
|
||||
className={cx(
|
||||
"[grid-area:tray] grid gap-2 min-w-0 pt-2 [&:not(:has(>:not([hidden])))]:hidden",
|
||||
open && "relative z-1",
|
||||
)}
|
||||
>
|
||||
<NoteLine note={props.note ?? null} className={NOTE} />
|
||||
{props.more && (
|
||||
<div className="r-morepanel" hidden={!moreOpen}>
|
||||
<div className="grid gap-2 @row:hidden" hidden={!moreOpen}>
|
||||
{props.more}
|
||||
</div>
|
||||
)}
|
||||
@@ -466,18 +625,28 @@ export function Row(props: RowProps) {
|
||||
/** A row-shaped placeholder: same height and columns as the row it stands for. */
|
||||
export function SkeletonRows({ count, withLead = true }: { count: number; withLead?: boolean }) {
|
||||
return Array.from({ length: count }, (_, index) => (
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: placeholders have no identity
|
||||
<li key={index} className="r r-skel" aria-hidden="true" data-nolead={flag(!withLead)}>
|
||||
<li
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: placeholders have no identity
|
||||
key={index}
|
||||
className={cx(
|
||||
"relative grid items-center gap-x-3 min-h-row-min py-2 pointer-events-none",
|
||||
ROW_RULE,
|
||||
withLead
|
||||
? "[grid-template-columns:auto_minmax(0,1fr)_auto] [grid-template-areas:'lead_body_act'_'tray_tray_tray']"
|
||||
: "[grid-template-columns:minmax(0,1fr)_auto] [grid-template-areas:'body_act'_'tray_tray']",
|
||||
)}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{withLead && (
|
||||
<div className="r-lead">
|
||||
<span className="skel skel-lead" />
|
||||
<div className="[grid-area:lead] flex items-center justify-center">
|
||||
<span className={skel.lead} />
|
||||
</div>
|
||||
)}
|
||||
<div className="r-body">
|
||||
<span className="skel skel-line" />
|
||||
<span className="skel skel-line skel-short" />
|
||||
<div className="[grid-area:body] grid content-center gap-1 min-w-0">
|
||||
<span className={skel.line} />
|
||||
<span className={skel.short} />
|
||||
</div>
|
||||
<div className="r-act" />
|
||||
<div className="[grid-area:act] flex items-center justify-end gap-1" />
|
||||
</li>
|
||||
));
|
||||
}
|
||||
@@ -486,62 +655,213 @@ export function SkeletonRows({ count, withLead = true }: { count: number; withLe
|
||||
export function EmptyRow({
|
||||
text,
|
||||
tone,
|
||||
lead,
|
||||
children,
|
||||
}: {
|
||||
text: string;
|
||||
tone?: "fault";
|
||||
/** Before the text, such as a probing lamp. */
|
||||
lead?: ReactNode;
|
||||
children?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<li className="r-empty readout" data-tone={tone}>
|
||||
<li
|
||||
className={cx(
|
||||
"readout flex items-center gap-2 min-h-row-min py-2 text-xs text-ink-muted data-[tone=fault]:text-signal-fault",
|
||||
ROW_RULE,
|
||||
)}
|
||||
data-tone={tone}
|
||||
>
|
||||
{lead}
|
||||
{text}
|
||||
{children}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
/* ---- 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={cx(type.pageTitle, "capitalize")}>{title}</h2>
|
||||
{count !== undefined && <span className={cx(type.count, "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,
|
||||
labelId,
|
||||
as: Heading = "h3",
|
||||
labelClass = "deck-label",
|
||||
titled = "label",
|
||||
count,
|
||||
children,
|
||||
}: {
|
||||
label: string;
|
||||
labelId?: string;
|
||||
as?: "h3" | "h4";
|
||||
labelClass?: string;
|
||||
/** A page's section title, or a group's engraved label. */
|
||||
titled?: "section" | "label";
|
||||
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">
|
||||
<Heading className={labelClass} id={labelId}>
|
||||
<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={titled === "section" ? type.sectionTitle : cx(type.label, "text-ink-muted")}
|
||||
id={labelId}
|
||||
>
|
||||
{label}
|
||||
</Heading>
|
||||
{count !== undefined && <span className="deck-count readout">{count ?? ""}</span>}
|
||||
{count !== undefined && <span className={type.count}>{count ?? ""}</span>}
|
||||
{children}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
/** 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 ? card.grid : "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)}
|
||||
look="faint"
|
||||
shape="chip"
|
||||
/>
|
||||
<p className="m-0 basis-full max-w-measure text-xs" hidden={!open}>
|
||||
{more}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
+36
-38
@@ -10,9 +10,10 @@ import {
|
||||
movieNeedsAttention,
|
||||
seriesNeedsAttention,
|
||||
} from "../library";
|
||||
import { card, seg, segmented, skel } from "../look";
|
||||
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,20 +50,20 @@ 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}>
|
||||
<span className="card card-skel">
|
||||
<span className="card-art" />
|
||||
<span className="card-body">
|
||||
<span className="skel skel-line" />
|
||||
<span className="skel skel-line skel-short" />
|
||||
<span className={card.card}>
|
||||
<span className={card.art} />
|
||||
<span className={card.body}>
|
||||
<span className={skel.line} />
|
||||
<span className={skel.short} />
|
||||
</span>
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Rows>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -162,17 +163,16 @@ 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" />
|
||||
<fieldset className="segmented" aria-label="layout">
|
||||
<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"
|
||||
className="seg seg-icon"
|
||||
className={seg(shape === "grid", true)}
|
||||
aria-pressed={shape === "grid"}
|
||||
aria-label="poster grid"
|
||||
onClick={() => setShape("grid")}
|
||||
@@ -181,7 +181,7 @@ export function LibraryView({ hidden }: { hidden: boolean }) {
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="seg seg-icon"
|
||||
className={seg(shape === "list", true)}
|
||||
aria-pressed={shape === "list"}
|
||||
aria-label="list"
|
||||
onClick={() => setShape("list")}
|
||||
@@ -189,58 +189,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>
|
||||
);
|
||||
}
|
||||
|
||||
+33
-26
@@ -5,6 +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, cx, detail, form, SUB } from "../look";
|
||||
import {
|
||||
fileName,
|
||||
imdbLink,
|
||||
@@ -45,12 +46,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,
|
||||
@@ -80,7 +84,7 @@ function FileRow({
|
||||
<Row
|
||||
kind="file"
|
||||
title={fileName(file.path)}
|
||||
titleClassName="readout"
|
||||
titleStyle="readout"
|
||||
meta={
|
||||
<>
|
||||
<WaiverChip waiver={file.waiver} say={say} />
|
||||
@@ -92,7 +96,7 @@ function FileRow({
|
||||
</>
|
||||
}
|
||||
// the full path is evidence, a tap away rather than a hover away
|
||||
afterSub={<Expandable className="r-sub readout">{file.path}</Expandable>}
|
||||
afterSub={<Expandable className={SUB}>{file.path}</Expandable>}
|
||||
note={note}
|
||||
tray={subs.panel}
|
||||
/>
|
||||
@@ -405,7 +409,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}
|
||||
@@ -427,11 +431,11 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="actionbar">
|
||||
<button type="button" className="control" disabled={sweeping} onClick={sweep}>
|
||||
<div className={detail.actionbar}>
|
||||
<button type="button" className={control()} disabled={sweeping} onClick={sweep}>
|
||||
search indexers
|
||||
</button>
|
||||
<span className="actionbar-links">
|
||||
<span className={detail.actionbarLinks}>
|
||||
{/* the trailer resolves from the metadata's own key — no second call.
|
||||
Hidden when absent rather than shown dead (§9.6). */}
|
||||
{metadata?.trailer && (
|
||||
@@ -441,13 +445,14 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
|
||||
<IconControl
|
||||
glyph="more"
|
||||
label="library settings for this title"
|
||||
className="ml-auto"
|
||||
aria-expanded={moreOpen}
|
||||
aria-controls="movie-more-panel"
|
||||
onClick={() => setMoreOpen(!moreOpen)}
|
||||
/>
|
||||
</div>
|
||||
<div className="more-panel" id="movie-more-panel" hidden={!moreOpen}>
|
||||
<div className="more-links">
|
||||
<div className={detail.morePanel} id="movie-more-panel" hidden={!moreOpen}>
|
||||
<div className={detail.moreLinks}>
|
||||
{metadata !== null && (
|
||||
<>
|
||||
<ProviderLink
|
||||
@@ -472,14 +477,16 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="more-toggles">
|
||||
<div className={detail.moreToggles}>
|
||||
<LampToggle
|
||||
fill
|
||||
label="wanted"
|
||||
pressed={movie?.wanted ?? false}
|
||||
disabled={busy === "wanted"}
|
||||
onClick={() => toggle("wanted", "wanted")}
|
||||
/>
|
||||
<LampToggle
|
||||
fill
|
||||
label="targeted search"
|
||||
pressed={!(movie?.blocked ?? false)}
|
||||
// the accessible name carries what the label cannot, at rest and on
|
||||
@@ -491,15 +498,15 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
|
||||
{/* §6.3 is the whole point of the flag and a bare toggle hides it: the
|
||||
note appears when the flag is on, which is when the RSS half is the
|
||||
thing that surprises. At rest the label and the title carry it. */}
|
||||
<p className="control-note readout" hidden={!movie?.blocked}>
|
||||
<p className={detail.controlNote} hidden={!movie?.blocked}>
|
||||
Targeted search is off. RSS still matches this title, so a release can still arrive.
|
||||
</p>
|
||||
<label className="field more-field">
|
||||
<span className="field-label" id="movie-root-label">
|
||||
<label className={form.field}>
|
||||
<span className={form.label} id="movie-root-label">
|
||||
root
|
||||
</span>
|
||||
<select
|
||||
className="form-input"
|
||||
className={cx(form.input, form.select)}
|
||||
aria-labelledby="movie-root-label"
|
||||
value={movie === null ? "" : String(movie.root_id)}
|
||||
disabled={busy === "root"}
|
||||
@@ -520,7 +527,7 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
className="control control-quiet"
|
||||
className={control({ look: "quiet", fill: true, danger: true })}
|
||||
data-kind="delete"
|
||||
ref={removeButton}
|
||||
aria-expanded={removeOpen}
|
||||
@@ -530,7 +537,7 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
|
||||
>
|
||||
remove from library
|
||||
</button>
|
||||
<div className="remove-panel" id="remove-panel" hidden={!removeOpen}>
|
||||
<div className="@row:col-span-full" id="remove-panel" hidden={!removeOpen}>
|
||||
{removeOpen && subject.current !== null && (
|
||||
<RemovePanel
|
||||
subject={subject.current}
|
||||
@@ -543,16 +550,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"
|
||||
titled="section"
|
||||
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 +576,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}>
|
||||
<DeckHead label="releases" labelId="label-releases" labelClass="section-title" />
|
||||
<StatusSlot status={releaseStatus} className="deck-status readout" />
|
||||
<Section labelledBy="label-releases" ref={releasesSection}>
|
||||
<DeckHead label="releases" labelId="label-releases" titled="section" />
|
||||
<StatusSlot status={releaseStatus} variant="deck" />
|
||||
<Buckets state={deck} actions={actions} />
|
||||
</section>
|
||||
</main>
|
||||
</Section>
|
||||
</Deck>
|
||||
);
|
||||
}
|
||||
|
||||
+14
-13
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
+64
-45
@@ -5,6 +5,11 @@
|
||||
import { type KeyboardEvent, useEffect, useRef, useState } from "react";
|
||||
import { useNav } from "../context";
|
||||
import { Icon } from "../icons";
|
||||
import { chain, cx, PANEL, PANEL_ACTIONS, PANEL_NOTE, seg, segmented } from "../look";
|
||||
|
||||
/** a pasted link or hash is evidence: it wraps rather than overflowing */
|
||||
const INTAKE = "[overflow-wrap:anywhere]";
|
||||
|
||||
import { RatingChip, RowPoster, TitleText } from "../parts";
|
||||
import { MovieRow, SeriesHitRow } from "../rows";
|
||||
import {
|
||||
@@ -18,7 +23,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";
|
||||
@@ -103,38 +120,44 @@ function AddPanel({
|
||||
|
||||
const done = state === "done";
|
||||
return (
|
||||
<div className="add-panel" ref={panel}>
|
||||
<div className={PANEL} ref={panel}>
|
||||
{/* biome-ignore lint/a11y/useSemanticElements: a fieldset brings its own border, padding and min-width, which this group does not want */}
|
||||
<div className="add-roots" role="group" aria-label="root folder">
|
||||
<div
|
||||
className="grid [grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))] gap-2"
|
||||
role="group"
|
||||
aria-label="root folder"
|
||||
>
|
||||
{roots.map((root) => (
|
||||
<button
|
||||
key={root.id}
|
||||
type="button"
|
||||
className="root-option"
|
||||
className="grid gap-1 min-h-control-h py-2 px-3 [font:inherit] text-left text-ink bg-panel-raised border border-line rounded-panel cursor-pointer [transition:border-color_150ms_var(--ease-out)] not-disabled:hover:border-line-strong aria-pressed:border-accent disabled:cursor-default disabled:opacity-60"
|
||||
aria-pressed={root === selected}
|
||||
disabled={done}
|
||||
onClick={() => setSelected(root)}
|
||||
>
|
||||
<span className="root-audience">{root.audience}</span>
|
||||
<span className="root-policy readout dim">{root.policy_name}</span>
|
||||
<span className="root-path readout dim">{root.path}</span>
|
||||
<span className="font-display text-md font-bold uppercase tracking-engraved leading-none">
|
||||
{root.audience}
|
||||
</span>
|
||||
<span className="readout dim text-xs">{root.policy_name}</span>
|
||||
<span className="readout dim text-xs">{root.path}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{isSeries && (
|
||||
<div className="add-autotrack">
|
||||
<div className="grid justify-items-start gap-1">
|
||||
<LampToggle
|
||||
label="track future seasons"
|
||||
pressed={autoTrack}
|
||||
disabled={done}
|
||||
onClick={() => setAutoTrack(!autoTrack)}
|
||||
/>
|
||||
<p className="add-note">
|
||||
<p className="m-0 text-xs text-ink-muted">
|
||||
Seasons that air later are wanted automatically. Past seasons are not.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
<div className="add-actions">
|
||||
<div className={PANEL_ACTIONS}>
|
||||
<Control
|
||||
text={
|
||||
state === "busy"
|
||||
@@ -152,7 +175,7 @@ function AddPanel({
|
||||
onClick={confirm}
|
||||
/>
|
||||
<p
|
||||
className="add-note readout"
|
||||
className={cx("readout", PANEL_NOTE)}
|
||||
role="status"
|
||||
data-tone={note?.tone}
|
||||
ref={noteRef}
|
||||
@@ -210,8 +233,8 @@ function TmdbRow({
|
||||
actions={[
|
||||
{
|
||||
node: (
|
||||
<span className="r-chevron" aria-hidden="true" data-done={flag(added)}>
|
||||
<Icon name={added ? "check" : "plus"} />
|
||||
<span className="text-ink-faint" aria-hidden="true" data-done={flag(added)}>
|
||||
<Icon name={added ? "check" : "plus"} className="size-chevron" />
|
||||
</span>
|
||||
),
|
||||
width: "icon",
|
||||
@@ -235,14 +258,16 @@ function TmdbRow({
|
||||
function ManualIntake({ kind, raw }: { kind: "magnet" | "torrent_url"; raw: string }) {
|
||||
const parsed = parseManualInput(kind, raw);
|
||||
return (
|
||||
<article className="module intake">
|
||||
<header className="module-head">
|
||||
<h3 className="module-name">{kind === "magnet" ? "magnet" : "torrent"}</h3>
|
||||
<span className="module-status readout">recognized</span>
|
||||
<article className={cx(chain.module, "bg-panel border-line")}>
|
||||
<header className={chain.head}>
|
||||
<h3 className={cx(chain.name, "text-md")}>{kind === "magnet" ? "magnet" : "torrent"}</h3>
|
||||
<span className={chain.status}>recognized</span>
|
||||
</header>
|
||||
<p className="module-detail readout">{parsed.name ?? parsed.raw}</p>
|
||||
{parsed.infohash && <p className="module-detail readout dim">{`btih ${parsed.infohash}`}</p>}
|
||||
<p className="module-detail readout dim">
|
||||
<p className={cx(chain.detail, INTAKE)}>{parsed.name ?? parsed.raw}</p>
|
||||
{parsed.infohash && (
|
||||
<p className={cx(chain.detail, INTAKE, "dim")}>{`btih ${parsed.infohash}`}</p>
|
||||
)}
|
||||
<p className={cx(chain.detail, INTAKE, "dim")}>
|
||||
manual grab lands with the release buckets — nothing sent yet
|
||||
</p>
|
||||
</article>
|
||||
@@ -395,20 +420,11 @@ 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"
|
||||
className={cx(segmented(), "deck-filter")}
|
||||
role="toolbar"
|
||||
aria-label="show only one kind"
|
||||
hidden={!listed}
|
||||
@@ -423,22 +439,25 @@ export function SearchView({
|
||||
<button
|
||||
key={value}
|
||||
type="button"
|
||||
className="seg"
|
||||
className={seg(kind === value)}
|
||||
data-kind={value}
|
||||
aria-pressed={kind === value}
|
||||
onClick={() => setKind(value)}
|
||||
>
|
||||
{label}
|
||||
<span className="filter-count" data-role="count">
|
||||
<span
|
||||
className={cx("tabular-nums", kind === value ? "text-ink-muted" : "text-ink-faint")}
|
||||
data-role="count"
|
||||
>
|
||||
{listed ? countOf(value) : ""}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</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 +467,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>
|
||||
);
|
||||
}
|
||||
|
||||
+47
-27
@@ -6,6 +6,7 @@ import { LAYER, type TvDeckRequest, useEscape, useNav } from "../context";
|
||||
import { Hero, ProviderLink, RemovePanel, type RemoveSubject, TrailerLink } from "../detail";
|
||||
import { ArmedDeleteIcon } from "../icons";
|
||||
import { seriesStatusChipRedundant } from "../library";
|
||||
import { control, cx, detail, form } from "../look";
|
||||
import { rottenTomatoesSearch, tmdbSeriesLink, tvdbLink, youtubeLink } from "../movie";
|
||||
import {
|
||||
audienceOf,
|
||||
@@ -52,11 +53,14 @@ import {
|
||||
ArmedDeleteWord,
|
||||
Chip,
|
||||
Control,
|
||||
Deck,
|
||||
DeckHead,
|
||||
EmptyRow,
|
||||
IconControl,
|
||||
LampToggle,
|
||||
Row,
|
||||
Rows,
|
||||
Section,
|
||||
SkeletonRows,
|
||||
StatusSlot,
|
||||
useNote,
|
||||
@@ -90,15 +94,18 @@ function WritingToggle({
|
||||
pressed,
|
||||
write,
|
||||
focusId,
|
||||
fill,
|
||||
}: {
|
||||
label: string;
|
||||
pressed: boolean;
|
||||
write: () => Promise<boolean>;
|
||||
focusId?: string;
|
||||
fill?: boolean;
|
||||
}) {
|
||||
const [busy, setBusy] = useState(false);
|
||||
return (
|
||||
<LampToggle
|
||||
fill={fill}
|
||||
label={label}
|
||||
pressed={pressed}
|
||||
disabled={busy}
|
||||
@@ -175,15 +182,19 @@ function SeasonRow({
|
||||
<IconControl
|
||||
glyph="chevronRight"
|
||||
label={`${short} episodes`}
|
||||
className="disclose-lead"
|
||||
look="lead"
|
||||
iconClassName={cx(
|
||||
"[transition:transform_200ms_var(--ease-out)]",
|
||||
open && "[transform:rotate(90deg)]",
|
||||
)}
|
||||
aria-expanded={open}
|
||||
aria-controls={`episodes-${season.number}`}
|
||||
onClick={onToggleOpen}
|
||||
/>
|
||||
}
|
||||
title={name}
|
||||
titleStyle="season"
|
||||
// the season's name expands it too — the chevron stays the accessible control
|
||||
bodyClassName="r-toggle-body"
|
||||
onBodyClick={(event) => {
|
||||
if (event.target instanceof Element && event.target.closest("button, [role=button]")) {
|
||||
return;
|
||||
@@ -270,13 +281,17 @@ function SeasonRow({
|
||||
]}
|
||||
more={
|
||||
<>
|
||||
<WritingToggle label="tracked" pressed={season.tracked} write={track} />
|
||||
<WritingToggle fill label="tracked" pressed={season.tracked} write={track} />
|
||||
{hasFiles && <ArmedDeleteWord label={deleteLabel} execute={removeFiles} />}
|
||||
</>
|
||||
}
|
||||
note={note}
|
||||
tray={
|
||||
<ul className="episodes" id={`episodes-${season.number}`} hidden={!open}>
|
||||
<ul
|
||||
className="m-0 p-0 list-none [background:oklch(from_var(--panel)_l_c_h/50%)]"
|
||||
id={`episodes-${season.number}`}
|
||||
hidden={!open}
|
||||
>
|
||||
{season.episodes.map((episode) => (
|
||||
<EpisodeRow
|
||||
key={episode.id}
|
||||
@@ -397,7 +412,11 @@ function EpisodeRow({
|
||||
return (
|
||||
<Row
|
||||
kind="episode"
|
||||
lead={<span className="lead-tag readout">{`E${two(episode.number)}`}</span>}
|
||||
lead={
|
||||
<span className="readout w-control-h text-center text-xs font-semibold text-ink-faint">
|
||||
{`E${two(episode.number)}`}
|
||||
</span>
|
||||
}
|
||||
title={episode.title === "" ? "—" : episode.title}
|
||||
meta={
|
||||
<>
|
||||
@@ -427,7 +446,7 @@ function EpisodeRow({
|
||||
onDisk ? (
|
||||
<ArmedDeleteWord label={deleteLabel} execute={removeFile} />
|
||||
) : (
|
||||
<WritingToggle label="wanted" pressed={episode.wanted} write={want} />
|
||||
<WritingToggle fill label="wanted" pressed={episode.wanted} write={want} />
|
||||
)
|
||||
) : undefined
|
||||
}
|
||||
@@ -681,10 +700,10 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
|
||||
<Control text="retry" quiet disabled={retrying} onClick={() => void retryRefresh()} />
|
||||
</EmptyRow>
|
||||
) : (
|
||||
<li className="r-empty readout">
|
||||
<span className="lamp" data-state="probing" />
|
||||
{" refreshing metadata — seasons will appear here"}
|
||||
</li>
|
||||
<EmptyRow
|
||||
lead={<span className="lamp" data-state="probing" />}
|
||||
text=" refreshing metadata — seasons will appear here"
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<EmptyRow text="no seasons listed upstream" />
|
||||
@@ -695,7 +714,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}
|
||||
@@ -721,8 +740,8 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="actionbar">
|
||||
<span className="actionbar-links">
|
||||
<div className={detail.actionbar}>
|
||||
<span className={detail.actionbarLinks}>
|
||||
{metadata?.trailer && (
|
||||
<TrailerLink href={youtubeLink(metadata.trailer.youtube_key)} title={title} />
|
||||
)}
|
||||
@@ -730,13 +749,14 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
|
||||
<IconControl
|
||||
glyph="more"
|
||||
label="library settings for this title"
|
||||
className="ml-auto"
|
||||
aria-expanded={moreOpen}
|
||||
aria-controls="series-more-panel"
|
||||
onClick={() => setMoreOpen(!moreOpen)}
|
||||
/>
|
||||
</div>
|
||||
<div className="more-panel" id="series-more-panel" hidden={!moreOpen}>
|
||||
<div className="more-links">
|
||||
<div className={detail.morePanel} id="series-more-panel" hidden={!moreOpen}>
|
||||
<div className={detail.moreLinks}>
|
||||
{metadata !== null && (
|
||||
<>
|
||||
<ProviderLink
|
||||
@@ -762,12 +782,12 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<label className="field more-field">
|
||||
<span className="field-label" id="series-root-label">
|
||||
<label className={form.field}>
|
||||
<span className={form.label} id="series-root-label">
|
||||
root
|
||||
</span>
|
||||
<select
|
||||
className="form-input"
|
||||
className={cx(form.input, form.select)}
|
||||
data-focus-id="series-root"
|
||||
aria-labelledby="series-root-label"
|
||||
value={series === null ? "" : String(series.root_id)}
|
||||
@@ -786,7 +806,7 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
className="control control-quiet"
|
||||
className={control({ look: "quiet", fill: true, danger: true })}
|
||||
data-kind="delete"
|
||||
ref={removeButton}
|
||||
aria-expanded={removeOpen}
|
||||
@@ -796,7 +816,7 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
|
||||
>
|
||||
remove from library
|
||||
</button>
|
||||
<div className="remove-panel" id="series-remove-panel" hidden={!removeOpen}>
|
||||
<div className="@row:col-span-full" id="series-remove-panel" hidden={!removeOpen}>
|
||||
{removeOpen && subject.current !== null && (
|
||||
<RemovePanel
|
||||
subject={subject.current}
|
||||
@@ -809,11 +829,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">
|
||||
<DeckHead label="seasons" labelId="label-seasons" labelClass="section-title" />
|
||||
<ul className="deck-rows seasons">
|
||||
<Section labelledBy="label-seasons">
|
||||
<DeckHead label="seasons" labelId="label-seasons" titled="section" />
|
||||
<Rows className="seasons">
|
||||
{seasons === null && <SkeletonRows count={4} />}
|
||||
{seasons?.map((season) => (
|
||||
<SeasonRow
|
||||
@@ -833,8 +853,8 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
|
||||
/>
|
||||
))}
|
||||
{seasons !== null && seasons.length === 0 && seasonsEmpty}
|
||||
</ul>
|
||||
</section>
|
||||
</main>
|
||||
</Rows>
|
||||
</Section>
|
||||
</Deck>
|
||||
);
|
||||
}
|
||||
|
||||
+240
-198
@@ -3,8 +3,10 @@
|
||||
|
||||
import {
|
||||
type CSSProperties,
|
||||
createContext,
|
||||
type ReactNode,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
@@ -12,6 +14,7 @@ import {
|
||||
import { LAYER, useEscape, useLive, useNav } from "../context";
|
||||
import type { Check, CheckStatus } from "../health";
|
||||
import { ArmedDeleteIcon, type IconName } from "../icons";
|
||||
import { chain, control, form, PANEL, PANEL_ACTIONS, PANEL_NOTE } from "../look";
|
||||
import type { Root } from "../search";
|
||||
import {
|
||||
deleteRow,
|
||||
@@ -34,13 +37,16 @@ import {
|
||||
Chip,
|
||||
Control,
|
||||
cx,
|
||||
Deck,
|
||||
DeckHead,
|
||||
GroupNote,
|
||||
IconControl,
|
||||
type Note,
|
||||
NoteLine,
|
||||
PageBar,
|
||||
Row,
|
||||
StatusSlot,
|
||||
Rows,
|
||||
Section,
|
||||
useNote,
|
||||
useStatus,
|
||||
} from "../ui";
|
||||
@@ -81,37 +87,57 @@ function ChainModule({
|
||||
master?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<article className={cx("module", master && "module-master", area)}>
|
||||
<header className="module-head">
|
||||
<article
|
||||
className={cx(
|
||||
chain.module,
|
||||
area,
|
||||
master
|
||||
? "bg-panel-raised border-line-strong @cells:pt-6 @cells:px-4 @cells:pb-4"
|
||||
: "bg-panel border-line",
|
||||
)}
|
||||
>
|
||||
<header className={chain.head}>
|
||||
<span
|
||||
className={cx("lamp", master && "lamp-big")}
|
||||
data-state={module.state}
|
||||
aria-hidden="true"
|
||||
style={{ "--strike": String(strike) } as CSSProperties}
|
||||
/>
|
||||
<h4 className="module-name">{name}</h4>
|
||||
<span className="module-status readout" data-tone={module.tone}>
|
||||
<h4 className={cx(chain.name, master ? "text-lg" : "text-md")}>{name}</h4>
|
||||
<span className={chain.status} data-tone={module.tone}>
|
||||
{module.word}
|
||||
</span>
|
||||
</header>
|
||||
<p className="module-role">{duty}</p>
|
||||
<p className="module-detail readout">{module.detail ?? defaultDetail}</p>
|
||||
<p className={chain.role}>{duty}</p>
|
||||
<p className={chain.detail}>{module.detail ?? defaultDetail}</p>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
const TRACE = {
|
||||
idle: { stroke: "stroke-line-strong", fill: "fill-line-strong" },
|
||||
ok: { stroke: "stroke-signal-ok", fill: "fill-signal-ok" },
|
||||
warn: { stroke: "stroke-signal-warn", fill: "fill-signal-warn" },
|
||||
fault: { stroke: "stroke-signal-fault", fill: "fill-signal-fault" },
|
||||
} as const;
|
||||
|
||||
function Bus({ area, tone }: { area: string; tone: Tone | null }) {
|
||||
const trace = tone === null ? "idle" : tone;
|
||||
return (
|
||||
<div className={cx("bus", area)} aria-hidden="true">
|
||||
<div
|
||||
className={cx("grid content-center justify-items-center h-8 @cells:h-auto", area)}
|
||||
aria-hidden="true"
|
||||
>
|
||||
{/* the phone stacks the chain, so the trace turns to run downwards */}
|
||||
<svg
|
||||
viewBox="0 0 40 8"
|
||||
preserveAspectRatio="none"
|
||||
className="bus-trace"
|
||||
className="block w-8 h-2 [transform:rotate(90deg)] [transition:filter_300ms_var(--ease-out)] @cells:w-full @cells:[transform:none]"
|
||||
data-tone={tone === null || tone === "idle" ? undefined : tone}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<line x1="0" y1="4" x2="32" y2="4" />
|
||||
<path d="M32 0.5 39 4 32 7.5 Z" className="bus-arrow" />
|
||||
<line x1="0" y1="4" x2="32" y2="4" className={cx("stroke-1", TRACE[trace].stroke)} />
|
||||
<path d="M32 0.5 39 4 32 7.5 Z" className={TRACE[trace].fill} />
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
@@ -120,16 +146,16 @@ function Bus({ area, tone }: { area: string; tone: Tone | null }) {
|
||||
/** One lamp of the subtitle lane (#200): same module shape as the chain. */
|
||||
function SubtitleModule({ name, duty, check }: { name: string; duty: string; check: Check }) {
|
||||
return (
|
||||
<article className="module">
|
||||
<header className="module-head">
|
||||
<article className={cx(chain.module, "bg-panel border-line")}>
|
||||
<header className={chain.head}>
|
||||
<span className="lamp" data-state={check.status} />
|
||||
<h2 className="module-name">{name}</h2>
|
||||
<span className="module-status readout" data-tone={TONE_BY_STATUS[check.status]}>
|
||||
<h2 className={cx(chain.name, "text-md")}>{name}</h2>
|
||||
<span className={chain.status} data-tone={TONE_BY_STATUS[check.status]}>
|
||||
{check.status}
|
||||
</span>
|
||||
</header>
|
||||
<p className="module-role">{duty}</p>
|
||||
<p className="module-detail readout">{check.detail ?? ""}</p>
|
||||
<p className={chain.role}>{duty}</p>
|
||||
<p className={chain.detail}>{check.detail ?? ""}</p>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -191,39 +217,45 @@ function Chain() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="chain-wrap" aria-label="signal chain">
|
||||
<div className={cx("chain", probe !== null && "powered")}>
|
||||
<section className="@container pt-4" aria-label="signal chain">
|
||||
{/* `chain powered` keys the lamps' one power-up flicker in components.css */}
|
||||
<div
|
||||
className={cx(
|
||||
"chain w-full grid items-center gap-y-3 [grid-template-columns:1fr] [grid-template-areas:'tmdb'_'prow'_'t1'_'master'_'out'_'sink'] @cells:gap-y-6 @cells:[grid-template-columns:1fr_2.5rem_1.2fr_2.5rem_1fr] @cells:[grid-template-areas:'tmdb_t1_master_out_sink'_'prow_t2_master_out_sink']",
|
||||
probe !== null && "powered",
|
||||
)}
|
||||
>
|
||||
<ChainModule
|
||||
name="tmdb"
|
||||
area="area-tmdb"
|
||||
area="[grid-area:tmdb]"
|
||||
duty="metadata in"
|
||||
defaultDetail="titles, languages, release dates"
|
||||
module={checks.tmdb}
|
||||
strike={0}
|
||||
/>
|
||||
<Bus area="area-t1" tone={traces.tmdb} />
|
||||
<Bus area="[grid-area:t1]" tone={traces.tmdb} />
|
||||
<ChainModule
|
||||
name="prowlarr"
|
||||
area="area-prowlarr"
|
||||
area="[grid-area:prow]"
|
||||
duty="indexers in"
|
||||
defaultDetail="torznab search and rss"
|
||||
module={checks.prowlarr}
|
||||
strike={1}
|
||||
/>
|
||||
<Bus area="area-t2" tone={traces.prowlarr} />
|
||||
<Bus area="@cells:[grid-area:t2]" tone={traces.prowlarr} />
|
||||
<ChainModule
|
||||
name="arr"
|
||||
area="area-master"
|
||||
area="[grid-area:master]"
|
||||
duty="reconcile core"
|
||||
defaultDetail="decide · find · fetch · import"
|
||||
module={master}
|
||||
strike={2}
|
||||
master
|
||||
/>
|
||||
<Bus area="area-out" tone={traces.master} />
|
||||
<Bus area="[grid-area:out]" tone={traces.master} />
|
||||
<ChainModule
|
||||
name="qbittorrent"
|
||||
area="area-qbittorrent"
|
||||
area="[grid-area:sink]"
|
||||
duty="torrents out"
|
||||
defaultDetail="webui · grab and seed"
|
||||
module={checks.qbit}
|
||||
@@ -231,7 +263,11 @@ function Chain() {
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
<section className="chain-lane" aria-label="subtitle lane" hidden={lane === null}>
|
||||
<section
|
||||
className="mt-4 grid [grid-template-columns:repeat(auto-fit,minmax(12rem,1fr))] gap-3 [align-items:stretch]"
|
||||
aria-label="subtitle lane"
|
||||
hidden={lane === null}
|
||||
>
|
||||
{lane?.map((entry) => (
|
||||
<SubtitleModule
|
||||
key={entry.name}
|
||||
@@ -247,10 +283,18 @@ function Chain() {
|
||||
|
||||
/* ---- form primitives ---------------------------------------------------- */
|
||||
|
||||
/** The subtitle panel spaces its labels out: they head groups there, not just fields. */
|
||||
const SpacedLabels = createContext(false);
|
||||
|
||||
function labelClass(spaced: boolean): string {
|
||||
return cx("readout dim", form.label, spaced && "block mt-4 mx-0 mb-2");
|
||||
}
|
||||
|
||||
function Field({ label, children }: { label: string; children: ReactNode }) {
|
||||
const spaced = useContext(SpacedLabels);
|
||||
return (
|
||||
<div className="field">
|
||||
<span className="field-label readout dim">{label}</span>
|
||||
<div className={form.field}>
|
||||
<span className={labelClass(spaced)}>{label}</span>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
@@ -283,7 +327,7 @@ function TextInput({
|
||||
<input
|
||||
ref={ref}
|
||||
type="text"
|
||||
className="form-input readout"
|
||||
className={cx("readout", form.input)}
|
||||
value={value}
|
||||
placeholder={placeholder}
|
||||
spellCheck={false}
|
||||
@@ -299,12 +343,13 @@ function TextInput({
|
||||
function NumberInput({
|
||||
value,
|
||||
onChange,
|
||||
className,
|
||||
className = "w-full",
|
||||
placeholder,
|
||||
...rest
|
||||
}: {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
/** Width and flex: the full field by default. */
|
||||
className?: string;
|
||||
placeholder?: string;
|
||||
"aria-label"?: string;
|
||||
@@ -312,7 +357,7 @@ function NumberInput({
|
||||
return (
|
||||
<input
|
||||
type="number"
|
||||
className={cx("form-input readout form-num", className)}
|
||||
className={cx("readout", form.inputBare, className)}
|
||||
value={value}
|
||||
placeholder={placeholder}
|
||||
onChange={(event) => onChange(event.target.value)}
|
||||
@@ -343,7 +388,7 @@ function Select({
|
||||
return (
|
||||
<select
|
||||
ref={ref}
|
||||
className="form-input readout"
|
||||
className={cx("readout", form.input, form.select)}
|
||||
value={value}
|
||||
disabled={disabled}
|
||||
onChange={(event) => onChange(event.target.value)}
|
||||
@@ -389,10 +434,10 @@ function PanelActions({
|
||||
onCancel?: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="add-actions">
|
||||
<div className={PANEL_ACTIONS}>
|
||||
<Control text={saveLabel} disabled={busy} onClick={save} />
|
||||
{onCancel && <Control text="cancel" quiet onClick={onCancel} />}
|
||||
<NoteLine note={note} className="add-note readout" />
|
||||
<NoteLine note={note} className={cx("readout", PANEL_NOTE)} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -432,8 +477,8 @@ function RootPanel({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="edit-panel add-panel">
|
||||
<div className="form-grid">
|
||||
<div className={PANEL}>
|
||||
<div className={form.grid}>
|
||||
<Field label="kind">
|
||||
<Select
|
||||
options={["movie", "tv"]}
|
||||
@@ -486,6 +531,10 @@ type SourceKey = (typeof SOURCES)[number];
|
||||
|
||||
const DV_PROFILES = ["5", "7", "8"] as const;
|
||||
|
||||
/** four numbers and a label share a phone's width, so the inputs shrink
|
||||
* rather than push the line past the gutter */
|
||||
const BAND_NUM = "w-full grow shrink basis-0 min-w-0 max-w-band";
|
||||
|
||||
function newPolicyDoc(): Omit<PolicyDoc, "id"> {
|
||||
return {
|
||||
name: "",
|
||||
@@ -628,8 +677,8 @@ function PolicyPanel({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="edit-panel add-panel">
|
||||
<div className="form-grid">
|
||||
<div className={PANEL}>
|
||||
<div className={form.grid}>
|
||||
<Field label="name">
|
||||
<TextInput value={name} onChange={setName} placeholder="policy name" autoFocus />
|
||||
</Field>
|
||||
@@ -664,28 +713,28 @@ function PolicyPanel({
|
||||
const set = (key: keyof BandFields) => (value: string) =>
|
||||
setBands({ ...bands, [resolution]: { ...band, [key]: value } });
|
||||
return (
|
||||
<div key={resolution} className="band-line" data-resolution={resolution}>
|
||||
<span className="field-label readout dim">{resolution}</span>
|
||||
<div key={resolution} className="flex items-center gap-2" data-resolution={resolution}>
|
||||
<span className={cx(labelClass(false), "w-band-label")}>{resolution}</span>
|
||||
<NumberInput
|
||||
className="band-num"
|
||||
className={BAND_NUM}
|
||||
value={band.floor}
|
||||
onChange={set("floor")}
|
||||
aria-label={`${resolution} floor GiB`}
|
||||
/>
|
||||
<NumberInput
|
||||
className="band-num"
|
||||
className={BAND_NUM}
|
||||
value={band.target}
|
||||
onChange={set("target")}
|
||||
aria-label={`${resolution} target GiB`}
|
||||
/>
|
||||
<NumberInput
|
||||
className="band-num"
|
||||
className={BAND_NUM}
|
||||
value={band.penalty}
|
||||
onChange={set("penalty")}
|
||||
aria-label={`${resolution} penalty points per GiB over`}
|
||||
/>
|
||||
<NumberInput
|
||||
className="band-num"
|
||||
className={BAND_NUM}
|
||||
value={band.ceiling}
|
||||
onChange={set("ceiling")}
|
||||
placeholder="∞"
|
||||
@@ -763,7 +812,7 @@ function SettingsRow({
|
||||
<Row
|
||||
kind="setting"
|
||||
title={title}
|
||||
titleClassName="readout"
|
||||
titleStyle="readout"
|
||||
meta={chips.map((text) => <Chip key={text}>{text}</Chip>)}
|
||||
actions={[
|
||||
{
|
||||
@@ -935,129 +984,130 @@ function SubtitlesPanel({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="add-panel subtitle-panel">
|
||||
<div className="form-grid">
|
||||
<Field label="wanted languages">
|
||||
<TextInput value={wanted} onChange={setWanted} placeholder="pt-PT, en" />
|
||||
</Field>
|
||||
<Field label="translation engine">
|
||||
<Select
|
||||
options={["none", ...settings.available_engines]}
|
||||
value={engine}
|
||||
onChange={setEngine}
|
||||
disabled={!hasEngines}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="remote command timeout (s)">
|
||||
<NumberInput value={timeout} onChange={setTimeoutValue} />
|
||||
</Field>
|
||||
</div>
|
||||
{!hasEngines && (
|
||||
<p className="add-note readout dim">
|
||||
no translation engine is compiled into this binary — pick is unavailable
|
||||
</p>
|
||||
)}
|
||||
{/* Their own labelled row rather than two more cells in the grid above:
|
||||
paired, they belong to one engine, and a base URL needs the width. */}
|
||||
{hasOpenAi && (
|
||||
<>
|
||||
<p className="field-label readout dim">
|
||||
openai-compatible endpoint — blank means its default
|
||||
<SpacedLabels.Provider value={true}>
|
||||
<div className={PANEL}>
|
||||
<div className={form.grid}>
|
||||
<Field label="wanted languages">
|
||||
<TextInput value={wanted} onChange={setWanted} placeholder="pt-PT, en" />
|
||||
</Field>
|
||||
<Field label="translation engine">
|
||||
<Select
|
||||
options={["none", ...settings.available_engines]}
|
||||
value={engine}
|
||||
onChange={setEngine}
|
||||
disabled={!hasEngines}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="remote command timeout (s)">
|
||||
<NumberInput value={timeout} onChange={setTimeoutValue} />
|
||||
</Field>
|
||||
</div>
|
||||
{!hasEngines && (
|
||||
<p className={cx("readout dim", PANEL_NOTE)}>
|
||||
no translation engine is compiled into this binary — pick is unavailable
|
||||
</p>
|
||||
<div className="form-grid">
|
||||
<Field label="base url">
|
||||
<TextInput
|
||||
value={baseUrl}
|
||||
onChange={setBaseUrl}
|
||||
placeholder="optional — e.g. http://127.0.0.1:8080/v1"
|
||||
aria-label="openai base url"
|
||||
/>
|
||||
</Field>
|
||||
<Field label="model">
|
||||
<TextInput
|
||||
value={model}
|
||||
onChange={setModel}
|
||||
placeholder="optional — e.g. gpt-4o-mini"
|
||||
aria-label="openai model"
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{hasEngines && (
|
||||
<>
|
||||
<p className="field-label readout dim">translator daily budgets</p>
|
||||
<div className="form-grid">
|
||||
{settings.available_engines.map((name) => (
|
||||
<Field key={name} label={name}>
|
||||
<NumberInput
|
||||
value={translators[name] ?? ""}
|
||||
onChange={(value) => setTranslators({ ...translators, [name]: value })}
|
||||
aria-label={`${name} daily budget`}
|
||||
)}
|
||||
{/* Their own labelled row rather than two more cells in the grid above:
|
||||
paired, they belong to one engine, and a base URL needs the width. */}
|
||||
{hasOpenAi && (
|
||||
<>
|
||||
<p className={labelClass(true)}>openai-compatible endpoint — blank means its default</p>
|
||||
<div className={form.grid}>
|
||||
<Field label="base url">
|
||||
<TextInput
|
||||
value={baseUrl}
|
||||
onChange={setBaseUrl}
|
||||
placeholder="optional — e.g. http://127.0.0.1:8080/v1"
|
||||
aria-label="openai base url"
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<p className="field-label readout dim">providers — enabled, and in priority order</p>
|
||||
<ul className="provider-list">
|
||||
{providers.map((entry, index) => (
|
||||
<Row
|
||||
key={entry.provider}
|
||||
kind="provider"
|
||||
lead={
|
||||
<label className="provider-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="provider-toggle"
|
||||
checked={entry.enabled}
|
||||
aria-label={`enable ${entry.provider}`}
|
||||
onChange={(event) => updateProvider(index, { enabled: event.target.checked })}
|
||||
<Field label="model">
|
||||
<TextInput
|
||||
value={model}
|
||||
onChange={setModel}
|
||||
placeholder="optional — e.g. gpt-4o-mini"
|
||||
aria-label="openai model"
|
||||
/>
|
||||
</label>
|
||||
}
|
||||
title={entry.provider}
|
||||
actions={[
|
||||
{
|
||||
node: (
|
||||
</Field>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{hasEngines && (
|
||||
<>
|
||||
<p className={labelClass(true)}>translator daily budgets</p>
|
||||
<div className={form.grid}>
|
||||
{settings.available_engines.map((name) => (
|
||||
<Field key={name} label={name}>
|
||||
<NumberInput
|
||||
className="provider-budget"
|
||||
value={entry.budget}
|
||||
onChange={(value) => updateProvider(index, { budget: value })}
|
||||
aria-label={`${entry.provider} daily budget`}
|
||||
value={translators[name] ?? ""}
|
||||
onChange={(value) => setTranslators({ ...translators, [name]: value })}
|
||||
aria-label={`${name} daily budget`}
|
||||
/>
|
||||
),
|
||||
width: "word",
|
||||
},
|
||||
{
|
||||
node: (
|
||||
<MoveButton
|
||||
direction="up"
|
||||
label={`move ${entry.provider} up`}
|
||||
disabled={index === 0}
|
||||
onClick={() => move(index, -1)}
|
||||
</Field>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<p className={labelClass(true)}>providers — enabled, and in priority order</p>
|
||||
<ul className="mt-0 mx-0 mb-3 p-0 list-none">
|
||||
{providers.map((entry, index) => (
|
||||
<Row
|
||||
key={entry.provider}
|
||||
kind="provider"
|
||||
lead={
|
||||
<label className="provider-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="size-line m-0 accent-accent"
|
||||
checked={entry.enabled}
|
||||
aria-label={`enable ${entry.provider}`}
|
||||
onChange={(event) => updateProvider(index, { enabled: event.target.checked })}
|
||||
/>
|
||||
),
|
||||
width: "icon",
|
||||
},
|
||||
{
|
||||
node: (
|
||||
<MoveButton
|
||||
direction="down"
|
||||
label={`move ${entry.provider} down`}
|
||||
disabled={index === providers.length - 1}
|
||||
onClick={() => move(index, 1)}
|
||||
/>
|
||||
),
|
||||
width: "icon",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
<PanelActions save={save} saveLabel="save subtitles" busy={busy} note={note} />
|
||||
</div>
|
||||
</label>
|
||||
}
|
||||
title={entry.provider}
|
||||
actions={[
|
||||
{
|
||||
node: (
|
||||
<NumberInput
|
||||
className="w-budget"
|
||||
value={entry.budget}
|
||||
onChange={(value) => updateProvider(index, { budget: value })}
|
||||
aria-label={`${entry.provider} daily budget`}
|
||||
/>
|
||||
),
|
||||
width: "word",
|
||||
fill: false,
|
||||
},
|
||||
{
|
||||
node: (
|
||||
<MoveButton
|
||||
direction="up"
|
||||
label={`move ${entry.provider} up`}
|
||||
disabled={index === 0}
|
||||
onClick={() => move(index, -1)}
|
||||
/>
|
||||
),
|
||||
width: "icon",
|
||||
},
|
||||
{
|
||||
node: (
|
||||
<MoveButton
|
||||
direction="down"
|
||||
label={`move ${entry.provider} down`}
|
||||
disabled={index === providers.length - 1}
|
||||
onClick={() => move(index, 1)}
|
||||
/>
|
||||
),
|
||||
width: "icon",
|
||||
},
|
||||
]}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
<PanelActions save={save} saveLabel="save subtitles" busy={busy} note={note} />
|
||||
</div>
|
||||
</SpacedLabels.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1116,33 +1166,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">
|
||||
<DeckHead label="signal chain" labelId="label-chain" labelClass="section-title" />
|
||||
<Section labelledBy="label-chain">
|
||||
<DeckHead label="signal chain" labelId="label-chain" titled="section" />
|
||||
<Chain />
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section className="deck-group" hidden={loaded === null} aria-labelledby="label-roots">
|
||||
<DeckHead label="roots" labelId="label-roots" labelClass="section-title">
|
||||
<Section hidden={loaded === null} labelledBy="label-roots">
|
||||
<DeckHead label="roots" labelId="label-roots" titled="section">
|
||||
<button
|
||||
type="button"
|
||||
className="control control-quiet head-action"
|
||||
className={cx(control({ look: "quiet" }), "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 +1209,7 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</Rows>
|
||||
{addingRoot && loaded !== null && (
|
||||
<RootPanel
|
||||
root={null}
|
||||
@@ -1173,22 +1221,20 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
|
||||
onCancel={() => setAddingRoot(false)}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section className="deck-group" hidden={loaded === null} aria-labelledby="label-policies">
|
||||
<DeckHead label="policies" labelId="label-policies" labelClass="section-title">
|
||||
<Section hidden={loaded === null} labelledBy="label-policies">
|
||||
<DeckHead label="policies" labelId="label-policies" titled="section">
|
||||
<button
|
||||
type="button"
|
||||
className="control control-quiet head-action"
|
||||
className={cx(control({ look: "quiet" }), "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 +1253,7 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</Rows>
|
||||
{addingPolicy && (
|
||||
<PolicyPanel
|
||||
policy={null}
|
||||
@@ -1218,14 +1264,10 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
|
||||
onCancel={() => setAddingPolicy(false)}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
</Section>
|
||||
|
||||
<section
|
||||
className="deck-group"
|
||||
hidden={loaded === null}
|
||||
aria-labelledby="label-settings-subtitles"
|
||||
>
|
||||
<DeckHead label="subtitles" labelId="label-settings-subtitles" labelClass="section-title" />
|
||||
<Section hidden={loaded === null} labelledBy="label-settings-subtitles">
|
||||
<DeckHead label="subtitles" labelId="label-settings-subtitles" titled="section" />
|
||||
<GroupNote
|
||||
short="Provider logins and translator keys are not shown here."
|
||||
more="They live in the daemon's config and environment (§10), along with the remote-command template."
|
||||
@@ -1235,7 +1277,7 @@ export function SettingsView({ hidden }: { hidden: boolean }) {
|
||||
<SubtitlesPanel key={loaded.paint} settings={loaded.subtitles} onSaved={reload} />
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Section>
|
||||
</Deck>
|
||||
);
|
||||
}
|
||||
|
||||
+45
-17
@@ -4,6 +4,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Buckets, type DeckState, type ReleaseActions } from "../buckets";
|
||||
import { LAYER, type TvDeckRequest, useEscape, useNav } from "../context";
|
||||
import { control, cx, detail, type } from "../look";
|
||||
import {
|
||||
blacklistAdvice,
|
||||
blacklistClass,
|
||||
@@ -16,7 +17,9 @@ import {
|
||||
type SeasonPackState,
|
||||
} from "../releases";
|
||||
import { waiveAndGrabTv } from "../series";
|
||||
import { IconControl, type Status, StatusSlot } from "../ui";
|
||||
import { Deck, IconControl, type Status, StatusSlot } from "../ui";
|
||||
|
||||
const NOTICE_LINE = "m-0 max-w-notice text-sm text-ink-muted";
|
||||
|
||||
/** §6.2: the sweep runs on the daemon's cadence. Poll modestly, give up softly. */
|
||||
const TV_SWEEP_POLL_MS = 5000;
|
||||
@@ -358,51 +361,76 @@ export function TvDeckView({ request }: { request: TvDeckRequest }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="deck detail" aria-label="season and episode releases">
|
||||
<header className="page-head">
|
||||
<IconControl glyph="back" label="back" ref={back} onClick={nav.close} />
|
||||
<div className="page-id">
|
||||
<h2 className="page-title">{request.title}</h2>
|
||||
<span className="page-sub readout">{request.sub ?? ""}</span>
|
||||
<Deck detail label="season and episode releases">
|
||||
{/* a detail page without a hero still gives its head room under the rail */}
|
||||
<header className={cx(detail.pageHead, "pt-2")}>
|
||||
<IconControl glyph="back" label="back" look="bare" ref={back} onClick={nav.close} />
|
||||
<div className="grid min-w-0">
|
||||
<h2 className={cx(type.pageTitle, "flex-initial")}>{request.title}</h2>
|
||||
<span className={cx(detail.pageMeta, "truncate")}>{request.sub ?? ""}</span>
|
||||
</div>
|
||||
</header>
|
||||
<div className="actionbar">
|
||||
<div className={detail.actionbar}>
|
||||
<button
|
||||
type="button"
|
||||
className="control"
|
||||
className={control()}
|
||||
disabled={sweeping}
|
||||
onClick={() => void startSweep()}
|
||||
>
|
||||
search indexers
|
||||
</button>
|
||||
</div>
|
||||
<StatusSlot status={status} className="deck-status readout" />
|
||||
<StatusSlot status={status} variant="deck" />
|
||||
<section
|
||||
className="deck-notice"
|
||||
className={cx(
|
||||
"mb-6 pt-3 px-4 pb-4 border rounded-panel",
|
||||
failure === null
|
||||
? "bg-panel border-line"
|
||||
: {
|
||||
policy:
|
||||
"[background:oklch(from_var(--signal-warn)_l_c_h/7%)] [border-color:oklch(from_var(--signal-warn)_l_c_h/40%)]",
|
||||
release:
|
||||
"[background:oklch(from_var(--signal-fault)_l_c_h/7%)] [border-color:oklch(from_var(--signal-fault)_l_c_h/40%)]",
|
||||
unknown: "bg-panel border-line",
|
||||
}[blacklistClass(failure.reason)],
|
||||
)}
|
||||
hidden={failure === null}
|
||||
data-blacklist={failure === null ? undefined : blacklistClass(failure.reason)}
|
||||
aria-labelledby="tv-failure-label"
|
||||
>
|
||||
<h3 className="deck-label" id="tv-failure-label">
|
||||
<h3
|
||||
className={cx(
|
||||
type.label,
|
||||
"mb-2",
|
||||
failure === null
|
||||
? "text-ink-muted"
|
||||
: {
|
||||
policy: "text-signal-warn",
|
||||
release: "text-signal-fault",
|
||||
unknown: "text-ink-muted",
|
||||
}[blacklistClass(failure.reason)],
|
||||
)}
|
||||
id="tv-failure-label"
|
||||
>
|
||||
pack abandoned at import
|
||||
</h3>
|
||||
<p className="notice-release readout">
|
||||
<p className="readout mt-0 mx-0 mb-2 [overflow-wrap:anywhere] text-xs text-ink">
|
||||
{failure === null
|
||||
? ""
|
||||
: failure.failed_at === null
|
||||
? failure.release
|
||||
: `${failure.release} · ${formatSweepAge(failure.failed_at)}`}
|
||||
</p>
|
||||
<p className="notice-line">{failureWhat}</p>
|
||||
<p className="notice-line">
|
||||
<p className={NOTICE_LINE}>{failureWhat}</p>
|
||||
<p className={cx(NOTICE_LINE, "mt-2")}>
|
||||
{failure === null ? "" : `${blacklistAdvice(failure.reason)}.`}
|
||||
</p>
|
||||
<p className="notice-line dim">
|
||||
<p className={cx(NOTICE_LINE, "mt-2 dim")}>
|
||||
Nothing was imported, and the torrent was left where it is: nothing is deleted early to
|
||||
satisfy the library (§7.3).
|
||||
</p>
|
||||
</section>
|
||||
<Buckets state={deck} actions={actions} />
|
||||
</main>
|
||||
</Deck>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user