feat(videos): board of published and workspace renders; card line starts with the preset

The Videos section and the admin Videos page gain a Board view with two
lanes, newest first, each with a count and the list's filters: Published
(library and server renders, including those sent from a workspace) and
Workspace (workspace exports, unsent ones plus sent ones marked Sent).
Cards show the sequence, project and version when known, preset, kind,
date and state chips, and reuse the existing actions; no new store.

Video cards now start with the preset ("4K archive · HEVC · 0:41 · 1.4 GB")
and Formatting.Bytes keeps number and unit together with a no-break space
(#28). The capture tool adds the videos-board scene in both themes.

Refs #29

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-06 17:13:26 +01:00
1 parent fe50b87726
commit 5a6efbb72f
27 files changed
+792 -74

No files matched your search

+10
View File
@@ -434,6 +434,16 @@ dialog.player .viewer-head .ellipsis { flex: 0 1 auto; }
.seq-items.rows.video-items { grid-template-columns: max-content 64px minmax(120px, 1fr) max-content minmax(60px, max-content); }
.video-items .col-kind, .video-items .col-format, .video-items .col-duration { display: none; }
}
/* The Videos board (owner request of 2026-11-06): two lanes side by side, Published and Workspace, each a heading with its
count over its own grid of cards; one lane under the other on a narrow screen. */
.seq-items.board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 16px; align-items: start; }
.board-lane { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.board-head { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 600; }
.board-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.board-cards > .empty-lane { grid-column: 1 / -1; margin: 0; padding: 16px 0; color: var(--text-muted); text-align: center; }
@media (max-width: 900px) {
.seq-items.board { grid-template-columns: minmax(0, 1fr); }
}
/* Upload dialog (owner review 2, R3, upload.js): the target, a drop zone, the photos with their state, the total. */
dialog.dialog.upload { width: 640px; }
+1
View File
@@ -16,6 +16,7 @@ export const icons = {
plus: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M8 3 V13 M3 8 H13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
copy: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M6.5 5 H13.0 A1.5 1.5 0 0 1 14.5 6.5 V13.0 A1.5 1.5 0 0 1 13.0 14.5 H6.5 A1.5 1.5 0 0 1 5 13.0 V6.5 A1.5 1.5 0 0 1 6.5 5 Z M11 5 V2.5 A1 1 0 0 0 10 1.5 H2.5 A1 1 0 0 0 1.5 2.5 V10 A1 1 0 0 0 2.5 11 H5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
search: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M2.5 7 A4.5 4.5 0 1 0 11.5 7 A4.5 4.5 0 1 0 2.5 7 Z M10.4 10.4 L14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
board: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V2.5 A1 1 0 0 1 10 1.5 ZM3.5 4.5 H5.0 M3.5 7 H5.0 M11 4.5 H12.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
grid: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V6.0 A1 1 0 0 1 6.0 7.0 H2.5 A1 1 0 0 1 1.5 6.0 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V6.0 A1 1 0 0 1 13.5 7.0 H10 A1 1 0 0 1 9 6.0 V2.5 A1 1 0 0 1 10 1.5 ZM2.5 9 H6.0 A1 1 0 0 1 7.0 10 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V10 A1 1 0 0 1 2.5 9 ZM10 9 H13.5 A1 1 0 0 1 14.5 10 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V10 A1 1 0 0 1 10 9 Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
list: `<svg class="directional" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M5.5 4 H13.5 M5.5 8 H13.5 M5.5 12 H13.5 M2.5 4 H2.6 M2.5 8 H2.6 M2.5 12 H2.6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
trash: `<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M2.5 4 H13.5 M6 4 V2.5 H10 V4 M3.8 4 L4.6 14 H11.4 L12.2 4 M6.6 6.8 V11.2 M9.4 6.8 V11.2" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
+79 -4
View File
@@ -3,6 +3,9 @@
// edits (owner review 2, R6): it plays a render in the browser, downloads it, copies it hash-verified into the server's
// videos folder (a video-copy job) and deletes it into the archive's trash after a dry run that names what goes, whose
// fingerprint the delete sends back. Restoring goes through Library › Trash. Nothing here renders or changes a project.
// The board (owner request of 2026-11-06) shows the same videos in two lanes, newest first: Published, every render the
// server holds, and Workspace, those a PC's workspace made and sent here (boardLane), marked Sent with the PC's name; the
// renders a workspace has not sent yet stay on that PC, where the desktop's board lists them.
import { t, applyStrings } from "../i18n.js";
import { escapeHtml, attr, formatBytes, formatNumber, formatDateTime, toast, errorText, confirmDialog, emptyState, routeParams, redraw } from "../ui.js";
import { icons } from "../icons.js";
@@ -48,6 +51,12 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
folder = s.videosPath ?? "";
if (root.isConnected) drawMass();
}, () => {});
/** The server's name, which its own renders carry as producedBy: the board tells them from a workspace's (boardLane). */
let serverName = null;
api.get("/api/v1/server/info").then((info) => {
serverName = info.name ?? null;
if (root.isConnected && view === "board") draw();
}, () => {});
actions.innerHTML = `
<a class="btn" href="#/library?view=trash" data-i18n-title="Admin.Videos.Trash.Tip">${icons.trash}<span data-i18n="Admin.Library.Trash"></span></a>
@@ -72,6 +81,8 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
aria-label="${attr(t("Admin.Videos.View.Cards"))}">${icons.grid}</button>
<button class="btn icon" data-view="list" aria-pressed="${view === "list"}" data-i18n-title="Admin.Videos.View.List.Tip"
aria-label="${attr(t("Admin.Videos.View.List"))}">${icons.list}</button>
<button class="btn icon" data-view="board" aria-pressed="${view === "board"}" data-i18n-title="Admin.Videos.View.Board.Tip"
aria-label="${attr(t("Admin.Videos.View.Board"))}">${icons.board}</button>
</div>
</div>
<section class="panel flush library" aria-label="${attr(t("Admin.Videos.Title"))}">
@@ -160,7 +171,11 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
cursor = page.next ?? null;
if (!more) total = page.total ?? null;
learn(page.items);
if (more) {
if (more && view === "board") {
// A lane's cards stay newest first: the board is drawn again with the page added.
rows = rows.concat(page.items);
draw();
} else if (more) {
rows = rows.concat(page.items);
itemsHost.insertAdjacentHTML("beforeend", page.items.map(itemHtml).join(""));
watchImages(itemsHost);
@@ -260,7 +275,7 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
}
function draw() {
itemsHost.className = `seq-items video-items ${view === "list" ? "rows" : "cards"}`;
itemsHost.className = `seq-items video-items ${view === "list" ? "rows" : view === "board" ? "board" : "cards"}`;
itemsHost.setAttribute("role", "listbox");
itemsHost.setAttribute("aria-multiselectable", "true");
itemsHost.setAttribute("aria-label", t("Admin.Videos.Title"));
@@ -274,6 +289,14 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
syncSelection();
return;
}
if (view === "board") {
itemsHost.innerHTML = boardHtml();
applyStrings(itemsHost);
watchImages(itemsHost);
grid.restore();
syncSelection();
return;
}
const head = view === "list" ? `<div class="seq-head" aria-hidden="true"><span></span><span></span>
<span data-i18n="Admin.Videos.Column.Title"></span><span class="col-kind" data-i18n="Admin.Videos.Column.Kind"></span>
<span class="col-format" data-i18n="Admin.Videos.Column.Format"></span><span class="end col-duration" data-i18n="Admin.Videos.Column.Duration"></span>
@@ -286,7 +309,22 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
syncSelection();
}
function itemHtml(v) {
/**
* The two lanes, newest first whatever the order chosen, each with its count: Published holds every video shown, Workspace
* those a PC's workspace sent here, again as cards of their own marked Sent.
*/
function boardHtml() {
const newest = [...rows].sort((a, b) => (Date.parse(b.created) - Date.parse(a.created)) || String(a.id).localeCompare(String(b.id)));
const sent = newest.filter((v) => boardLane(v, serverName) === "workspace");
const lane = (key, items, workspace) => `<section class="board-lane" aria-label="${attr(t(`Admin.Videos.Lane.${key}`))}">
<h2 class="board-head" title="${attr(t(`Admin.Videos.Lane.${key}.Tip`))}"><span>${escapeHtml(t(`Admin.Videos.Lane.${key}`))}</span>
<span class="pill num">${escapeHtml(formatNumber(items.length))}</span></h2>
<div class="board-cards">${items.length > 0 ? items.map((v) => itemHtml(v, workspace)).join("")
: `<p class="empty-lane">${escapeHtml(t("Admin.Videos.Empty"))}</p>`}</div></section>`;
return lane("Published", newest, false) + lane("Workspace", sent, true);
}
function itemHtml(v, workspace = false) {
const kind = videoKind(v);
const format = formatText(v);
const length = kind === "still" ? "" : clock(v.durationSeconds);
@@ -308,6 +346,18 @@ export async function render(root, { api, setMeta, actions, onEvent }) {
<span class="chips-row">${stateChips(v)}</span>
</div>`;
}
// On the board: the project and its version, then preset · codec · length · size, then kind · date (issue #28's order).
if (view === "board") {
return `<div class="seq-card${missing}" role="option" data-key="${attr(v.id)}" aria-selected="false" tabindex="-1" aria-label="${attr(label)}" title="${attr(t("Admin.Videos.Play.Tip"))}">
${thumb}${check}
<span class="count num" aria-hidden="true">${escapeHtml(length || kindText(kind))}</span>
<span class="info"><strong class="ellipsis" dir="auto">${escapeHtml(v.sequenceTitle)}</strong>
${v.projectName ? `<span class="facts ellipsis" dir="auto">${escapeHtml(projectText(v))}</span>` : ""}
<span class="facts ellipsis" dir="auto">${escapeHtml(cardText(v))}</span>
<span class="facts ellipsis">${escapeHtml(`${kindText(kind)} · ${formatDateTime(v.created)}`)}</span>
<span class="chips-row">${workspace ? sentChip(v) : ""}${stateChips(v)}</span></span>
</div>`;
}
return `<div class="seq-card${missing}" role="option" data-key="${attr(v.id)}" aria-selected="false" tabindex="-1" aria-label="${attr(label)}" title="${attr(t("Admin.Videos.Play.Tip"))}">
${thumb}${check}
<span class="count num" aria-hidden="true">${escapeHtml(length || kindText(kind))}</span>
@@ -580,6 +630,30 @@ function formatText(v) {
return parts.join(" · ");
}
/**
* The board's lane of a video: "workspace" for a render a PC's workspace made and sent here (it names its project, and a
* machine other than this server produced it), else "published". Every video is also in Published: the server holds it.
*/
export function boardLane(v, serverName) {
const producer = String(v.producedBy ?? "");
return v.projectId && producer && producer !== String(serverName ?? "") ? "workspace" : "published";
}
/** "Social cut · Version 3": the project rendered and its version. */
function projectText(v) {
return v.projectVersionNumber ? `${v.projectName} · ${t("Admin.Videos.Version", formatNumber(v.projectVersionNumber))}` : v.projectName;
}
/** "4K archive · HEVC · 0:41 · 1.4 GB": the preset first, then the codec, the length (none for a still) and the size. */
function cardText(v) {
return [v.presetName, codecLabel(v.codec), videoKind(v) === "still" ? "" : clock(v.durationSeconds), formatBytes(v.bytes)].filter(Boolean).join(" · ");
}
/** Sent, from which PC's workspace. */
function sentChip(v) {
return `<span class="st ok" title="${attr(t("Admin.Videos.State.Sent.Tip", v.producedBy ?? ""))}"><span aria-hidden="true">↑</span> ${escapeHtml(t("Admin.Videos.State.Sent"))}</span>`;
}
function presetText(v) {
return v.projectName ? `${v.presetName} · ${v.projectName}${v.projectVersionNumber ? ` v${v.projectVersionNumber}` : ""}` : v.presetName;
}
@@ -627,7 +701,8 @@ function clock(seconds) {
function storedView() {
try {
return localStorage.getItem(VIEW_KEY) === "list" ? "list" : "cards";
const stored = localStorage.getItem(VIEW_KEY);
return stored === "list" || stored === "board" ? stored : "cards";
} catch {
return "cards";
}