Merge remote-tracking branch 'origin/main' into fix/255-provider-reorder

# Conflicts:
#	web/src/icons.ts
This commit is contained in:
Miguel Palhas
2026-08-25 22:34:55 +01:00
6 changed files with 262 additions and 106 deletions
+7 -1
View File
@@ -24,7 +24,12 @@ const ICON_PATHS = {
"M11.2 2.4a1.5 1.5 0 0 1 2.1 0l.3.3a1.5 1.5 0 0 1 0 2.1L5.9 12.5l-3.2.8.8-3.2z",
"M10.1 3.5l2.4 2.4",
],
check: ["M3.2 8.4l3.1 3.1 6.5-6.9"],
cog: [
"M6.81 3.56 L7.00 1.68 L9.00 1.68 L9.19 3.56 L11.25 4.75 L12.97 3.97 L13.97 5.71 L12.44 6.81 L12.44 9.19 L13.97 10.29 L12.97 12.03 L11.25 11.25 L9.19 12.44 L9.00 14.32 L7.00 14.32 L6.81 12.44 L4.75 11.25 L3.03 12.03 L2.03 10.29 L3.56 9.19 L3.56 6.81 L2.03 5.71 L3.03 3.97 L4.75 4.75Z",
"M8 5.6a2.4 2.4 0 1 0 0 4.8 2.4 2.4 0 0 0 0-4.8Z",
],
warning: ["M8 1.8l6.2 11H1.8z", "M8 5.3v3.4M8 11.2h.01"],
check: ["M3.2 8.4l3 3 6.6-6.8"],
chevronUp: ["M3 10.2l5-4.6 5 4.6"],
chevronDown: ["M3 5.8l5 4.6 5-4.6"],
} as const;
@@ -73,6 +78,7 @@ export function armedDeleteIcon(
button.className = options.compact
? "control control-quiet control-icon control-micro"
: "control control-quiet control-icon";
button.dataset.kind = "delete";
button.setAttribute("aria-label", label);
button.title = label;
button.replaceChildren(icon("trash"));
+96 -67
View File
@@ -414,7 +414,7 @@ function main() {
library.open();
await movieDetail.open(
route.movieId,
must<HTMLElement>("#nav-library"),
must<HTMLElement>("#wordmark"),
must<HTMLElement>("#library"),
{
kind: "library",
@@ -439,7 +439,7 @@ function main() {
library.open();
await seriesDetail.open(
route.seriesId,
must<HTMLElement>("#nav-library"),
must<HTMLElement>("#wordmark"),
must<HTMLElement>("#library"),
{
kind: "library",
@@ -485,7 +485,7 @@ function main() {
library.open();
await seriesDetail.open(
seriesId,
must<HTMLElement>("#nav-library"),
must<HTMLElement>("#wordmark"),
must<HTMLElement>("#library"),
{ kind: "library" },
);
@@ -496,7 +496,7 @@ function main() {
sub,
seriesId,
target,
origin: must<HTMLElement>("#nav-library"),
origin: must<HTMLElement>("#wordmark"),
returnTo: must<HTMLElement>("#series"),
parentRoute: { kind: "series", seriesId },
});
@@ -701,11 +701,13 @@ function searchMain(
refs.groups.library.rows.append(librarySeriesRow(series, roots, openSeries));
}
}
if (response.tmdb.length > 0) {
// a TMDB hit already in the library group above never repeats here
const tmdbHits = response.tmdb.filter((hit) => !inLibrary.has(hit.tmdb_id));
if (tmdbHits.length > 0) {
refs.groups.tmdb.section.hidden = false;
refs.groups.tmdb.count.textContent = String(response.tmdb.length);
for (const hit of response.tmdb) {
refs.groups.tmdb.rows.append(tmdbRow(hit, inLibrary.has(hit.tmdb_id), fetchRoots));
refs.groups.tmdb.count.textContent = String(tmdbHits.length);
for (const hit of tmdbHits) {
refs.groups.tmdb.rows.append(tmdbRow(hit, fetchRoots));
}
}
}
@@ -835,8 +837,23 @@ function chip(text: string, extra?: (chip: HTMLSpanElement) => void): HTMLSpanEl
return span;
}
/** §4.2 state ramp on a media-state chip; the word carries, colour accelerates. */
/**
* §4.2 state ramp on a media-state chip. `available` is a drawn check glyph —
* a shape, not only a hue, so it still reads greyscale — with the word kept
* as the chip's aria-label; every other state keeps the word on the chip.
*/
function mediaStateChip(state: string, wanted: boolean): HTMLSpanElement {
if (state === "available") {
return chip("", (span) => {
span.replaceChildren(icon("check"));
// a bare span's aria-label is not reliably exposed; role="img" is what
// makes the word reachable once the glyph replaced it
span.setAttribute("role", "img");
span.setAttribute("aria-label", state);
span.dataset.movieState = state;
span.dataset.wanted = String(wanted);
});
}
return chip(state, (span) => {
span.dataset.movieState = state;
span.dataset.wanted = String(wanted);
@@ -1749,7 +1766,7 @@ function libraryRow(
}
chips.append(trailerChip("movie", movie.tmdb_id));
const affordance = document.createElement("span");
affordance.className = "row-add readout";
affordance.className = "row-add control readout";
affordance.textContent = "open";
chips.append(affordance);
body.append(rowTitle(movie.title, movie.year), chips);
@@ -1782,7 +1799,7 @@ function librarySeriesRow(
}
chips.append(trailerChip("tv", series.tmdb_id));
const affordance = document.createElement("span");
affordance.className = "row-add readout";
affordance.className = "row-add control readout";
affordance.textContent = "episodes";
chips.append(affordance);
body.append(rowTitle(series.title, series.year), chips);
@@ -1795,30 +1812,18 @@ function librarySeriesRow(
}
/** A TMDB hit of either kind — the row opens the add flow (§9.2). */
function tmdbRow(
hit: TmdbMovie | TmdbSeries,
inLibrary: boolean,
fetchRoots: () => Promise<Root[]>,
): HTMLLIElement {
function tmdbRow(hit: TmdbMovie | TmdbSeries, fetchRoots: () => Promise<Root[]>): HTMLLIElement {
const { item, row, body, chips } = richRow();
chips.append(chip(hit.original_language));
if (inLibrary) {
chips.append(
chip("in library", (span) => {
span.dataset.verdict = "eligible";
}),
);
} else {
const add = document.createElement("span");
add.className = "row-add readout";
add.textContent = "add";
chips.append(add);
}
const rating = ratingChip(hit.vote_average, hit.vote_count);
if (rating !== null) {
chips.append(rating);
}
chips.append(trailerChip(hit.kind === "series" ? "tv" : "movie", hit.tmdb_id));
const add = document.createElement("span");
add.className = "row-add control readout";
add.textContent = "add";
chips.append(add);
body.append(rowTitle(hit.title, hit.year), chips);
if (hit.overview) {
const overview = document.createElement("span");
@@ -1829,13 +1834,6 @@ function tmdbRow(
row.append(rowPoster(hit.poster_path, hit.title), body);
item.append(row);
if (inLibrary) {
// aria-disabled, not disabled: a dead button would also kill the
// trailer chip's clicks, and that chip stays live on every row
row.setAttribute("aria-disabled", "true");
return item;
}
row.setAttribute("aria-expanded", "false");
row.addEventListener("click", () => {
const open = item.querySelector(".add-panel");
@@ -2079,6 +2077,20 @@ function wireCollapsedToggle(bucket: CollapsedBucketDom) {
// icon() and armedDeleteIcon() live in icons.ts, shared with the settings
// rows (#231); the §9.6 painters below stay here as their only consumer.
/**
* Invisible spacer that reserves a delete control's slot (#254). It is the
* delete control's own box, hidden — a hand-sized guess drifts as soon as the
* icon control's padding changes, and an 8px drift is the misalignment this
* was meant to remove.
*/
function placeholderSlot(): HTMLSpanElement {
const slot = document.createElement("span");
slot.className = "control control-quiet control-icon slot-icon";
slot.setAttribute("aria-hidden", "true");
slot.append(icon("trash"));
return slot;
}
/** §9.6 provider marks, drawn and shipped inline — never a remote image. */
function providerMark(name: "tmdb" | "tvdb" | "imdb" | "rt"): SVGSVGElement {
const svg = document.createElementNS(SVG_NS, "svg");
@@ -3360,7 +3372,6 @@ function libraryMain(
): LibraryView {
const view = must<HTMLElement>("#library");
const deck = must<HTMLElement>("#deck");
const nav = must<HTMLButtonElement>("#nav-library");
const summary = must<HTMLElement>("#library-summary");
const toggle = must<HTMLButtonElement>("#library-toggle");
const status = must<HTMLElement>("#library-status");
@@ -3505,25 +3516,14 @@ function libraryMain(
}
deck.hidden = true;
view.hidden = false;
nav.setAttribute("aria-pressed", "true");
void load();
}
function hide() {
view.hidden = true;
nav.setAttribute("aria-pressed", "false");
sequence += 1;
}
// §9.7: the library is the homepage — the bottom layer. There is nothing
// beneath it, so the nav control never toggles off and Esc has no handler.
nav.addEventListener("click", () => {
if (view.hidden) {
navigate({ kind: "library" });
open();
}
});
toggle.addEventListener("click", () => {
showAll = !showAll;
render();
@@ -3541,12 +3541,7 @@ function seriesRow(
roots: Root[],
open: (id: number, origin: HTMLElement) => void,
): HTMLLIElement {
const item = document.createElement("li");
const row = document.createElement("button");
row.type = "button";
row.className = "row row-tmdb";
const chips = document.createElement("span");
chips.className = "row-chips";
const { item, row, body, chips } = richRow();
const root = roots.find((candidate) => candidate.id === series.root_id);
chips.append(chip(root ? root.audience : `root ${series.root_id}`));
if (series.wanted_episodes > 0) {
@@ -3568,10 +3563,11 @@ function seriesRow(
}),
);
const affordance = document.createElement("span");
affordance.className = "row-add readout";
affordance.className = "row-add control readout";
affordance.textContent = "episodes";
chips.append(affordance);
row.append(rowTitle(series.title, series.year), chips);
body.append(rowTitle(series.title, series.year), chips);
row.append(rowPoster(series.poster_path, series.title), body);
row.addEventListener("click", () => {
open(series.id, row);
});
@@ -4453,10 +4449,29 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
disclose.focus();
});
// season 0 never counts toward tracking or totals (§4.1, §4.2); say so
// the whole line expands the season — the chevron stays the accessible
// control and this is a second way in; clicks on real controls opt out
line.addEventListener("click", (event) => {
if (event.target instanceof Element && event.target.closest("button")) {
return;
}
disclose.click();
});
// season 0 never counts toward tracking or totals (§4.1, §4.2); say so.
// Both forms are rendered and CSS picks one: narrow viewports show the
// SxxEyy-style tag the rest of the app already uses, so the row's controls
// keep their place instead of wrapping under it.
const name = document.createElement("span");
name.className = "season-name";
name.textContent = season.number === 0 ? "specials · s00" : `season ${PAD_TWO(season.number)}`;
const nameLong = document.createElement("span");
nameLong.className = "season-name-long";
nameLong.textContent =
season.number === 0 ? "specials · s00" : `season ${PAD_TWO(season.number)}`;
const nameShort = document.createElement("span");
nameShort.className = "season-name-short";
nameShort.textContent = seasonTag(season.number);
name.append(nameLong, nameShort);
const track = document.createElement("button");
track.type = "button";
@@ -4483,8 +4498,13 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
});
});
const space = document.createElement("span");
space.className = "season-space";
// everything that describes the season shares one shrinkable box; the
// controls sit outside it, so a long flag chip wraps within the head
// rather than pushing search and delete onto a line of their own.
const head = document.createElement("span");
head.className = "season-head";
const actions = document.createElement("span");
actions.className = "season-actions";
const deckBtn = document.createElement("button");
deckBtn.type = "button";
@@ -4514,7 +4534,7 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
});
});
line.append(disclose, name, track, seasonCountsChip(season));
head.append(name, track, seasonCountsChip(season));
// #227: the season the operator's report is about read `0/10` with
// nothing saying a pack had been grabbed, downloaded in full and thrown
// out at import. The counts chip beside this one is exactly the number
@@ -4524,7 +4544,7 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
const kind = blacklistClass(failure.reason);
const when = failure.failed_at === null ? "" : ` ${formatSweepAge(failure.failed_at)}`;
const told = `a pack for this season downloaded in full and failed at import${when} — ${failure.release} · ${blacklistAdvice(failure.reason)}`;
line.append(
head.append(
chip(`import failed · ${blacklistReasonLabel(failure.reason)}`, (span) => {
span.dataset.flag = "import-failed";
span.dataset.blacklist = kind;
@@ -4536,17 +4556,17 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
// The season-level twin of the episode flag above: gone upstream while
// files under it remained.
if (season.vanished) {
line.append(
head.append(
chip("vanished", (span) => {
span.dataset.flag = "vanished";
}),
);
}
line.append(space, deckBtn);
// #174: files go, episodes stop being wanted, the season stays listed.
// Only offered with files on disk — intent alone is the tracked toggle.
let clear: HTMLButtonElement | null = null;
if (season.episodes.some((episode) => filesByEpisode.has(episode.id))) {
const clear = armedDeleteIcon(
clear = armedDeleteIcon(
`remove ${season.number === 0 ? "specials" : `season ${PAD_TWO(season.number)}`} files from disk and stop wanting its episodes — the season stays listed`,
() => {
const currentId = seriesId;
@@ -4555,7 +4575,9 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
}
void removeSeasonFiles(currentId, season.number).then((outcome) => {
if (outcome.kind === "error") {
clear.disabled = false;
if (clear) {
clear.disabled = false;
}
setStatus(`remove failed — ${outcome.detail}`, "fault");
return;
}
@@ -4566,8 +4588,10 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
});
},
);
line.append(clear);
}
// rows without a delete still reserve its slot, so search keeps its column
actions.append(deckBtn, clear ?? placeholderSlot());
line.append(disclose, head, actions);
item.append(line);
const episodes = document.createElement("ul");
@@ -4652,7 +4676,7 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
const note = document.createElement("span");
note.className = "readout dim ep-unaired";
note.textContent = "unaired";
actions.append(note);
actions.append(note, placeholderSlot());
} else {
const want = document.createElement("button");
want.type = "button";
@@ -4699,6 +4723,9 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
});
});
actions.append(deckBtn);
// no delete on a wantable episode, but its slot is still reserved so
// search sits in the same column as on an on-disk row
actions.append(placeholderSlot());
}
item.append(tag, name, air, chips, actions);
@@ -4999,6 +5026,7 @@ function queuesMain(
const view = must<HTMLElement>("#queues");
const deck = must<HTMLElement>("#deck");
const nav = must<HTMLButtonElement>("#nav-queues");
nav.prepend(icon("warning"));
const badge = must<HTMLElement>("#queues-count");
const summary = must<HTMLElement>("#queues-summary");
const status = must<HTMLElement>("#queues-status");
@@ -5044,6 +5072,7 @@ function queuesMain(
}
function paintBadge(total: number) {
nav.hidden = total === 0;
badge.hidden = total === 0;
badge.textContent = total === 0 ? "" : String(total);
}
+1
View File
@@ -243,6 +243,7 @@ export function settingsMain(views: { hide: () => void }[], goHome: () => void):
const view = must<HTMLElement>("#settings");
const deck = must<HTMLElement>("#deck");
const nav = must<HTMLButtonElement>("#nav-settings");
nav.append(icon("cog"));
const summary = must<HTMLElement>("#settings-summary");
const status = must<HTMLElement>("#settings-status");
const rootsSection = must<HTMLElement>("#group-roots");
+127 -27
View File
@@ -142,6 +142,7 @@ body {
/* contents share the deck's column; the panel itself stays full-bleed */
.rail-inner {
position: relative;
display: flex;
align-items: center;
gap: var(--space-6);
@@ -178,8 +179,6 @@ body {
display: flex;
align-items: center;
gap: var(--space-4);
/* the verdict line used to absorb the slack; without it the readout
needs to claim the right edge itself */
margin-left: auto;
}
@@ -540,9 +539,11 @@ body {
/* ---- unified search (§9.2) ------------------------------------------- */
.rail-search {
position: relative;
flex: 1;
position: absolute;
left: 50%;
width: min(30rem, calc(100% - 20rem));
max-width: 30rem;
transform: translateX(-50%);
display: flex;
align-items: center;
}
@@ -1165,6 +1166,18 @@ body {
border-color: var(--signal-warn);
}
/* a destructive control rests red, so delete never reads like the search
glyph beside it; arming hands over to the shared amber treatment below */
.control[data-kind="delete"]:not(:disabled) {
color: var(--signal-fault);
border-color: oklch(from var(--signal-fault) l c h / 40%);
}
.control[data-kind="delete"]:hover:not(:disabled),
.control[data-kind="delete"]:focus-visible:not(:disabled) {
border-color: var(--signal-fault);
}
/* the settings arm-then-confirm, shared with season and episode rows: an
armed control turns caution amber until it disarms or fires */
.control[data-armed="true"] {
@@ -1387,10 +1400,6 @@ body {
/* ---- library view (§4.2) ---------------------------------------------- */
.rail-nav {
flex: none;
}
/* the library's master line: total readout left, the one §4.2 toggle right */
.library-bar {
margin: 0 0 var(--space-6);
@@ -1557,12 +1566,39 @@ body {
border-bottom: 1px solid oklch(from var(--line) l c h / 45%);
}
/* the line never wraps: the head shrinks and wraps inside itself, so the
controls keep the right edge on every viewport */
.season-line {
display: flex;
align-items: center;
flex-wrap: wrap;
flex-wrap: nowrap;
gap: var(--space-2) var(--space-3);
padding: var(--space-2) var(--space-1);
cursor: pointer;
transition: background 150ms var(--ease-out);
}
.season-head {
display: flex;
align-items: center;
flex-wrap: wrap;
flex: 1;
min-width: 0;
gap: var(--space-2) var(--space-3);
}
.season-actions {
display: flex;
align-items: center;
flex: none;
gap: var(--space-3);
}
/* a row under the pointer is visibly the row the click will land on —
the same lift a search result row gets */
.season-line:hover,
.episode:hover {
background: var(--panel);
}
/* the disclosure is a drawn chevron — no glyph standing in for an icon */
@@ -1600,6 +1636,7 @@ body {
}
.season-name {
flex: none;
font-family: var(--font-display);
font-size: var(--text-base);
font-weight: 700;
@@ -1608,16 +1645,19 @@ body {
color: var(--ink);
}
/* one name, two lengths — the wide one reads as prose, the narrow one is the
SxxEyy tag used everywhere else. display:none keeps the unused one out of
the accessibility tree, so the row is never announced twice. */
.season-name-short {
display: none;
}
/* the tracked toggle reads as the rule it is; pressed = on */
.season-line .control,
.ep-actions .control {
padding: 0 var(--space-3);
}
.season-space {
flex: 1;
}
.episodes {
margin: 0;
padding: 0 0 var(--space-2) var(--space-8);
@@ -1631,6 +1671,7 @@ body {
gap: var(--space-1) var(--space-2);
padding: var(--space-2) var(--space-1);
border-bottom: 1px solid oklch(from var(--line) l c h / 45%);
transition: background 150ms var(--ease-out);
}
.ep-tag {
@@ -1666,6 +1707,13 @@ body {
font-size: var(--text-xs);
}
/* an invisible spacer that IS an icon control: rows without a delete reserve
its slot so search sits in the same column on every row */
.slot-icon {
visibility: hidden;
pointer-events: none;
}
/* #227: the season the operator's own report was about read `0/10` beside
this chip's absence. It sits next to the counts because that number is what
looked like nothing had ever been tried. */
@@ -1824,6 +1872,10 @@ body {
color: var(--signal-warn);
}
.rail #nav-queues[hidden] {
display: none;
}
.queue-note {
margin: var(--space-2) var(--space-1) 0;
font-size: var(--text-xs);
@@ -1877,10 +1929,14 @@ body {
console charcoal under a scrim, so the readouts keep their contrast — a
photo never sits behind text bare. */
/* the backdrop bleeds to the rail; a .module border and inset highlight
would fight that edge, so the hero drops both */
.movie-hero {
position: relative;
overflow: hidden;
margin: 0 0 var(--space-8);
border: 0;
box-shadow: none;
}
/* the backdrop layer: painted only when detail supplied one */
@@ -2086,6 +2142,7 @@ body {
@media (max-width: 46rem) {
.rail-inner {
position: static;
flex-wrap: wrap;
gap: var(--space-3) var(--space-4);
}
@@ -2104,15 +2161,13 @@ body {
}
.rail-search {
position: relative;
left: auto;
width: auto;
order: 4;
flex-basis: 100%;
max-width: none;
}
/* deterministic first row: identity, views, then meta pushed right —
never re-wrapped by content or scrollbar changes */
.rail-nav {
order: 2;
transform: none;
}
.rail-meta {
@@ -2120,8 +2175,10 @@ body {
margin-left: auto;
}
/* no side gutter on a phone: the width belongs to the content, and the
hero reaches both edges the way the rail already does */
.deck {
padding: var(--space-6) var(--space-4) var(--space-8);
padding: var(--space-6) 0 var(--space-8);
}
.row-chips {
@@ -2129,18 +2186,61 @@ body {
flex-basis: 100%;
}
/* an episode row wraps: identity first, chips full-width, actions right */
/* the season name shrinks to its tag so the head keeps fitting beside the
controls; the long form has nowhere to go on a phone */
.season-name-long {
display: none;
}
.season-name-short {
display: inline;
}
/* no indent: the episode list is already inside its season, and the gutter
it used to sit in is gone */
.episodes {
padding-left: 0;
}
/* an episode row holds one line too. A phone has room for the identity,
whether the file is on disk, and the control — everything else is detail
you open the desktop for. Hidden, not shrunk: half a date is worse than
no date. */
.episode {
flex-wrap: nowrap;
}
/* the title takes the slack and truncates rather than pushing anything down */
.ep-title {
flex: 1;
min-width: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.ep-air {
display: none;
}
/* the state chip stays, and so does a flag — a vanished episode is a
conflict, not an attribute. Resolution, language and the waived-rule
chip go; they are what a wide screen is for. */
.ep-chips .chip:not([data-movie-state]):not([data-flag]) {
display: none;
}
/* no auto margin: it would absorb the free space before .ep-title's
flex-grow could claim it, truncating titles that had room to spare */
.ep-chips {
margin-left: 0;
flex-basis: 100%;
flex: none;
flex-basis: auto;
}
.ep-actions {
margin-left: auto;
}
.episodes {
padding-left: var(--space-4);
flex: none;
margin-left: var(--space-2);
}
.releases-id {