Move the web stylesheet into Tailwind utilities #281

Merged
naps62-yolo merged 9 commits from 280-tailwind-utilities into main 2026-11-11 21:14:24 +00:00
8 changed files with 264 additions and 495 deletions
Showing only changes of commit 71bb9ef2c3 - Show all commits
-316
View File
@@ -376,322 +376,6 @@ body {
}
}
/* ---- settings (issue #116) -------------------------------------------- */
.form-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
gap: var(--space-3);
align-items: end;
}
.field {
display: grid;
gap: var(--space-1);
}
.field-label {
font-size: var(--text-2xs);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.12em;
color: var(--ink-muted);
}
.form-input {
width: 100%;
min-height: var(--control-h);
padding: 0 var(--space-3);
font-family: var(--font-readout);
font-size: var(--text-base);
color: var(--ink);
background: var(--ground);
border: 1px solid var(--line);
border-radius: var(--radius);
box-shadow: inset 0 1px var(--lowlight);
caret-color: var(--accent);
transition: border-color 150ms var(--ease-out);
}
.form-input:hover {
border-color: var(--line-strong);
}
.form-input:focus {
border-color: var(--accent);
outline: none;
}
.form-input:disabled {
color: var(--ink-faint);
border-color: var(--line);
}
/* a select draws its own chevron: appearance is gone, so the shape returns */
select.form-input {
appearance: none;
padding-right: var(--space-8);
background-image:
linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
background-position:
calc(100% - 1.1rem) 50%,
calc(100% - 0.8rem) 50%;
background-size: 0.3rem 0.3rem;
background-repeat: no-repeat;
}
.form-input[data-invalid] {
border-color: var(--signal-fault);
}
.band-line {
display: flex;
align-items: center;
gap: var(--space-2);
}
.band-line .field-label {
width: 3.5rem;
}
/* four numbers and a label must share a phone's width, so the inputs shrink
rather than push the line past the gutter */
.band-num {
flex: 1 1 0;
min-width: 0;
max-width: 4.5rem;
}
.subtitle-panel .field-label {
display: block;
margin: var(--space-4) 0 var(--space-2);
}
.provider-list {
margin: 0 0 var(--space-3);
padding: 0;
list-style: none;
}
.provider-toggle {
width: 1.25rem;
height: 1.25rem;
margin: 0;
accent-color: var(--accent);
}
.provider-budget {
width: 5.5rem;
}
@media (min-width: 40rem) {
.form-input {
font-size: var(--text-sm);
}
}
/* ---- signal chain (§9.7: a settings section) ------------------------------- */
.chain-wrap {
container-type: inline-size;
padding-top: var(--space-4);
}
/* the phone stacks the chain into one junctioned trace */
.chain {
width: 100%;
display: grid;
grid-template-columns: 1fr;
grid-template-areas:
"tmdb"
"prow"
"t1"
"master"
"out"
"sink";
align-items: center;
row-gap: var(--space-3);
}
.area-tmdb {
grid-area: tmdb;
}
.area-prowlarr {
grid-area: prow;
}
.area-t1 {
grid-area: t1;
}
.area-t2 {
display: none;
}
.area-master {
grid-area: master;
}
.area-out {
grid-area: out;
}
.area-qbittorrent {
grid-area: sink;
}
.chain-lane {
margin-top: var(--space-4);
display: grid;
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
gap: var(--space-3);
align-items: stretch;
}
.module {
min-width: 0;
background: var(--panel);
border: 1px solid var(--line);
border-radius: var(--radius);
box-shadow: inset 0 1px var(--highlight);
padding: var(--space-4) var(--space-4) var(--space-3);
}
.module-master {
background: var(--panel-raised);
border-color: var(--line-strong);
}
.module-head {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: var(--space-1) var(--space-2);
}
.module-name {
margin: 0;
font-family: var(--font-display);
font-size: var(--text-md);
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.12em;
line-height: 1;
}
.module-master .module-name {
font-size: var(--text-lg);
}
.module-status {
margin-left: auto;
padding-left: var(--space-3);
color: var(--ink-muted);
}
.module-status[data-tone="ok"] {
color: var(--signal-ok);
}
.module-status[data-tone="warn"] {
color: var(--signal-warn);
}
.module-status[data-tone="fault"] {
color: var(--signal-fault);
}
.module-role {
margin: var(--space-2) 0 0;
font-size: var(--text-2xs);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.12em;
color: var(--ink-muted);
}
.module-detail {
margin: var(--space-1) 0 0;
min-height: 1.2em;
font-size: var(--text-xs);
color: var(--ink-muted);
}
.intake .module-detail {
overflow-wrap: anywhere;
}
.bus {
display: grid;
align-content: center;
justify-items: center;
height: 2rem;
}
.bus svg {
transform: rotate(90deg);
width: 2rem;
}
.bus-trace {
--trace: var(--line-strong);
width: 100%;
height: 0.5rem;
display: block;
transition: filter 300ms var(--ease-out);
}
.bus-trace line {
stroke: var(--trace);
stroke-width: 1;
}
.bus-arrow {
fill: var(--trace);
}
.bus-trace[data-tone="ok"] {
--trace: var(--signal-ok);
}
.bus-trace[data-tone="warn"] {
--trace: var(--signal-warn);
}
.bus-trace[data-tone="fault"] {
--trace: var(--signal-fault);
}
@container (min-width: 46rem) {
.chain {
grid-template-columns: 1fr 2.5rem 1.2fr 2.5rem 1fr;
grid-template-areas:
"tmdb t1 master out sink"
"prow t2 master out sink";
row-gap: var(--space-6);
}
.area-t2 {
display: grid;
grid-area: t2;
}
.bus {
height: auto;
}
.bus svg {
transform: none;
width: 100%;
}
.module-master {
padding: var(--space-6) var(--space-4) var(--space-4);
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before {
+29
View File
@@ -339,3 +339,32 @@ export const detail = {
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;
+4
View File
@@ -94,6 +94,9 @@
/* 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);
@@ -101,6 +104,7 @@
--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;
+6 -5
View File
@@ -4,7 +4,7 @@
import { type ReactNode, useEffect, useRef, useState } from "react";
import { ArmedDeleteIcon, Icon } from "./icons";
import { CHIP_ICON, chip as chipLook, control, cx, seg, segmented } from "./look";
import { CHIP_ICON, chip as chipLook, control, cx, form, seg, segmented } from "./look";
import { fileName } from "./movie";
import {
cachedSubtitleOptions,
@@ -200,11 +200,12 @@ function SubtitleField({
// biome-ignore lint/a11y/noLabelWithoutControl: the select is the child
<label
className={cx(
"field shrink min-w-field",
form.field,
"shrink min-w-field",
narrow ? "grow-0 basis-field max-w-select-narrow" : "grow basis-field-basis max-w-select",
)}
>
<span className="field-label readout dim">{label}</span>
<span className={cx("readout dim", form.label)}>{label}</span>
{children}
</label>
);
@@ -829,7 +830,7 @@ export function useSubtitleSection(
<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) => {
@@ -874,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)}
+4 -4
View File
@@ -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, detail, SUB } from "../look";
import { control, cx, detail, form, SUB } from "../look";
import {
fileName,
imdbLink,
@@ -501,12 +501,12 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
<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 grid">
<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"}
+14 -8
View File
@@ -5,7 +5,11 @@
import { type KeyboardEvent, useEffect, useRef, useState } from "react";
import { useNav } from "../context";
import { Icon } from "../icons";
import { cx, PANEL, PANEL_ACTIONS, PANEL_NOTE, seg, segmented } from "../look";
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 {
@@ -254,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>
+4 -4
View File
@@ -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, cx, detail } from "../look";
import { control, cx, detail, form } from "../look";
import { rottenTomatoesSearch, tmdbSeriesLink, tvdbLink, youtubeLink } from "../movie";
import {
audienceOf,
@@ -783,12 +783,12 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
</>
)}
</div>
<label className="field grid">
<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)}
+203 -158
View File
@@ -3,8 +3,10 @@
import {
type CSSProperties,
createContext,
type ReactNode,
useCallback,
useContext,
useEffect,
useRef,
useState,
@@ -12,7 +14,7 @@ import {
import { LAYER, useEscape, useLive, useNav } from "../context";
import type { Check, CheckStatus } from "../health";
import { ArmedDeleteIcon, type IconName } from "../icons";
import { control, PANEL, PANEL_ACTIONS, PANEL_NOTE } from "../look";
import { chain, control, form, PANEL, PANEL_ACTIONS, PANEL_NOTE } from "../look";
import type { Root } from "../search";
import {
deleteRow,
@@ -85,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>
);
@@ -124,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>
);
}
@@ -195,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}
@@ -235,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}
@@ -251,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>
);
@@ -287,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}
@@ -303,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;
@@ -316,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)}
@@ -347,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)}
@@ -437,7 +478,7 @@ function RootPanel({
return (
<div className={PANEL}>
<div className="form-grid">
<div className={form.grid}>
<Field label="kind">
<Select
options={["movie", "tv"]}
@@ -490,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: "",
@@ -633,7 +678,7 @@ function PolicyPanel({
return (
<div className={PANEL}>
<div className="form-grid">
<div className={form.grid}>
<Field label="name">
<TextInput value={name} onChange={setName} placeholder="policy name" autoFocus />
</Field>
@@ -668,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="∞"
@@ -939,130 +984,130 @@ function SubtitlesPanel({
};
return (
<div className={cx(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={cx("readout dim", PANEL_NOTE)}>
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",
fill: false,
},
{
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>
);
}