diff --git a/services/web-ui/public/screens-library.jsx b/services/web-ui/public/screens-library.jsx index 9e9f8ec..243ab14 100644 --- a/services/web-ui/public/screens-library.jsx +++ b/services/web-ui/public/screens-library.jsx @@ -1,57 +1,69 @@ -// screens-library.jsx — library / asset grid + asset detail -const { ASSETS: ALL_ASSETS, BINS, COMMENTS, PROJECTS } = window.ZAMPP_DATA; +// screens-library.jsx -function Library({ navigate, onOpenAsset, project = "Protour 2026" }) { - const [bin, setBin] = React.useState("b1"); - const [view, setView] = React.useState("grid"); - const [filter, setFilter] = React.useState("all"); - const [search, setSearch] = React.useState(""); +function Library({ navigate, onOpenAsset, openProject }) { + const { ASSETS: ALL_ASSETS, BINS, PROJECTS } = window.ZAMPP_DATA; + const [view, setView] = React.useState('grid'); + const [filter, setFilter] = React.useState('all'); + const [search, setSearch] = React.useState(''); - let assets = ALL_ASSETS; - if (filter !== "all") assets = assets.filter(a => a.status === filter); + let assets = openProject + ? ALL_ASSETS.filter(a => a.project_id === openProject.id) + : ALL_ASSETS; + if (filter !== 'all') assets = assets.filter(a => a.status === filter); if (search) assets = assets.filter(a => a.name.toLowerCase().includes(search.toLowerCase())); + const displayTitle = openProject ? openProject.name : 'All Assets'; + const errorCount = ALL_ASSETS.filter(a => a.status === 'error').length; + const recentCount = ALL_ASSETS.filter(a => (Date.now() - new Date(a.created_at)) < 86400000).length; + return (
-
{project}
+
{displayTitle}
· {assets.length} assets
@@ -59,49 +71,43 @@ function Library({ navigate, onOpenAsset, project = "Protour 2026" }) { setSearch(e.target.value)} placeholder="Filter assets…" />
- {["all", "ready", "processing", "live", "error"].map(f => ( - ))}
- - + +
- {view === "grid" ? ( + {assets.length === 0 ? ( +
No assets match this filter.
+ ) : view === 'grid' ? (
{assets.map(a => onOpenAsset(a)} />)}
) : (
-
-
Name
-
Duration
-
Resolution
-
Codec
-
Size
-
Updated
-
+
Name
Duration
Resolution
Codec
Size
Updated
{assets.map(a => ( -
onOpenAsset(a)}> +
onOpenAsset(a)} style={{ cursor: 'pointer' }}>
{a.name}
-
+
- {a.status} - {a.comments > 0 && · {a.comments} comments} + {a.status}
{a.duration}
{a.res}
-
{a.codec}
+
{a.codec || '—'}
{a.size}
{a.updated}
@@ -119,29 +125,17 @@ function AssetCard({ asset, onOpen }) {
- {asset.status === "live" && LIVE} - {asset.status === "processing" && Proxy {asset.progress}%} - {asset.status === "error" && Error} + {asset.status === 'live' && LIVE} + {asset.status === 'processing' && Processing} + {asset.status === 'error' && Error}
- {asset.type === "video" &&
{asset.duration}
} - {asset.status === "processing" && ( -
-
-
-
-
- )} + {(asset.type === 'video' || !asset.type) && asset.duration !== '—' &&
{asset.duration}
}
{asset.name}
{asset.res} · {asset.size} - {asset.comments > 0 && ( - - {asset.comments} - - )}
@@ -149,7 +143,7 @@ function AssetCard({ asset, onOpen }) { } function binIcon(name) { - return { grid: "library", live: "record", film: "film", proxy: "proxy", audio: "audio", package: "package" }[name] || "folder"; + return { grid: 'library', live: 'record', film: 'film', proxy: 'proxy', audio: 'audio', package: 'package' }[name] || 'folder'; } window.Library = Library;