Files
ersatztv/design-system/templates/chicorytv-admin/PathReplacementsEdit.jsx
T
timothyandClaude Opus 4.8 e1d77ebeb9
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
design(388): mirror full ChicoryTV design system to prod + design-sync reminder hook
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>
2026-07-17 01:27:12 +00:00

147 lines
7.4 KiB
React

// PathReplacementsEdit screen — two-column path-replacement editor with list and detail form.
(function () {
const NS = window.ChicoryTVDesignSystem_eb3b61;
const { Button, Input, Card, Spinner } = NS;
const Ico = window.Ico;
const mono = { fontFamily: "var(--font-mono)", fontVariantNumeric: "tabular-nums" };
// Mock data: a few realistic path replacements for Jellyfin
const mockReplacements = [
{ id: 1, remotePath: "/mnt/media/movies", localPath: "/var/lib/jellyfin/media/movies" },
{ id: 2, remotePath: "/mnt/media/tv", localPath: "/var/lib/jellyfin/media/tv" },
{ id: 3, remotePath: "/media/archive", localPath: "/srv/archive" },
];
function PathReplacementsEdit() {
const [selectedId, setSelectedId] = React.useState(1);
const [isDirty, setIsDirty] = React.useState(false);
const [isSaving, setIsSaving] = React.useState(false);
const selected = mockReplacements.find((r) => r.id === selectedId);
const handleRemoteChange = (val) => {
setIsDirty(true);
};
const handleLocalChange = (val) => {
setIsDirty(true);
};
const handleSave = () => {
setIsSaving(true);
setTimeout(() => {
setIsSaving(false);
setIsDirty(false);
}, 500);
};
const handleDiscard = () => {
setIsDirty(false);
};
return (
<div style={{ display: "flex", flexDirection: "column", height: "100%" }}>
{/* Header section */}
<section style={{ display: "flex", flexDirection: "column", gap: 8, padding: "24px 28px", borderBottom: "1px solid var(--border-hairline)", flex: "0 0 auto" }}>
<div>
<div style={{ font: "var(--text-xs)/1 var(--font-sans)", color: "var(--text-secondary)", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 6 }}>Jellyfin path replacements</div>
<h2 style={{ font: "var(--weight-bold) var(--text-2xl)/1.2 var(--font-sans)", color: "var(--text-primary)", margin: 0, marginBottom: 8 }}>Edit path replacements</h2>
<p style={{ font: "var(--text-sm)/1.5 var(--font-sans)", color: "var(--text-secondary)", margin: 0 }}>Map Jellyfin media paths onto the paths ErsatzTV can reach.</p>
</div>
<div style={{ display: "flex", alignItems: "center", justifyContent: "flex-end", gap: 8 }}>
<Button onClick={() => {}} startIcon={<Ico n="ArrowLeft" s={14} />} variant="ghost">Back to Jellyfin</Button>
</div>
</section>
{/* Main content: two-column grid */}
<div style={{ display: "flex", flex: 1, overflow: "hidden", gap: 0 }}>
{/* Left panel: list of replacements */}
<section style={{ display: "flex", flexDirection: "column", width: 280, borderRight: "1px solid var(--border-hairline)", background: "var(--ctv-bg)", overflow: "hidden", flex: "0 0 auto" }} aria-label="Path replacements">
{/* Section header */}
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", padding: "16px 16px", borderBottom: "1px solid var(--border-hairline)", flex: "0 0 auto" }}>
<span style={{ font: "var(--weight-medium) var(--text-sm)/1 var(--font-sans)", color: "var(--text-primary)" }}>Replacements</span>
<Button onClick={() => {}} size="sm" startIcon={<Ico n="Plus" s={14} />} variant="ghost" disabled={isSaving}>Add</Button>
</div>
{/* List of replacements */}
<div style={{ flex: 1, overflow: "auto", padding: "8px" }} role="list" aria-label="Path replacement rows">
{mockReplacements.map((row) => {
const isActive = row.id === selectedId;
return (
<div
key={row.id}
role="listitem"
onClick={() => setSelectedId(row.id)}
style={{
display: "flex",
flexDirection: "column",
gap: 4,
padding: "12px 12px",
marginBottom: 8,
borderRadius: "var(--radius-md)",
background: isActive ? "var(--ctv-accent-soft)" : "var(--ctv-surface)",
border: isActive ? "1px solid var(--ctv-accent)" : "1px solid var(--border-control)",
cursor: "pointer",
transition: "background var(--dur-fast), border-color var(--dur-fast)"
}}
>
<strong style={{ font: "var(--weight-medium) var(--text-sm)/1.2 var(--font-sans)", color: "var(--text-primary)", wordBreak: "break-all" }}>{row.remotePath}</strong>
<div style={{ display: "flex", alignItems: "center", gap: 6, minWidth: 0 }}>
<Ico n="ArrowRight" s={12} color="var(--text-disabled)" />
<span style={{ font: "var(--text-xs)/1 var(--font-sans)", color: "var(--text-secondary)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{row.localPath}</span>
</div>
</div>
);
})}
</div>
</section>
{/* Right panel: edit form */}
<section style={{ display: "flex", flexDirection: "column", flex: 1, overflow: "auto", padding: "24px 28px", background: "var(--surface-app)" }} aria-label="Path replacement editor">
{selected ? (
<Card title={<h3 style={{ font: "var(--weight-semibold) var(--text-lg)/1.2 var(--font-sans)", color: "var(--text-primary)", margin: 0 }}>Edit replacement</h3>} padded>
<div style={{ display: "flex", flexDirection: "column", gap: 20 }}>
<Input
label="Jellyfin Path"
value={selected.remotePath}
disabled={isSaving}
onChange={(e) => handleRemoteChange(e.target.value)}
placeholder="/mnt/media"
error={selected.remotePath.trim() ? null : "Jellyfin Path is required"}
/>
<Input
label="Local Path"
value={selected.localPath}
disabled={isSaving}
onChange={(e) => handleLocalChange(e.target.value)}
placeholder="/var/lib/jellyfin/media"
error={selected.localPath.trim() ? null : "Local Path is required"}
/>
</div>
</Card>
) : (
<div style={{ display: "flex", alignItems: "center", justifyContent: "center", height: "100%", font: "var(--text-sm)/1 var(--font-sans)", color: "var(--text-secondary)" }}>Select or add a path replacement</div>
)}
</section>
</div>
{/* Footer toolbar */}
<div style={{ display: "flex", alignItems: "center", justifyContent: "flex-end", gap: 12, padding: "16px 28px", borderTop: "1px solid var(--border-hairline)", background: "var(--surface-card)", flex: "0 0 auto" }}>
<Button onClick={handleDiscard} disabled={!isDirty || isSaving} variant="ghost">Discard</Button>
<Button
onClick={handleSave}
disabled={!isDirty || isSaving}
loading={isSaving}
startIcon={<Ico n="Check" s={14} />}
variant="primary"
>
Save
</Button>
</div>
</div>
);
}
window.CTVPathReplacementsEdit = PathReplacementsEdit;
})();