Build ErsatzTV Image / Docs update reminder (push) Has been skipped
Build ErsatzTV Image / decisions.md append-only (push) Has been skipped
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Has been skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Has been skipped
Build ErsatzTV Image / Functional E2E (curl contracts) (push) Successful in 4m46s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 11m26s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 13m34s
Build ErsatzTV Image / Build & push image (amd64) (push) Failing after 16s
Bulk mirror sweep (#388): author/rebuild a prototype mockup for every shipped SPA screen so the Claude Design project (eb3b6122 / local design-system/) faithfully reflects prod. - 40 screens authored (mockups: visual/layout parity, no logic) via a fan-out workflow; 8 stale prototypes rebuilt (Dashboard, ChannelBuilder, Guide, Schedules, Playouts, Settings, …), 32 net-new (media/sources/system/auth). Retired Epg/ScheduleEditor/ScheduleLibrary. - New screens.js = single source of truth for the inventory; Shell.jsx nav + app.html screen map both build from it (nav groups mirror web/src/app/routes.tsx). app.html is now hash-routed. - All 42 views verified rendering headlessly across the 3 themes (126/126, 0 real errors). - design-sync-reminder.sh hook (+ settings.json): mechanical, fail-open, once/session nudge to pull-first (PreToolUse Write|Edit on web/src/**.{tsx,css}) and mirror/push-back (Stop) — keeps the design system from drifting from prod going forward. - docs/design-sync.md: document the bulk-sweep structure + the reminder hook. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
285 lines
12 KiB
React
285 lines
12 KiB
React
// LocalLibraryEdit screen — settings-form detail for one local media library: name + media-kind
|
|
// card, a path list (add/remove/move) card, a danger-zone delete card, and a sticky "unsaved
|
|
// changes" save bar. Mirrors the create/edit route the SPA renders at /app/libraries/local/:id.
|
|
(function () {
|
|
const NS = window.ChicoryTVDesignSystem_eb3b61;
|
|
const { Button, IconButton, Badge, Card, Input, Select } = NS;
|
|
const Ico = window.Ico;
|
|
const mono = { fontFamily: "var(--font-mono)", fontVariantNumeric: "tabular-nums" };
|
|
|
|
const MEDIA_KIND_OPTIONS = [
|
|
{ label: "Movies", value: "Movies" },
|
|
{ label: "Shows", value: "Shows" },
|
|
{ label: "Music Videos", value: "MusicVideos" },
|
|
{ label: "Other Videos", value: "OtherVideos" },
|
|
{ label: "Songs", value: "Songs" },
|
|
{ label: "Images", value: "Images" },
|
|
{ label: "Remote Streams", value: "RemoteStreams" },
|
|
];
|
|
|
|
const INITIAL_PATHS = [
|
|
{ id: 101, path: "/media/movies/action", count: 412 },
|
|
{ id: 102, path: "/media/movies/animated", count: 188 },
|
|
{ id: 103, path: "/media/movies/staging", count: 0 },
|
|
];
|
|
|
|
const OTHER_LIBRARIES = [
|
|
{ id: 2, name: "Movies — 4K" },
|
|
{ id: 5, name: "Movies — Foreign" },
|
|
];
|
|
|
|
function Row({ children, first, label, help }) {
|
|
return (
|
|
<div
|
|
style={{
|
|
display: "flex",
|
|
alignItems: "flex-start",
|
|
gap: 24,
|
|
padding: "16px 0",
|
|
borderTop: first ? "none" : "1px solid var(--border-hairline)",
|
|
}}
|
|
>
|
|
<div style={{ flex: "1 1 auto", minWidth: 0, paddingTop: 6 }}>
|
|
<div style={{ font: "var(--weight-medium) var(--text-sm)/1.3 var(--font-sans)", color: "var(--text-primary)" }}>{label}</div>
|
|
{help && <div style={{ marginTop: 3, font: "var(--text-xs)/1.4 var(--font-sans)", color: "var(--text-secondary)" }}>{help}</div>}
|
|
</div>
|
|
<div style={{ flex: "0 0 300px" }}>{children}</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function LocalLibraryEdit() {
|
|
const [name, setName] = React.useState("Movies");
|
|
const [paths, setPaths] = React.useState(INITIAL_PATHS);
|
|
const [newPath, setNewPath] = React.useState("");
|
|
const [moveTarget, setMoveTarget] = React.useState(null); // path object or null
|
|
const [moveDest, setMoveDest] = React.useState("");
|
|
const [deleteOpen, setDeleteOpen] = React.useState(false);
|
|
|
|
const dirty = name !== "Movies" || paths !== INITIAL_PATHS;
|
|
const nameValid = name.trim() !== "";
|
|
const totalItems = paths.reduce((n, p) => n + p.count, 0);
|
|
|
|
const removePath = (p) => setPaths((cur) => cur.filter((x) => x !== p));
|
|
const addPath = () => {
|
|
const trimmed = newPath.trim();
|
|
if (!trimmed) return;
|
|
setPaths((cur) => [...cur, { id: 0, path: trimmed, count: 0 }]);
|
|
setNewPath("");
|
|
};
|
|
|
|
return (
|
|
<div style={{ display: "flex", flexDirection: "column", height: "100%" }}>
|
|
<div style={{ flex: 1, overflow: "auto", padding: "20px 24px 96px" }}>
|
|
<div style={{ maxWidth: 780, display: "flex", flexDirection: "column", gap: 20 }}>
|
|
<Card title="Edit Movies">
|
|
<Row first help="Library display name." label="Name">
|
|
<Input error={nameValid ? null : "Name is required"} onChange={(e) => setName(e.target.value)} size="sm" value={name} />
|
|
</Row>
|
|
<Row help="Media kind is immutable once a library is created." label="Media kind">
|
|
<Select disabled onChange={() => {}} options={MEDIA_KIND_OPTIONS} size="sm" value="Movies" />
|
|
</Row>
|
|
</Card>
|
|
|
|
<Card title="Paths" subtitle={`${paths.length} path${paths.length === 1 ? "" : "s"} · ${totalItems} media items`}>
|
|
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
{paths.length === 0 && (
|
|
<div style={{ padding: "20px 0", font: "var(--text-sm)/1.4 var(--font-sans)", color: "var(--text-faint)" }}>No paths added yet.</div>
|
|
)}
|
|
{paths.map((p, i) => (
|
|
<div
|
|
key={p.id + p.path}
|
|
style={{
|
|
display: "flex",
|
|
alignItems: "center",
|
|
gap: 10,
|
|
height: 46,
|
|
borderTop: i === 0 ? "none" : "1px solid var(--border-hairline)",
|
|
}}
|
|
>
|
|
<Ico n="Folder" s={14} color="var(--text-disabled)" />
|
|
<span
|
|
style={{
|
|
flex: "1 1 auto",
|
|
minWidth: 0,
|
|
overflow: "hidden",
|
|
textOverflow: "ellipsis",
|
|
whiteSpace: "nowrap",
|
|
...mono,
|
|
font: "var(--text-sm)/1 var(--font-mono)",
|
|
color: "var(--text-primary)",
|
|
}}
|
|
>
|
|
{p.path}
|
|
</span>
|
|
{p.count > 0 && (
|
|
<Badge tone="neutral">
|
|
<span style={mono}>{p.count}</span> items
|
|
</Badge>
|
|
)}
|
|
<IconButton
|
|
disabled={p.id === 0}
|
|
onClick={() => {
|
|
setMoveTarget(p);
|
|
setMoveDest("");
|
|
}}
|
|
size="sm"
|
|
title={p.id === 0 ? `Save first to move ${p.path}` : `Move ${p.path} to another library`}
|
|
>
|
|
<Ico n="ArrowRightLeft" s={14} />
|
|
</IconButton>
|
|
<IconButton onClick={() => removePath(p)} size="sm" title={`Remove ${p.path}`}>
|
|
<Ico n="Trash2" s={14} />
|
|
</IconButton>
|
|
</div>
|
|
))}
|
|
</div>
|
|
|
|
<div style={{ display: "flex", alignItems: "flex-end", gap: 10, marginTop: 16, paddingTop: 16, borderTop: "1px solid var(--border-hairline)" }}>
|
|
<div style={{ flex: 1 }}>
|
|
<Input onChange={(e) => setNewPath(e.target.value)} placeholder="/media/movies" size="sm" value={newPath} />
|
|
</div>
|
|
<Button onClick={addPath} size="sm" startIcon={<Ico n="Plus" s={14} />}>
|
|
Add Path
|
|
</Button>
|
|
</div>
|
|
</Card>
|
|
|
|
<Card title="Delete library" style={{ borderColor: "var(--status-error)" }}>
|
|
<p style={{ margin: "0 0 14px", font: "var(--text-sm)/1.5 var(--font-sans)", color: "var(--text-secondary)" }}>
|
|
<span style={mono}>{totalItems}</span> media items will be removed from the library index. This does not delete files on disk.
|
|
</p>
|
|
<Button onClick={() => setDeleteOpen(true)} startIcon={<Ico n="Trash2" s={14} />} variant="danger">
|
|
Delete library
|
|
</Button>
|
|
</Card>
|
|
</div>
|
|
</div>
|
|
|
|
{dirty && (
|
|
<div style={{ position: "sticky", bottom: 0, left: 0, right: 0, display: "flex", justifyContent: "center", padding: "0 24px 20px", pointerEvents: "none" }}>
|
|
<div
|
|
style={{
|
|
pointerEvents: "auto",
|
|
display: "flex",
|
|
alignItems: "center",
|
|
gap: 12,
|
|
padding: "10px 14px",
|
|
borderRadius: "var(--radius-md)",
|
|
border: "1px solid var(--border-hairline)",
|
|
background: "var(--surface-raised)",
|
|
boxShadow: "var(--shadow-pop)",
|
|
}}
|
|
>
|
|
<span style={{ display: "inline-flex", alignItems: "center", gap: 7, font: "var(--weight-medium) var(--text-sm)/1 var(--font-sans)", color: "var(--text-primary)" }}>
|
|
<Ico n="CircleAlert" s={14} color="var(--status-warn)" />
|
|
Unsaved changes
|
|
</span>
|
|
{!nameValid && <Badge tone="error">Name is required</Badge>}
|
|
<span style={{ width: 1, height: 18, background: "var(--border-hairline)" }} />
|
|
<Button onClick={() => setName("Movies")} size="sm" startIcon={<Ico n="Undo2" s={14} />} variant="ghost">
|
|
Discard
|
|
</Button>
|
|
<Button disabled={!nameValid} size="sm" startIcon={<Ico n="Save" s={14} />} variant="primary">
|
|
Save changes
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{moveTarget && (
|
|
<div
|
|
style={{
|
|
position: "fixed",
|
|
inset: 0,
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
background: "rgba(0,0,0,0.45)",
|
|
zIndex: 50,
|
|
}}
|
|
>
|
|
<div
|
|
style={{
|
|
width: 420,
|
|
borderRadius: "var(--radius-lg)",
|
|
border: "1px solid var(--border-hairline)",
|
|
background: "var(--surface-raised)",
|
|
boxShadow: "var(--shadow-lg)",
|
|
overflow: "hidden",
|
|
}}
|
|
>
|
|
<div style={{ padding: "14px 18px", borderBottom: "1px solid var(--border-hairline)", font: "var(--weight-semibold) var(--text-md)/1.2 var(--font-sans)", color: "var(--text-primary)" }}>
|
|
Move {moveTarget.path}
|
|
</div>
|
|
<div style={{ padding: 18, display: "flex", flexDirection: "column", gap: 12 }}>
|
|
<Select
|
|
label="Target library"
|
|
onChange={(e) => setMoveDest(e.target.value)}
|
|
options={[
|
|
{ label: "(choose a library)", value: "" },
|
|
...OTHER_LIBRARIES.map((l) => ({ label: l.name, value: String(l.id) })),
|
|
{ label: "(New Library)", value: "__new__" },
|
|
]}
|
|
value={moveDest}
|
|
/>
|
|
{moveDest === "__new__" && <Input placeholder="New library name" onChange={() => {}} value="" />}
|
|
</div>
|
|
<div style={{ display: "flex", justifyContent: "flex-end", gap: 8, padding: "14px 18px", borderTop: "1px solid var(--border-hairline)" }}>
|
|
<Button onClick={() => setMoveTarget(null)} variant="secondary">
|
|
Cancel
|
|
</Button>
|
|
<Button disabled={!moveDest} onClick={() => setMoveTarget(null)} startIcon={<Ico n="Check" s={14} />}>
|
|
Move
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{deleteOpen && (
|
|
<div
|
|
style={{
|
|
position: "fixed",
|
|
inset: 0,
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
background: "rgba(0,0,0,0.45)",
|
|
zIndex: 50,
|
|
}}
|
|
>
|
|
<div
|
|
style={{
|
|
width: 420,
|
|
borderRadius: "var(--radius-lg)",
|
|
border: "1px solid var(--border-hairline)",
|
|
background: "var(--surface-raised)",
|
|
boxShadow: "var(--shadow-lg)",
|
|
overflow: "hidden",
|
|
}}
|
|
>
|
|
<div style={{ padding: "14px 18px", borderBottom: "1px solid var(--border-hairline)", font: "var(--weight-semibold) var(--text-md)/1.2 var(--font-sans)", color: "var(--text-primary)" }}>
|
|
Delete library
|
|
</div>
|
|
<div style={{ padding: 18, font: "var(--text-sm)/1.5 var(--font-sans)", color: "var(--text-secondary)" }}>
|
|
This library contains <span style={mono}>{totalItems}</span> media item(s). Delete it anyway?
|
|
</div>
|
|
<div style={{ display: "flex", justifyContent: "flex-end", gap: 8, padding: "14px 18px", borderTop: "1px solid var(--border-hairline)" }}>
|
|
<Button onClick={() => setDeleteOpen(false)} variant="secondary">
|
|
Cancel
|
|
</Button>
|
|
<Button onClick={() => setDeleteOpen(false)} startIcon={<Ico n="Trash2" s={14} />} variant="danger">
|
|
Delete
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
window.CTVLocalLibraryEdit = LocalLibraryEdit;
|
|
})();
|