refactor(web): settings forms and signal chain as utilities
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
8ed861448d
commit
71bb9ef2c3
@@ -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) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
*,
|
*,
|
||||||
*::before {
|
*::before {
|
||||||
|
|||||||
@@ -339,3 +339,32 @@ export const detail = {
|
|||||||
moreToggles: "grid gap-2 @row:grid-cols-2 @row:col-span-full",
|
moreToggles: "grid gap-2 @row:grid-cols-2 @row:col-span-full",
|
||||||
controlNote: "readout m-0 text-xs text-ink-muted @row:col-span-full",
|
controlNote: "readout m-0 text-xs text-ink-muted @row:col-span-full",
|
||||||
} as const;
|
} 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;
|
||||||
|
|||||||
@@ -94,6 +94,9 @@
|
|||||||
/* a subtitle select: its least width, and where it starts from */
|
/* a subtitle select: its least width, and where it starts from */
|
||||||
--spacing-field: 9rem;
|
--spacing-field: 9rem;
|
||||||
--spacing-field-basis: 12rem;
|
--spacing-field-basis: 12rem;
|
||||||
|
--spacing-band-label: 3.5rem;
|
||||||
|
--spacing-budget: 5.5rem;
|
||||||
|
--spacing-detail: 1.2em;
|
||||||
|
|
||||||
--container-deck: var(--deck-max);
|
--container-deck: var(--deck-max);
|
||||||
--container-measure: var(--measure);
|
--container-measure: var(--measure);
|
||||||
@@ -101,6 +104,7 @@
|
|||||||
--container-notice: 68ch;
|
--container-notice: 68ch;
|
||||||
--container-select: 18rem;
|
--container-select: 18rem;
|
||||||
--container-select-narrow: 11rem;
|
--container-select-narrow: 11rem;
|
||||||
|
--container-band: 4.5rem;
|
||||||
/* container query widths for @row, @cells and @wide: the row grows its
|
/* container query widths for @row, @cells and @wide: the row grows its
|
||||||
action column, the release cells line up, the detail hero widens */
|
action column, the release cells line up, the detail hero widens */
|
||||||
--container-row: 40rem;
|
--container-row: 40rem;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import { type ReactNode, useEffect, useRef, useState } from "react";
|
import { type ReactNode, useEffect, useRef, useState } from "react";
|
||||||
import { ArmedDeleteIcon, Icon } from "./icons";
|
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 { fileName } from "./movie";
|
||||||
import {
|
import {
|
||||||
cachedSubtitleOptions,
|
cachedSubtitleOptions,
|
||||||
@@ -200,11 +200,12 @@ function SubtitleField({
|
|||||||
// biome-ignore lint/a11y/noLabelWithoutControl: the select is the child
|
// biome-ignore lint/a11y/noLabelWithoutControl: the select is the child
|
||||||
<label
|
<label
|
||||||
className={cx(
|
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",
|
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}
|
{children}
|
||||||
</label>
|
</label>
|
||||||
);
|
);
|
||||||
@@ -829,7 +830,7 @@ export function useSubtitleSection(
|
|||||||
<div className="flex flex-wrap items-end gap-y-2 gap-x-3 pt-3">
|
<div className="flex flex-wrap items-end gap-y-2 gap-x-3 pt-3">
|
||||||
<SubtitleField label="source">
|
<SubtitleField label="source">
|
||||||
<select
|
<select
|
||||||
className="form-input"
|
className={cx(form.input, form.select)}
|
||||||
value={source}
|
value={source}
|
||||||
disabled={empty || extracting}
|
disabled={empty || extracting}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
@@ -874,7 +875,7 @@ export function useSubtitleSection(
|
|||||||
/>
|
/>
|
||||||
<SubtitleField label="engine" narrow>
|
<SubtitleField label="engine" narrow>
|
||||||
<select
|
<select
|
||||||
className="form-input"
|
className={cx(form.input, form.select)}
|
||||||
value={engineDisabled ? "" : engine}
|
value={engineDisabled ? "" : engine}
|
||||||
disabled={engineDisabled}
|
disabled={engineDisabled}
|
||||||
onChange={(event) => setEngine(event.target.value)}
|
onChange={(event) => setEngine(event.target.value)}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|||||||
import { Buckets, type DeckState, type ReleaseActions } from "../buckets";
|
import { Buckets, type DeckState, type ReleaseActions } from "../buckets";
|
||||||
import { LAYER, useEscape, useNav } from "../context";
|
import { LAYER, useEscape, useNav } from "../context";
|
||||||
import { Hero, ProviderLink, RemovePanel, type RemoveSubject, TrailerLink } from "../detail";
|
import { Hero, ProviderLink, RemovePanel, type RemoveSubject, TrailerLink } from "../detail";
|
||||||
import { control, detail, SUB } from "../look";
|
import { control, cx, detail, form, SUB } from "../look";
|
||||||
import {
|
import {
|
||||||
fileName,
|
fileName,
|
||||||
imdbLink,
|
imdbLink,
|
||||||
@@ -501,12 +501,12 @@ export function MovieView({ movieId, toReleases }: { movieId: number; toReleases
|
|||||||
<p className={detail.controlNote} hidden={!movie?.blocked}>
|
<p className={detail.controlNote} hidden={!movie?.blocked}>
|
||||||
Targeted search is off. RSS still matches this title, so a release can still arrive.
|
Targeted search is off. RSS still matches this title, so a release can still arrive.
|
||||||
</p>
|
</p>
|
||||||
<label className="field grid">
|
<label className={form.field}>
|
||||||
<span className="field-label" id="movie-root-label">
|
<span className={form.label} id="movie-root-label">
|
||||||
root
|
root
|
||||||
</span>
|
</span>
|
||||||
<select
|
<select
|
||||||
className="form-input"
|
className={cx(form.input, form.select)}
|
||||||
aria-labelledby="movie-root-label"
|
aria-labelledby="movie-root-label"
|
||||||
value={movie === null ? "" : String(movie.root_id)}
|
value={movie === null ? "" : String(movie.root_id)}
|
||||||
disabled={busy === "root"}
|
disabled={busy === "root"}
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
import { type KeyboardEvent, useEffect, useRef, useState } from "react";
|
import { type KeyboardEvent, useEffect, useRef, useState } from "react";
|
||||||
import { useNav } from "../context";
|
import { useNav } from "../context";
|
||||||
import { Icon } from "../icons";
|
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 { RatingChip, RowPoster, TitleText } from "../parts";
|
||||||
import { MovieRow, SeriesHitRow } from "../rows";
|
import { MovieRow, SeriesHitRow } from "../rows";
|
||||||
import {
|
import {
|
||||||
@@ -254,14 +258,16 @@ function TmdbRow({
|
|||||||
function ManualIntake({ kind, raw }: { kind: "magnet" | "torrent_url"; raw: string }) {
|
function ManualIntake({ kind, raw }: { kind: "magnet" | "torrent_url"; raw: string }) {
|
||||||
const parsed = parseManualInput(kind, raw);
|
const parsed = parseManualInput(kind, raw);
|
||||||
return (
|
return (
|
||||||
<article className="module intake">
|
<article className={cx(chain.module, "bg-panel border-line")}>
|
||||||
<header className="module-head">
|
<header className={chain.head}>
|
||||||
<h3 className="module-name">{kind === "magnet" ? "magnet" : "torrent"}</h3>
|
<h3 className={cx(chain.name, "text-md")}>{kind === "magnet" ? "magnet" : "torrent"}</h3>
|
||||||
<span className="module-status readout">recognized</span>
|
<span className={chain.status}>recognized</span>
|
||||||
</header>
|
</header>
|
||||||
<p className="module-detail readout">{parsed.name ?? parsed.raw}</p>
|
<p className={cx(chain.detail, INTAKE)}>{parsed.name ?? parsed.raw}</p>
|
||||||
{parsed.infohash && <p className="module-detail readout dim">{`btih ${parsed.infohash}`}</p>}
|
{parsed.infohash && (
|
||||||
<p className="module-detail readout dim">
|
<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
|
manual grab lands with the release buckets — nothing sent yet
|
||||||
</p>
|
</p>
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { LAYER, type TvDeckRequest, useEscape, useNav } from "../context";
|
|||||||
import { Hero, ProviderLink, RemovePanel, type RemoveSubject, TrailerLink } from "../detail";
|
import { Hero, ProviderLink, RemovePanel, type RemoveSubject, TrailerLink } from "../detail";
|
||||||
import { ArmedDeleteIcon } from "../icons";
|
import { ArmedDeleteIcon } from "../icons";
|
||||||
import { seriesStatusChipRedundant } from "../library";
|
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 { rottenTomatoesSearch, tmdbSeriesLink, tvdbLink, youtubeLink } from "../movie";
|
||||||
import {
|
import {
|
||||||
audienceOf,
|
audienceOf,
|
||||||
@@ -783,12 +783,12 @@ export function SeriesView({ seriesId, covered }: { seriesId: number; covered: b
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<label className="field grid">
|
<label className={form.field}>
|
||||||
<span className="field-label" id="series-root-label">
|
<span className={form.label} id="series-root-label">
|
||||||
root
|
root
|
||||||
</span>
|
</span>
|
||||||
<select
|
<select
|
||||||
className="form-input"
|
className={cx(form.input, form.select)}
|
||||||
data-focus-id="series-root"
|
data-focus-id="series-root"
|
||||||
aria-labelledby="series-root-label"
|
aria-labelledby="series-root-label"
|
||||||
value={series === null ? "" : String(series.root_id)}
|
value={series === null ? "" : String(series.root_id)}
|
||||||
|
|||||||
+203
-158
@@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
type CSSProperties,
|
type CSSProperties,
|
||||||
|
createContext,
|
||||||
type ReactNode,
|
type ReactNode,
|
||||||
useCallback,
|
useCallback,
|
||||||
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
@@ -12,7 +14,7 @@ import {
|
|||||||
import { LAYER, useEscape, useLive, useNav } from "../context";
|
import { LAYER, useEscape, useLive, useNav } from "../context";
|
||||||
import type { Check, CheckStatus } from "../health";
|
import type { Check, CheckStatus } from "../health";
|
||||||
import { ArmedDeleteIcon, type IconName } from "../icons";
|
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 type { Root } from "../search";
|
||||||
import {
|
import {
|
||||||
deleteRow,
|
deleteRow,
|
||||||
@@ -85,37 +87,57 @@ function ChainModule({
|
|||||||
master?: boolean;
|
master?: boolean;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<article className={cx("module", master && "module-master", area)}>
|
<article
|
||||||
<header className="module-head">
|
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
|
<span
|
||||||
className={cx("lamp", master && "lamp-big")}
|
className={cx("lamp", master && "lamp-big")}
|
||||||
data-state={module.state}
|
data-state={module.state}
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
style={{ "--strike": String(strike) } as CSSProperties}
|
style={{ "--strike": String(strike) } as CSSProperties}
|
||||||
/>
|
/>
|
||||||
<h4 className="module-name">{name}</h4>
|
<h4 className={cx(chain.name, master ? "text-lg" : "text-md")}>{name}</h4>
|
||||||
<span className="module-status readout" data-tone={module.tone}>
|
<span className={chain.status} data-tone={module.tone}>
|
||||||
{module.word}
|
{module.word}
|
||||||
</span>
|
</span>
|
||||||
</header>
|
</header>
|
||||||
<p className="module-role">{duty}</p>
|
<p className={chain.role}>{duty}</p>
|
||||||
<p className="module-detail readout">{module.detail ?? defaultDetail}</p>
|
<p className={chain.detail}>{module.detail ?? defaultDetail}</p>
|
||||||
</article>
|
</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 }) {
|
function Bus({ area, tone }: { area: string; tone: Tone | null }) {
|
||||||
|
const trace = tone === null ? "idle" : tone;
|
||||||
return (
|
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
|
<svg
|
||||||
viewBox="0 0 40 8"
|
viewBox="0 0 40 8"
|
||||||
preserveAspectRatio="none"
|
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}
|
data-tone={tone === null || tone === "idle" ? undefined : tone}
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
>
|
>
|
||||||
<line x1="0" y1="4" x2="32" y2="4" />
|
<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="bus-arrow" />
|
<path d="M32 0.5 39 4 32 7.5 Z" className={TRACE[trace].fill} />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</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. */
|
/** One lamp of the subtitle lane (#200): same module shape as the chain. */
|
||||||
function SubtitleModule({ name, duty, check }: { name: string; duty: string; check: Check }) {
|
function SubtitleModule({ name, duty, check }: { name: string; duty: string; check: Check }) {
|
||||||
return (
|
return (
|
||||||
<article className="module">
|
<article className={cx(chain.module, "bg-panel border-line")}>
|
||||||
<header className="module-head">
|
<header className={chain.head}>
|
||||||
<span className="lamp" data-state={check.status} />
|
<span className="lamp" data-state={check.status} />
|
||||||
<h2 className="module-name">{name}</h2>
|
<h2 className={cx(chain.name, "text-md")}>{name}</h2>
|
||||||
<span className="module-status readout" data-tone={TONE_BY_STATUS[check.status]}>
|
<span className={chain.status} data-tone={TONE_BY_STATUS[check.status]}>
|
||||||
{check.status}
|
{check.status}
|
||||||
</span>
|
</span>
|
||||||
</header>
|
</header>
|
||||||
<p className="module-role">{duty}</p>
|
<p className={chain.role}>{duty}</p>
|
||||||
<p className="module-detail readout">{check.detail ?? ""}</p>
|
<p className={chain.detail}>{check.detail ?? ""}</p>
|
||||||
</article>
|
</article>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -195,39 +217,45 @@ function Chain() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<section className="chain-wrap" aria-label="signal chain">
|
<section className="@container pt-4" aria-label="signal chain">
|
||||||
<div className={cx("chain", probe !== null && "powered")}>
|
{/* `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
|
<ChainModule
|
||||||
name="tmdb"
|
name="tmdb"
|
||||||
area="area-tmdb"
|
area="[grid-area:tmdb]"
|
||||||
duty="metadata in"
|
duty="metadata in"
|
||||||
defaultDetail="titles, languages, release dates"
|
defaultDetail="titles, languages, release dates"
|
||||||
module={checks.tmdb}
|
module={checks.tmdb}
|
||||||
strike={0}
|
strike={0}
|
||||||
/>
|
/>
|
||||||
<Bus area="area-t1" tone={traces.tmdb} />
|
<Bus area="[grid-area:t1]" tone={traces.tmdb} />
|
||||||
<ChainModule
|
<ChainModule
|
||||||
name="prowlarr"
|
name="prowlarr"
|
||||||
area="area-prowlarr"
|
area="[grid-area:prow]"
|
||||||
duty="indexers in"
|
duty="indexers in"
|
||||||
defaultDetail="torznab search and rss"
|
defaultDetail="torznab search and rss"
|
||||||
module={checks.prowlarr}
|
module={checks.prowlarr}
|
||||||
strike={1}
|
strike={1}
|
||||||
/>
|
/>
|
||||||
<Bus area="area-t2" tone={traces.prowlarr} />
|
<Bus area="@cells:[grid-area:t2]" tone={traces.prowlarr} />
|
||||||
<ChainModule
|
<ChainModule
|
||||||
name="arr"
|
name="arr"
|
||||||
area="area-master"
|
area="[grid-area:master]"
|
||||||
duty="reconcile core"
|
duty="reconcile core"
|
||||||
defaultDetail="decide · find · fetch · import"
|
defaultDetail="decide · find · fetch · import"
|
||||||
module={master}
|
module={master}
|
||||||
strike={2}
|
strike={2}
|
||||||
master
|
master
|
||||||
/>
|
/>
|
||||||
<Bus area="area-out" tone={traces.master} />
|
<Bus area="[grid-area:out]" tone={traces.master} />
|
||||||
<ChainModule
|
<ChainModule
|
||||||
name="qbittorrent"
|
name="qbittorrent"
|
||||||
area="area-qbittorrent"
|
area="[grid-area:sink]"
|
||||||
duty="torrents out"
|
duty="torrents out"
|
||||||
defaultDetail="webui · grab and seed"
|
defaultDetail="webui · grab and seed"
|
||||||
module={checks.qbit}
|
module={checks.qbit}
|
||||||
@@ -235,7 +263,11 @@ function Chain() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</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) => (
|
{lane?.map((entry) => (
|
||||||
<SubtitleModule
|
<SubtitleModule
|
||||||
key={entry.name}
|
key={entry.name}
|
||||||
@@ -251,10 +283,18 @@ function Chain() {
|
|||||||
|
|
||||||
/* ---- form primitives ---------------------------------------------------- */
|
/* ---- 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 }) {
|
function Field({ label, children }: { label: string; children: ReactNode }) {
|
||||||
|
const spaced = useContext(SpacedLabels);
|
||||||
return (
|
return (
|
||||||
<div className="field">
|
<div className={form.field}>
|
||||||
<span className="field-label readout dim">{label}</span>
|
<span className={labelClass(spaced)}>{label}</span>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -287,7 +327,7 @@ function TextInput({
|
|||||||
<input
|
<input
|
||||||
ref={ref}
|
ref={ref}
|
||||||
type="text"
|
type="text"
|
||||||
className="form-input readout"
|
className={cx("readout", form.input)}
|
||||||
value={value}
|
value={value}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
@@ -303,12 +343,13 @@ function TextInput({
|
|||||||
function NumberInput({
|
function NumberInput({
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
className,
|
className = "w-full",
|
||||||
placeholder,
|
placeholder,
|
||||||
...rest
|
...rest
|
||||||
}: {
|
}: {
|
||||||
value: string;
|
value: string;
|
||||||
onChange: (value: string) => void;
|
onChange: (value: string) => void;
|
||||||
|
/** Width and flex: the full field by default. */
|
||||||
className?: string;
|
className?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
"aria-label"?: string;
|
"aria-label"?: string;
|
||||||
@@ -316,7 +357,7 @@ function NumberInput({
|
|||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
className={cx("form-input readout form-num", className)}
|
className={cx("readout", form.inputBare, className)}
|
||||||
value={value}
|
value={value}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
onChange={(event) => onChange(event.target.value)}
|
onChange={(event) => onChange(event.target.value)}
|
||||||
@@ -347,7 +388,7 @@ function Select({
|
|||||||
return (
|
return (
|
||||||
<select
|
<select
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className="form-input readout"
|
className={cx("readout", form.input, form.select)}
|
||||||
value={value}
|
value={value}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onChange={(event) => onChange(event.target.value)}
|
onChange={(event) => onChange(event.target.value)}
|
||||||
@@ -437,7 +478,7 @@ function RootPanel({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={PANEL}>
|
<div className={PANEL}>
|
||||||
<div className="form-grid">
|
<div className={form.grid}>
|
||||||
<Field label="kind">
|
<Field label="kind">
|
||||||
<Select
|
<Select
|
||||||
options={["movie", "tv"]}
|
options={["movie", "tv"]}
|
||||||
@@ -490,6 +531,10 @@ type SourceKey = (typeof SOURCES)[number];
|
|||||||
|
|
||||||
const DV_PROFILES = ["5", "7", "8"] as const;
|
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"> {
|
function newPolicyDoc(): Omit<PolicyDoc, "id"> {
|
||||||
return {
|
return {
|
||||||
name: "",
|
name: "",
|
||||||
@@ -633,7 +678,7 @@ function PolicyPanel({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={PANEL}>
|
<div className={PANEL}>
|
||||||
<div className="form-grid">
|
<div className={form.grid}>
|
||||||
<Field label="name">
|
<Field label="name">
|
||||||
<TextInput value={name} onChange={setName} placeholder="policy name" autoFocus />
|
<TextInput value={name} onChange={setName} placeholder="policy name" autoFocus />
|
||||||
</Field>
|
</Field>
|
||||||
@@ -668,28 +713,28 @@ function PolicyPanel({
|
|||||||
const set = (key: keyof BandFields) => (value: string) =>
|
const set = (key: keyof BandFields) => (value: string) =>
|
||||||
setBands({ ...bands, [resolution]: { ...band, [key]: value } });
|
setBands({ ...bands, [resolution]: { ...band, [key]: value } });
|
||||||
return (
|
return (
|
||||||
<div key={resolution} className="band-line" data-resolution={resolution}>
|
<div key={resolution} className="flex items-center gap-2" data-resolution={resolution}>
|
||||||
<span className="field-label readout dim">{resolution}</span>
|
<span className={cx(labelClass(false), "w-band-label")}>{resolution}</span>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
className="band-num"
|
className={BAND_NUM}
|
||||||
value={band.floor}
|
value={band.floor}
|
||||||
onChange={set("floor")}
|
onChange={set("floor")}
|
||||||
aria-label={`${resolution} floor GiB`}
|
aria-label={`${resolution} floor GiB`}
|
||||||
/>
|
/>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
className="band-num"
|
className={BAND_NUM}
|
||||||
value={band.target}
|
value={band.target}
|
||||||
onChange={set("target")}
|
onChange={set("target")}
|
||||||
aria-label={`${resolution} target GiB`}
|
aria-label={`${resolution} target GiB`}
|
||||||
/>
|
/>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
className="band-num"
|
className={BAND_NUM}
|
||||||
value={band.penalty}
|
value={band.penalty}
|
||||||
onChange={set("penalty")}
|
onChange={set("penalty")}
|
||||||
aria-label={`${resolution} penalty points per GiB over`}
|
aria-label={`${resolution} penalty points per GiB over`}
|
||||||
/>
|
/>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
className="band-num"
|
className={BAND_NUM}
|
||||||
value={band.ceiling}
|
value={band.ceiling}
|
||||||
onChange={set("ceiling")}
|
onChange={set("ceiling")}
|
||||||
placeholder="∞"
|
placeholder="∞"
|
||||||
@@ -939,130 +984,130 @@ function SubtitlesPanel({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cx(PANEL, "subtitle-panel")}>
|
<SpacedLabels.Provider value={true}>
|
||||||
<div className="form-grid">
|
<div className={PANEL}>
|
||||||
<Field label="wanted languages">
|
<div className={form.grid}>
|
||||||
<TextInput value={wanted} onChange={setWanted} placeholder="pt-PT, en" />
|
<Field label="wanted languages">
|
||||||
</Field>
|
<TextInput value={wanted} onChange={setWanted} placeholder="pt-PT, en" />
|
||||||
<Field label="translation engine">
|
</Field>
|
||||||
<Select
|
<Field label="translation engine">
|
||||||
options={["none", ...settings.available_engines]}
|
<Select
|
||||||
value={engine}
|
options={["none", ...settings.available_engines]}
|
||||||
onChange={setEngine}
|
value={engine}
|
||||||
disabled={!hasEngines}
|
onChange={setEngine}
|
||||||
/>
|
disabled={!hasEngines}
|
||||||
</Field>
|
/>
|
||||||
<Field label="remote command timeout (s)">
|
</Field>
|
||||||
<NumberInput value={timeout} onChange={setTimeoutValue} />
|
<Field label="remote command timeout (s)">
|
||||||
</Field>
|
<NumberInput value={timeout} onChange={setTimeoutValue} />
|
||||||
</div>
|
</Field>
|
||||||
{!hasEngines && (
|
</div>
|
||||||
<p className={cx("readout dim", PANEL_NOTE)}>
|
{!hasEngines && (
|
||||||
no translation engine is compiled into this binary — pick is unavailable
|
<p className={cx("readout dim", PANEL_NOTE)}>
|
||||||
</p>
|
no translation engine is compiled into this binary — pick is unavailable
|
||||||
)}
|
|
||||||
{/* 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
|
|
||||||
</p>
|
</p>
|
||||||
<div className="form-grid">
|
)}
|
||||||
<Field label="base url">
|
{/* Their own labelled row rather than two more cells in the grid above:
|
||||||
<TextInput
|
paired, they belong to one engine, and a base URL needs the width. */}
|
||||||
value={baseUrl}
|
{hasOpenAi && (
|
||||||
onChange={setBaseUrl}
|
<>
|
||||||
placeholder="optional — e.g. http://127.0.0.1:8080/v1"
|
<p className={labelClass(true)}>openai-compatible endpoint — blank means its default</p>
|
||||||
aria-label="openai base url"
|
<div className={form.grid}>
|
||||||
/>
|
<Field label="base url">
|
||||||
</Field>
|
<TextInput
|
||||||
<Field label="model">
|
value={baseUrl}
|
||||||
<TextInput
|
onChange={setBaseUrl}
|
||||||
value={model}
|
placeholder="optional — e.g. http://127.0.0.1:8080/v1"
|
||||||
onChange={setModel}
|
aria-label="openai base url"
|
||||||
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`}
|
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
))}
|
<Field label="model">
|
||||||
</div>
|
<TextInput
|
||||||
</>
|
value={model}
|
||||||
)}
|
onChange={setModel}
|
||||||
<p className="field-label readout dim">providers — enabled, and in priority order</p>
|
placeholder="optional — e.g. gpt-4o-mini"
|
||||||
<ul className="provider-list">
|
aria-label="openai model"
|
||||||
{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 })}
|
|
||||||
/>
|
/>
|
||||||
</label>
|
</Field>
|
||||||
}
|
</div>
|
||||||
title={entry.provider}
|
</>
|
||||||
actions={[
|
)}
|
||||||
{
|
{hasEngines && (
|
||||||
node: (
|
<>
|
||||||
|
<p className={labelClass(true)}>translator daily budgets</p>
|
||||||
|
<div className={form.grid}>
|
||||||
|
{settings.available_engines.map((name) => (
|
||||||
|
<Field key={name} label={name}>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
className="provider-budget"
|
value={translators[name] ?? ""}
|
||||||
value={entry.budget}
|
onChange={(value) => setTranslators({ ...translators, [name]: value })}
|
||||||
onChange={(value) => updateProvider(index, { budget: value })}
|
aria-label={`${name} daily budget`}
|
||||||
aria-label={`${entry.provider} daily budget`}
|
|
||||||
/>
|
/>
|
||||||
),
|
</Field>
|
||||||
width: "word",
|
))}
|
||||||
fill: false,
|
</div>
|
||||||
},
|
</>
|
||||||
{
|
)}
|
||||||
node: (
|
<p className={labelClass(true)}>providers — enabled, and in priority order</p>
|
||||||
<MoveButton
|
<ul className="mt-0 mx-0 mb-3 p-0 list-none">
|
||||||
direction="up"
|
{providers.map((entry, index) => (
|
||||||
label={`move ${entry.provider} up`}
|
<Row
|
||||||
disabled={index === 0}
|
key={entry.provider}
|
||||||
onClick={() => move(index, -1)}
|
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 })}
|
||||||
/>
|
/>
|
||||||
),
|
</label>
|
||||||
width: "icon",
|
}
|
||||||
},
|
title={entry.provider}
|
||||||
{
|
actions={[
|
||||||
node: (
|
{
|
||||||
<MoveButton
|
node: (
|
||||||
direction="down"
|
<NumberInput
|
||||||
label={`move ${entry.provider} down`}
|
className="w-budget"
|
||||||
disabled={index === providers.length - 1}
|
value={entry.budget}
|
||||||
onClick={() => move(index, 1)}
|
onChange={(value) => updateProvider(index, { budget: value })}
|
||||||
/>
|
aria-label={`${entry.provider} daily budget`}
|
||||||
),
|
/>
|
||||||
width: "icon",
|
),
|
||||||
},
|
width: "word",
|
||||||
]}
|
fill: false,
|
||||||
/>
|
},
|
||||||
))}
|
{
|
||||||
</ul>
|
node: (
|
||||||
<PanelActions save={save} saveLabel="save subtitles" busy={busy} note={note} />
|
<MoveButton
|
||||||
</div>
|
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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user