refactor(web): move the stylesheet into Tailwind utilities (#281)
ci / web (push) Successful in 33s
e2e / e2e (push) Successful in 1m36s
ci / rust (push) Successful in 1m49s
ci / image (push) Successful in 2m36s

This commit was merged in pull request #281.
This commit is contained in:
2026-11-11 21:14:23 +00:00
parent 5528ac8aa8
commit 5a18facc4f
19 changed files with 1607 additions and 2925 deletions
+64 -36
View File
@@ -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>
)