refactor(web): the row primitive as utilities
Rows, slots, trays, notes, skeletons, scores and the release cells. The linked-row pointer rules key on the row knowing it is a link, not on :has(). Refs #280 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6c183c5d98
commit
a4aa423b3a
+34
-17
@@ -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,
|
||||
@@ -117,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>
|
||||
);
|
||||
@@ -372,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)}`}
|
||||
>
|
||||
@@ -395,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],
|
||||
@@ -411,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>
|
||||
@@ -426,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>
|
||||
)
|
||||
|
||||
@@ -313,427 +313,6 @@ body {
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
/* ---- the row ------------------------------------------------------------------ */
|
||||
|
||||
/* lead | body | actions, then the tray full width. The body is minmax(0, 1fr):
|
||||
whatever is too long is clipped inside it and never pushes the actions. */
|
||||
.r {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
grid-template-areas:
|
||||
"lead body act"
|
||||
"tray tray tray";
|
||||
align-items: center;
|
||||
column-gap: var(--space-3);
|
||||
min-height: var(--row-min);
|
||||
padding: var(--space-2) 0;
|
||||
border-bottom: 1px solid oklch(from var(--line) l c h / 60%);
|
||||
}
|
||||
|
||||
.r[data-nolead] {
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
grid-template-areas:
|
||||
"body act"
|
||||
"tray tray";
|
||||
}
|
||||
|
||||
.r-lead {
|
||||
grid-area: lead;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.r-body {
|
||||
grid-area: body;
|
||||
display: grid;
|
||||
align-content: center;
|
||||
gap: var(--space-1);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.r-title {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.r-title .yr {
|
||||
margin-left: var(--space-2);
|
||||
font-family: var(--font-readout);
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 400;
|
||||
color: var(--ink-faint);
|
||||
}
|
||||
|
||||
/* one line of chips; what does not fit fades out at the edge rather than
|
||||
being cut through a word */
|
||||
.r-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
gap: var(--space-1);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
mask-image: linear-gradient(to right, var(--ink) calc(100% - 1.5rem), transparent);
|
||||
}
|
||||
|
||||
.r-meta:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.r-sub {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
font-size: var(--text-2xs);
|
||||
line-height: 1.3;
|
||||
color: var(--ink-faint);
|
||||
}
|
||||
|
||||
/* the full string, on a tap (§9.3: the release name is evidence, on expand) */
|
||||
.r-sub[data-full] {
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.r-sub[data-tone="fault"] {
|
||||
color: var(--signal-fault);
|
||||
}
|
||||
|
||||
.r-act {
|
||||
grid-area: act;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
/* every slot has its width whether or not it holds a control, so a row of a
|
||||
kind keeps one action column */
|
||||
.r-slot {
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.r-slot[data-width="icon"] {
|
||||
width: var(--control-h);
|
||||
}
|
||||
|
||||
.r-slot[data-width="toggle"] {
|
||||
width: var(--toggle-w);
|
||||
}
|
||||
|
||||
.r-slot[data-width="word"] {
|
||||
min-width: var(--word-w);
|
||||
}
|
||||
|
||||
.r-slot[data-wide] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.r-chevron {
|
||||
color: var(--ink-faint);
|
||||
}
|
||||
|
||||
.r-chevron .icon {
|
||||
width: 0.875rem;
|
||||
height: 0.875rem;
|
||||
}
|
||||
|
||||
/* the row as a link: a stretched button under everything; real controls sit
|
||||
above it, everything else lets the tap through */
|
||||
.r-link {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 0;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
transition: background 150ms var(--ease-out);
|
||||
}
|
||||
|
||||
.r-link:hover {
|
||||
background: var(--highlight);
|
||||
}
|
||||
|
||||
.r-link:focus-visible {
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.r:has(> .r-link) > :not(.r-link) {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.r:has(> .r-link) button:not(.r-link),
|
||||
.r:has(> .r-link) a,
|
||||
.r:has(> .r-link) select,
|
||||
.r:has(> .r-link) input,
|
||||
.r:has(> .r-link) [role="button"] {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.r-tray {
|
||||
grid-area: tray;
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
min-width: 0;
|
||||
padding-top: var(--space-2);
|
||||
}
|
||||
|
||||
.r-tray:not(:has(> :not([hidden]))) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.r:has(> .r-link) > .r-tray {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.r-note {
|
||||
margin: 0;
|
||||
font-size: var(--text-xs);
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
.r-note[data-tone="fault"] {
|
||||
color: var(--signal-fault);
|
||||
}
|
||||
|
||||
.r-note[data-tone="warn"] {
|
||||
color: var(--signal-warn);
|
||||
}
|
||||
|
||||
/* the ⋯ tray: the row's other actions, labelled, full width */
|
||||
.r-morepanel {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.r-empty {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
min-height: var(--row-min);
|
||||
padding: var(--space-2) 0;
|
||||
font-size: var(--text-xs);
|
||||
color: var(--ink-muted);
|
||||
border-bottom: 1px solid oklch(from var(--line) l c h / 60%);
|
||||
}
|
||||
|
||||
.r-empty[data-tone="fault"] {
|
||||
color: var(--signal-fault);
|
||||
}
|
||||
|
||||
/* row leads */
|
||||
.row-poster,
|
||||
.row-poster-blank {
|
||||
display: block;
|
||||
width: 2.25rem;
|
||||
aspect-ratio: 2 / 3;
|
||||
flex: none;
|
||||
object-fit: cover;
|
||||
background: var(--panel-raised);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.lead-tag {
|
||||
width: var(--control-h);
|
||||
text-align: center;
|
||||
font-size: var(--text-xs);
|
||||
font-weight: 600;
|
||||
color: var(--ink-faint);
|
||||
}
|
||||
|
||||
.lead-lamp {
|
||||
display: flex;
|
||||
width: var(--space-4);
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* score: the release's lead, on the list-relative heat scale (issue 111) */
|
||||
.score {
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
width: var(--control-h);
|
||||
height: var(--control-h);
|
||||
font-family: var(--font-readout);
|
||||
font-size: var(--text-sm);
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--ink-muted);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.score[data-score="0"] {
|
||||
color: var(--score-0);
|
||||
border-color: oklch(from var(--score-0) l c h / 50%);
|
||||
}
|
||||
.score[data-score="1"] {
|
||||
color: var(--score-1);
|
||||
border-color: oklch(from var(--score-1) l c h / 50%);
|
||||
}
|
||||
.score[data-score="2"] {
|
||||
color: var(--score-2);
|
||||
border-color: oklch(from var(--score-2) l c h / 50%);
|
||||
}
|
||||
.score[data-score="3"] {
|
||||
color: var(--score-3);
|
||||
border-color: oklch(from var(--score-3) l c h / 50%);
|
||||
}
|
||||
.score[data-score="4"] {
|
||||
color: var(--score-4);
|
||||
border-color: oklch(from var(--score-4) l c h / 50%);
|
||||
}
|
||||
.score[data-score="5"] {
|
||||
color: var(--score-5);
|
||||
border-color: oklch(from var(--score-5) l c h / 50%);
|
||||
}
|
||||
.score[data-score="6"] {
|
||||
color: var(--score-6);
|
||||
border-color: oklch(from var(--score-6) l c h / 50%);
|
||||
}
|
||||
|
||||
/* season disclosure: the lead of a season row */
|
||||
.disclose-lead .icon {
|
||||
transition: transform 200ms var(--ease-out);
|
||||
}
|
||||
|
||||
.disclose-lead[aria-expanded="true"] .icon {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.r[data-row="season"] > .r-body > .r-title {
|
||||
font-family: var(--font-display);
|
||||
font-size: var(--text-base);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.episodes {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
background: oklch(from var(--panel) l c h / 50%);
|
||||
}
|
||||
|
||||
/* release cells: the §9.3 fixed columns, from 46rem; the chips carry them below */
|
||||
.r-cells,
|
||||
.colhead {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.colhead-cells,
|
||||
.r-cells {
|
||||
grid-template-columns: 4rem 4.5rem 4.5rem 6rem 7rem 3.5rem;
|
||||
gap: var(--space-4);
|
||||
}
|
||||
|
||||
.r-cells > span {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
font-family: var(--font-readout);
|
||||
font-size: var(--text-xs);
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
.r-cells > .num,
|
||||
.colhead-cells > .num {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.r-cells > .unclaimed {
|
||||
color: var(--ink-faint);
|
||||
}
|
||||
|
||||
.colhead {
|
||||
grid-template-columns: var(--control-h) minmax(0, 1fr) var(--word-w);
|
||||
column-gap: var(--space-3);
|
||||
padding: var(--space-2) 0 var(--space-1);
|
||||
border-bottom: 1px solid oklch(from var(--line) l c h / 60%);
|
||||
}
|
||||
|
||||
.colhead-cells {
|
||||
grid-column: 2;
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.colhead-score,
|
||||
.colhead-cells > span {
|
||||
font-family: var(--font-readout);
|
||||
font-size: var(--text-2xs);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--ink-faint);
|
||||
}
|
||||
|
||||
/* skeleton: the row's own geometry, no shimmer (Dead-Air) */
|
||||
.r-skel {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.skel {
|
||||
display: block;
|
||||
background: var(--panel-raised);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.skel-lead {
|
||||
width: 2.25rem;
|
||||
height: 3.375rem;
|
||||
}
|
||||
|
||||
.skel-line {
|
||||
width: 70%;
|
||||
height: 0.75rem;
|
||||
}
|
||||
|
||||
.skel-short {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
@container (min-width: 40rem) {
|
||||
.r-slot[data-wide] {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.r-slot[data-narrow],
|
||||
.r-morepanel {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.r-title {
|
||||
font-size: var(--text-base);
|
||||
}
|
||||
}
|
||||
|
||||
@container (min-width: 46rem) {
|
||||
.r[data-row="release"] .r-meta [data-cell] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.r[data-row="release"] .r-cells,
|
||||
.colhead {
|
||||
display: grid;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- poster grid (§9.6, issue 151) -------------------------------------- */
|
||||
|
||||
.grid-rows {
|
||||
@@ -1270,15 +849,6 @@ body {
|
||||
margin-top: var(--space-2);
|
||||
}
|
||||
|
||||
.r-why {
|
||||
font-size: var(--text-xs);
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
.r-why[data-blacklist="release"] {
|
||||
color: oklch(from var(--signal-fault) 0.78 0.1 h);
|
||||
}
|
||||
|
||||
/* ---- subtitles (§15, §9.6) -------------------------------------------- */
|
||||
|
||||
/* the languages read as one string, as wide as the wanted set can need */
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
|
||||
import { type CSSProperties, type ReactNode, useEffect, useRef, useState } from "react";
|
||||
import { Icon, ProviderMark, Star } from "./icons";
|
||||
import { control, type } from "./look";
|
||||
import { control, NOTE, type } from "./look";
|
||||
import { formatMetaLine, formatRating, formatVoteCount, tmdbImage } from "./movie";
|
||||
import { type ActionOutcome, formatSize, totalSize } from "./releases";
|
||||
import { cx, flag, IconControl, IconLink, type Note, NoteLine } from "./ui";
|
||||
@@ -109,7 +109,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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -255,3 +255,44 @@ export function chip(state: ChipState = {}): string {
|
||||
|
||||
/** 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",
|
||||
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";
|
||||
|
||||
+11
-4
@@ -7,6 +7,11 @@ 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";
|
||||
|
||||
@@ -39,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>
|
||||
);
|
||||
}
|
||||
@@ -201,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`}
|
||||
@@ -218,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>
|
||||
);
|
||||
|
||||
@@ -83,6 +83,10 @@
|
||||
--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;
|
||||
|
||||
--container-deck: var(--deck-max);
|
||||
--container-measure: var(--measure);
|
||||
@@ -111,6 +115,7 @@
|
||||
--radius-micro: 2px;
|
||||
--radius-chip: 3px;
|
||||
|
||||
--font-weight-normal: 400;
|
||||
--font-weight-semibold: 600;
|
||||
--font-weight-bold: 700;
|
||||
|
||||
@@ -123,6 +128,7 @@
|
||||
--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 */
|
||||
|
||||
+130
-33
@@ -16,7 +16,20 @@ import {
|
||||
useState,
|
||||
} from "react";
|
||||
import { Icon, type IconName, useArmed } from "./icons";
|
||||
import { type ControlLook, chip, control, cx, toggle, toggleLamp, toggleState, type } from "./look";
|
||||
import {
|
||||
type ControlLook,
|
||||
chip,
|
||||
control,
|
||||
cx,
|
||||
NOTE,
|
||||
ROW_RULE,
|
||||
SUB,
|
||||
skel,
|
||||
toggle,
|
||||
toggleLamp,
|
||||
toggleState,
|
||||
type,
|
||||
} from "./look";
|
||||
|
||||
export type Tone = "fault" | "warn";
|
||||
|
||||
@@ -93,10 +106,13 @@ export function IconControl({
|
||||
look,
|
||||
shape = "icon",
|
||||
className,
|
||||
iconClassName,
|
||||
...rest
|
||||
}: 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";
|
||||
}) {
|
||||
@@ -107,7 +123,7 @@ export function IconControl({
|
||||
aria-label={label}
|
||||
{...rest}
|
||||
>
|
||||
<Icon name={glyph} />
|
||||
<Icon name={glyph} className={iconClassName} />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -417,11 +433,12 @@ export interface ActionSlot {
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -431,7 +448,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. */
|
||||
@@ -462,6 +479,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
|
||||
@@ -470,53 +499,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}
|
||||
// a word or a toggle fills its column, so every row's plates line up
|
||||
className={cx("r-slot", slot.width !== "icon" && slot.fill !== false && "*:w-full")}
|
||||
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"
|
||||
@@ -526,15 +595,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>
|
||||
)}
|
||||
@@ -547,18 +624,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>
|
||||
));
|
||||
}
|
||||
@@ -567,14 +654,24 @@ 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>
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
movieNeedsAttention,
|
||||
seriesNeedsAttention,
|
||||
} from "../library";
|
||||
import { seg, segmented } from "../look";
|
||||
import { seg, segmented, skel } from "../look";
|
||||
import { MovieCard, MovieRow, SeriesCard, SeriesRow } from "../rows";
|
||||
import { allRoots, type LibraryMovie, type Root } from "../search";
|
||||
import { Deck, DeckHead, PageBar, Rows, Section, SkeletonRows, useStatus } from "../ui";
|
||||
@@ -57,8 +57,8 @@ function GridSkeleton() {
|
||||
<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={skel.line} />
|
||||
<span className={skel.short} />
|
||||
</span>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { Buckets, type DeckState, type ReleaseActions } from "../buckets";
|
||||
import { LAYER, useEscape, useNav } from "../context";
|
||||
import { Hero, ProviderLink, RemovePanel, type RemoveSubject, TrailerLink } from "../detail";
|
||||
import { control } from "../look";
|
||||
import { control, SUB } from "../look";
|
||||
import {
|
||||
fileName,
|
||||
imdbLink,
|
||||
@@ -84,7 +84,7 @@ function FileRow({
|
||||
<Row
|
||||
kind="file"
|
||||
title={fileName(file.path)}
|
||||
titleClassName="readout"
|
||||
titleStyle="readout"
|
||||
meta={
|
||||
<>
|
||||
<WaiverChip waiver={file.waiver} say={say} />
|
||||
@@ -96,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}
|
||||
/>
|
||||
|
||||
@@ -223,8 +223,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",
|
||||
|
||||
@@ -6,7 +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 } from "../look";
|
||||
import { control, cx } from "../look";
|
||||
import { rottenTomatoesSearch, tmdbSeriesLink, tvdbLink, youtubeLink } from "../movie";
|
||||
import {
|
||||
audienceOf,
|
||||
@@ -184,14 +184,18 @@ function SeasonRow({
|
||||
label={`${short} episodes`}
|
||||
look="lead"
|
||||
className="disclose-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;
|
||||
@@ -284,7 +288,11 @@ function SeasonRow({
|
||||
}
|
||||
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}
|
||||
@@ -405,7 +413,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={
|
||||
<>
|
||||
@@ -689,10 +701,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" />
|
||||
|
||||
@@ -767,7 +767,7 @@ function SettingsRow({
|
||||
<Row
|
||||
kind="setting"
|
||||
title={title}
|
||||
titleClassName="readout"
|
||||
titleStyle="readout"
|
||||
meta={chips.map((text) => <Chip key={text}>{text}</Chip>)}
|
||||
actions={[
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user