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>
196 lines
8.6 KiB
React
196 lines
8.6 KiB
React
// ImageBrowser screen — a recursive folder tree for image-library slideshow
|
|
// sources: expand/collapse subfolders, an inherited/overridden per-folder
|
|
// slideshow duration, and quick jump-to-search per folder.
|
|
(function () {
|
|
const NS = window.ChicoryTVDesignSystem_eb3b61;
|
|
const { Button, IconButton, Card, Input, Spinner, Tooltip } = NS;
|
|
const Ico = window.Ico;
|
|
const mono = { fontFamily: "var(--font-mono)", fontVariantNumeric: "tabular-nums" };
|
|
|
|
// ---- mock data: a nested folder tree ----------------------------------
|
|
const TREE = [
|
|
{
|
|
id: 1,
|
|
name: "Movies",
|
|
fullPath: "/media/images/Movies",
|
|
imageCount: 120,
|
|
subfolderCount: 4,
|
|
durationSeconds: null,
|
|
expanded: true,
|
|
children: [
|
|
{ id: 11, name: "Posters", fullPath: "/media/images/Movies/Posters", imageCount: 40, subfolderCount: 0, durationSeconds: 8 },
|
|
{ id: 12, name: "Backdrops", fullPath: "/media/images/Movies/Backdrops", imageCount: 35, subfolderCount: 0, durationSeconds: null },
|
|
{ id: 13, name: "Logos", fullPath: "/media/images/Movies/Logos", imageCount: 20, subfolderCount: 0, durationSeconds: null },
|
|
{ id: 14, name: "Thumbs", fullPath: "/media/images/Movies/Thumbs", imageCount: 25, subfolderCount: 0, durationSeconds: 5 },
|
|
],
|
|
},
|
|
{
|
|
id: 2,
|
|
name: "TV Shows",
|
|
fullPath: "/media/images/TV Shows",
|
|
imageCount: 85,
|
|
subfolderCount: 6,
|
|
durationSeconds: null,
|
|
expanded: false,
|
|
children: [],
|
|
},
|
|
{
|
|
id: 3,
|
|
name: "Wallpapers",
|
|
fullPath: "/media/images/Wallpapers",
|
|
imageCount: 300,
|
|
subfolderCount: 0,
|
|
durationSeconds: 12,
|
|
expanded: false,
|
|
children: [],
|
|
},
|
|
{
|
|
id: 4,
|
|
name: "Screensaver Rotation",
|
|
fullPath: "/media/images/Screensaver Rotation",
|
|
imageCount: 54,
|
|
subfolderCount: 2,
|
|
durationSeconds: null,
|
|
expanded: true,
|
|
children: [
|
|
{ id: 41, name: "Nature", fullPath: "/media/images/Screensaver Rotation/Nature", imageCount: 30, subfolderCount: 0, durationSeconds: null },
|
|
{ id: 42, name: "Abstract", fullPath: "/media/images/Screensaver Rotation/Abstract", imageCount: 24, subfolderCount: 0, durationSeconds: 10 },
|
|
],
|
|
},
|
|
{
|
|
id: 5,
|
|
name: "Concert Photos 2024",
|
|
fullPath: "/media/images/Concert Photos 2024",
|
|
imageCount: 0,
|
|
subfolderCount: 0,
|
|
durationSeconds: null,
|
|
expanded: false,
|
|
children: [],
|
|
loading: true,
|
|
},
|
|
];
|
|
|
|
function EditDurationOverlay({ folder, onClose }) {
|
|
const [value, setValue] = React.useState(folder.durationSeconds != null ? String(folder.durationSeconds) : "");
|
|
return (
|
|
<div style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,0.4)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 50 }} onClick={onClose}>
|
|
<div
|
|
onClick={(e) => e.stopPropagation()}
|
|
style={{ width: 420, background: "var(--surface-raised)", border: "1px solid var(--border-hairline)", borderRadius: "var(--radius-md)", boxShadow: "var(--shadow-lg)", padding: "var(--pad-card)" }}
|
|
>
|
|
<div style={{ font: "var(--weight-semibold) var(--text-md)/1.2 var(--font-sans)", color: "var(--text-primary)", marginBottom: 14 }}>
|
|
Duration — {folder.name}
|
|
</div>
|
|
<div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
|
|
<Input label="Seconds per image" value={value} onChange={(e) => setValue(e.target.value)} placeholder="Inherited from parent" type="number" fullWidth />
|
|
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
|
<Button size="sm" variant="ghost">Clear</Button>
|
|
<span style={{ flex: 1 }} />
|
|
<Button size="sm" variant="ghost" onClick={onClose}>Cancel</Button>
|
|
<Button size="sm" variant="primary" onClick={onClose}>Save</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function FolderRow({ folder, depth, expandedMap, onToggle, onEdit }) {
|
|
const hasChildren = folder.subfolderCount > 0;
|
|
const isExpanded = !!expandedMap[folder.id];
|
|
const isLoading = !!folder.loading;
|
|
|
|
return (
|
|
<div>
|
|
<div
|
|
style={{
|
|
display: "flex",
|
|
alignItems: "center",
|
|
gap: 8,
|
|
height: "var(--row-h, 44px)",
|
|
paddingLeft: depth * 20 + 8,
|
|
paddingRight: 12,
|
|
borderTop: "1px solid var(--border-hairline)",
|
|
}}
|
|
>
|
|
<IconButton size="sm" title={hasChildren ? (isExpanded ? "Collapse" : "Expand") : "No subfolders"} disabled={!hasChildren} onClick={() => hasChildren && onToggle(folder.id)}>
|
|
{hasChildren ? <Ico n={isExpanded ? "ChevronDown" : "ChevronRight"} s={15} /> : <Ico n="FolderTree" s={15} color="var(--text-faint)" />}
|
|
</IconButton>
|
|
<span
|
|
title={folder.fullPath}
|
|
style={{ font: "var(--weight-medium) var(--text-sm)/1.2 var(--font-sans)", color: "var(--text-primary)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", flex: "0 1 auto", maxWidth: 320 }}
|
|
>
|
|
{folder.name}
|
|
</span>
|
|
<span style={{ font: "var(--text-xs)/1 var(--font-sans)", color: "var(--text-disabled)", whiteSpace: "nowrap" }}>
|
|
{folder.imageCount} image{folder.imageCount === 1 ? "" : "s"} · {folder.subfolderCount} subfolder{folder.subfolderCount === 1 ? "" : "s"}
|
|
</span>
|
|
<span style={{ flex: 1 }} />
|
|
<span style={{ display: "inline-flex", alignItems: "center", gap: 5, font: "var(--text-xs)/1 var(--font-sans)", color: folder.durationSeconds != null ? "var(--text-secondary)" : "var(--text-faint)", whiteSpace: "nowrap" }}>
|
|
<Ico n="Clock" s={13} />
|
|
<span style={folder.durationSeconds != null ? mono : undefined}>{folder.durationSeconds != null ? `${folder.durationSeconds}s` : "inherited"}</span>
|
|
</span>
|
|
<Tooltip label="Edit duration">
|
|
<IconButton size="sm" title="Edit duration" onClick={() => onEdit(folder)}>
|
|
<Ico n="Pencil" s={14} />
|
|
</IconButton>
|
|
</Tooltip>
|
|
<Tooltip label="Search this folder">
|
|
<IconButton size="sm" title="Search this folder">
|
|
<Ico n="Search" s={14} />
|
|
</IconButton>
|
|
</Tooltip>
|
|
</div>
|
|
|
|
{isExpanded && isLoading ? (
|
|
<div style={{ display: "flex", alignItems: "center", gap: 8, paddingLeft: depth * 20 + 28, paddingTop: 8, paddingBottom: 8, font: "var(--text-xs)/1 var(--font-sans)", color: "var(--text-secondary)" }}>
|
|
<Spinner size={14} />
|
|
<span>Loading…</span>
|
|
</div>
|
|
) : null}
|
|
|
|
{isExpanded && folder.children && folder.children.length > 0
|
|
? folder.children.map((child) => (
|
|
<FolderRow key={child.id} folder={child} depth={depth + 1} expandedMap={expandedMap} onToggle={onToggle} onEdit={onEdit} />
|
|
))
|
|
: null}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function ImageBrowser() {
|
|
const initialExpanded = {};
|
|
TREE.forEach((f) => { if (f.expanded) initialExpanded[f.id] = true; });
|
|
const [expandedMap, setExpandedMap] = React.useState(initialExpanded);
|
|
const [editing, setEditing] = React.useState(null);
|
|
|
|
const onToggle = (id) => setExpandedMap((m) => ({ ...m, [id]: !m[id] }));
|
|
|
|
return (
|
|
<div style={{ display: "flex", flexDirection: "column", height: "100%" }}>
|
|
{/* action bar */}
|
|
<div style={{ display: "flex", alignItems: "center", gap: 12, padding: "12px 20px", borderBottom: "1px solid var(--border-hairline)", flex: "0 0 auto", minHeight: 58 }}>
|
|
<span style={{ display: "inline-flex", alignItems: "center", gap: 8, font: "var(--text-sm)/1 var(--font-sans)", color: "var(--text-secondary)" }}>
|
|
<Ico n="FolderTree" s={15} color="var(--text-disabled)" />
|
|
Image library folders, indexed for slideshow scheduling
|
|
</span>
|
|
<span style={{ flex: 1 }} />
|
|
<Button size="sm" variant="ghost" startIcon={<Ico n="Image" s={14} />}>Browse images</Button>
|
|
</div>
|
|
|
|
<div style={{ flex: 1, overflow: "auto", padding: "16px 20px" }}>
|
|
<Card padded={false}>
|
|
{TREE.map((folder) => (
|
|
<FolderRow key={folder.id} folder={folder} depth={0} expandedMap={expandedMap} onToggle={onToggle} onEdit={setEditing} />
|
|
))}
|
|
</Card>
|
|
</div>
|
|
|
|
{editing ? <EditDurationOverlay folder={editing} onClose={() => setEditing(null)} /> : null}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
window.CTVImageBrowser = ImageBrowser;
|
|
})();
|