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

+123 -22
View File
@@ -26,12 +26,17 @@ namespace Chronos.App.Sections;
/// and of the workspace (not sent yet) in one list, merged by render id, with filters, an order, cards or a list, and the
/// actions on the selection: Play in the pane on the right, Show in folder, Copy (or Download) to the videos folder checked
/// by hash, Copy on server, Delete… into the trash after a dry run, Open in Edit, and Send for the workspace's renders.
/// An older server, or none, leaves this PC's videos with the reason.
/// An older server, or none, leaves this PC's videos with the reason. The Board (owner request of 2026-11-06) shows the same
/// renders in two lanes, Published and Workspace (<see cref="VideoBoard"/>), with the workspace's sent renders beside them.
/// </summary>
public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVideosSection
{
private IReadOnlyList<VideoEntry> _entries = [];
private IReadOnlyList<VideoRowViewModel> _rows = [];
private IReadOnlyList<VideoEntry> _sent = [];
private IReadOnlyList<VideoRowViewModel> _sentRows = [];
private IReadOnlyList<VideoRowViewModel> _publishedRows = [];
private IReadOnlyList<VideoRowViewModel> _workspaceRows = [];
private IReadOnlyList<FilterOption<string?>> _kinds = [];
private IReadOnlyList<FilterOption<string?>> _codecs = [];
private IReadOnlyList<FilterOption<int?>> _years = [];
@@ -79,10 +84,15 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
ClearFiltersCommand = new RelayCommand(ClearFilters, () => Filter.IsFiltered);
ClearSequenceCommand = new RelayCommand(() => ShowSequence(null), () => IsSequenceFiltered);
RefreshCommand = new AsyncRelayCommand(RefreshAsync);
_layoutIndex = services.Settings.VideosLayout == LibraryLayout.List ? 1 : 0;
_layoutIndex = services.Settings.VideosLayout switch
{
LibraryLayout.List => 1,
LibraryLayout.Board => 2,
_ => 0,
};
ClearSelectionCommand = new RelayCommand(() =>
{
foreach (var row in _rows) row.IsSelected = false;
foreach (var row in AllRows) row.IsSelected = false;
}, () => HasSelection);
ClosePlayerCommand = new RelayCommand(() => Player = null);
}
@@ -97,7 +107,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
/// <summary>The signed-in server's videos, and what the account may do there.</summary>
internal Func<VideoServer> ServerVideos { get; set; }
/// <summary>The workspace's renders not sent yet.</summary>
/// <summary>The workspace's renders: those not sent yet, and those sent whose file is still there (the Board's).</summary>
internal Func<CancellationToken, Task<IReadOnlyList<VideoEntry>>> WorkspaceRenders { get; set; }
/// <summary>Queues a job of this PC (a copy into the videos folder).</summary>
@@ -147,6 +157,30 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
}
}
/// <summary>The workspace's sent renders whose file is still in its <c>exports/</c>, before the filters (the Board's alone).</summary>
public IReadOnlyList<VideoEntry> SentEntries => _sent;
/// <summary>The Board's Published lane: renders filed at this PC's archive or the server, newest first.</summary>
public IReadOnlyList<VideoRowViewModel> PublishedRows { get => _publishedRows; private set => Set(ref _publishedRows, value); }
/// <summary>The Board's Workspace lane: the workspace's renders not sent yet and those sent, newest first.</summary>
public IReadOnlyList<VideoRowViewModel> WorkspaceRows { get => _workspaceRows; private set => Set(ref _workspaceRows, value); }
/// <summary>The Published lane's count.</summary>
public string PublishedCountText => Formatting.Count(_publishedRows.Count);
/// <summary>The Workspace lane's count.</summary>
public string WorkspaceCountText => Formatting.Count(_workspaceRows.Count);
/// <summary>The Published lane is empty and the Workspace lane is not ("No videos" in the lane; both empty is the section's empty state).</summary>
public bool IsPublishedEmpty => _publishedRows.Count == 0 && _workspaceRows.Count > 0;
/// <summary>The Workspace lane is empty and the Published lane is not.</summary>
public bool IsWorkspaceEmpty => _workspaceRows.Count == 0 && _publishedRows.Count > 0;
/// <summary>The rows of the list and the Board's sent rows: what a selection can hold.</summary>
private IEnumerable<VideoRowViewModel> AllRows => _rows.Concat(_sentRows);
public bool IsLoading
{
get => _isLoading;
@@ -159,26 +193,40 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
}
/// <summary>No video anywhere: "No videos".</summary>
public bool IsEmpty => !_isLoading && _entries.Count == 0;
public bool IsEmpty => !_isLoading && _entries.Count == 0 && (_sent.Count == 0 || !IsBoard);
/// <summary>Videos, none of which the filters keep: "No videos" and Clear filters.</summary>
public bool IsNoMatch => !_isLoading && _entries.Count > 0 && _rows.Count == 0;
public bool IsNoMatch => !_isLoading && !IsEmpty && (IsBoard ? _publishedRows.Count + _workspaceRows.Count == 0 : _rows.Count == 0);
/// <summary>The cards (0) or the list (1), kept for the next run (Settings: <see cref="AppSettings.VideosLayout"/>).</summary>
/// <summary>The cards (0), the list (1) or the Board (2), kept for the next run (Settings: <see cref="AppSettings.VideosLayout"/>).</summary>
public int LayoutIndex
{
get => _layoutIndex;
set
{
if (value is < 0 or > 1 || !Set(ref _layoutIndex, value)) return;
Shell.Services.Settings.VideosLayout = value == 1 ? LibraryLayout.List : LibraryLayout.Grid;
if (value is < 0 or > 2 || !Set(ref _layoutIndex, value)) return;
Shell.Services.Settings.VideosLayout = value switch
{
1 => LibraryLayout.List,
2 => LibraryLayout.Board,
_ => LibraryLayout.Grid,
};
// The sent renders show on the Board alone: off it, none of them stays selected out of sight.
if (value != 2)
{
foreach (var row in _sentRows) row.IsSelected = false;
}
OnPropertyChanged(nameof(IsGrid));
OnPropertyChanged(nameof(IsList));
OnPropertyChanged(nameof(IsBoard));
OnPropertyChanged(nameof(IsEmpty));
OnPropertyChanged(nameof(IsNoMatch));
}
}
public bool IsGrid => _layoutIndex == 0;
public bool IsList => _layoutIndex == 1;
public bool IsBoard => _layoutIndex == 2;
// ---- Filters ----
@@ -295,12 +343,12 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
// ---- Selection ----
public IReadOnlyList<VideoRowViewModel> SelectedRows => [.. _rows.Where(r => r.IsSelected)];
public IReadOnlyList<VideoRowViewModel> SelectedRows => [.. AllRows.Where(r => r.IsSelected)];
public bool HasSelection => _rows.Any(r => r.IsSelected);
public bool HasSelection => AllRows.Any(r => r.IsSelected);
/// <summary>"Selected: 3".</summary>
public string SelectionText => Loc.L("Videos.Selected", Formatting.Count(_rows.Count(r => r.IsSelected)));
public string SelectionText => Loc.L("Videos.Selected", Formatting.Count(AllRows.Count(r => r.IsSelected)));
public ICommand ClearSelectionCommand { get; }
@@ -371,6 +419,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
{
[var one] when CanOpen(one.Entry) => Loc.L("Tooltips.Videos.OpenInEdit"),
[{ Entry.IsUnsent: true }] => Loc.L("Tooltips.Videos.WorkspaceRow"),
[{ Entry.IsWorkspaceSent: true } sent] => WorkspaceText.ForHome("Tooltips.Videos.SentRow", sent.Entry.WorkspaceServerHome),
[_] => Loc.L("Tooltips.Videos.ServerOnly"),
[] => Loc.L("Tooltips.Videos.OpenInEdit"),
_ => Loc.L("Tooltips.Videos.SelectOne"),
@@ -408,6 +457,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
var merged = await WithLocalCopiesAsync(VideoSources.Merge(local, remote, workspace));
if (load != _loads) return;
_server = state;
_sent = [.. workspace.Where(e => e.IsWorkspaceSent)];
Entries = merged;
OnPropertyChanged(nameof(ServerState));
OnPropertyChanged(nameof(IsServerLimited));
@@ -428,6 +478,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
BuildOptions();
// The rows' words are made with them: made again in the new language.
Rows = [];
SetSentRows([]);
Apply();
base.OnLanguageChanged();
}
@@ -515,14 +566,57 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
private void Apply()
{
// A row is kept while its render reads the same (its selection and its poster with it).
var cache = _rows.ToDictionary(r => r.Entry.Id);
Rows = [.. Filter.Apply(_entries).Select(e => cache.TryGetValue(e.Id, out var row)
? row.Entry == e ? row : new VideoRowViewModel(e) { IsSelected = row.IsSelected, Poster = row.Poster }
: new VideoRowViewModel(e))];
if (_player is { } player && !_entries.Any(e => e.Id == player.Entry.Id)) Player = null;
var filter = Filter;
Rows = Reuse(_rows, filter.Apply(_entries));
// The Board: the same rows in their lanes, and the workspace's sent renders as rows of their own (a sent render's id is
// its home entry's too).
var (published, workspace) = VideoBoard.Split(_entries, _sent, filter);
SetSentRows(Reuse(_sentRows, workspace.Where(e => e.IsWorkspaceSent)));
var listed = _rows.ToDictionary(r => r.Entry.Id);
var sent = _sentRows.ToDictionary(r => r.Entry.Id);
PublishedRows = [.. published.Select(e => listed[e.Id])];
WorkspaceRows = [.. workspace.Select(e => e.IsWorkspaceSent ? sent[e.Id] : listed[e.Id])];
OnPropertyChanged(nameof(PublishedCountText));
OnPropertyChanged(nameof(WorkspaceCountText));
OnPropertyChanged(nameof(IsPublishedEmpty));
OnPropertyChanged(nameof(IsWorkspaceEmpty));
OnPropertyChanged(nameof(IsEmpty));
OnPropertyChanged(nameof(IsNoMatch));
if (_player is { } player && !_entries.Concat(_sent).Any(e => e.Id == player.Entry.Id)) Player = null;
OnPropertyChanged(nameof(Filter));
}
/// <summary>The rows of <paramref name="entries"/>, each kept from <paramref name="rows"/> while its render reads the same.</summary>
private static IReadOnlyList<VideoRowViewModel> Reuse(IReadOnlyList<VideoRowViewModel> rows, IEnumerable<VideoEntry> entries)
{
var cache = rows.ToDictionary(r => r.Entry.Id);
return
[
.. entries.Select(e => cache.TryGetValue(e.Id, out var row)
? row.Entry == e ? row : new VideoRowViewModel(e) { IsSelected = row.IsSelected, Poster = row.Poster }
: new VideoRowViewModel(e)),
];
}
/// <summary>The Board's sent rows, wired as the list's are.</summary>
private void SetSentRows(IReadOnlyList<VideoRowViewModel> rows)
{
foreach (var row in _sentRows)
{
row.SelectionChanged -= OnSelectionChanged;
row.PosterRequested -= OnPosterRequested;
}
var changed = _sentRows.Any(r => r.IsSelected) || rows.Any(r => r.IsSelected);
_sentRows = rows;
foreach (var row in _sentRows)
{
row.Section = this;
row.SelectionChanged += OnSelectionChanged;
row.PosterRequested += OnPosterRequested;
}
if (changed) OnSelectionChanged(null);
}
private void SetFilter<T>(ref FilterOption<T> field, FilterOption<T> value, [System.Runtime.CompilerServices.CallerMemberName] string? name = null)
{
if (EqualityComparer<FilterOption<T>>.Default.Equals(field, value)) return;
@@ -619,7 +713,7 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
OnPropertyChanged(nameof(ShowInFolderToolTip));
OnPropertyChanged(nameof(OpenInEditToolTip));
// A row's menu acts on the selection it is part of: its words follow the selection too.
foreach (var each in _rows) each.RefreshMenu();
foreach (var each in AllRows) each.RefreshMenu();
CommandManager.InvalidateRequerySuggested();
}
@@ -671,7 +765,12 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
internal string? CopyBlocker(IReadOnlyList<VideoRowViewModel> rows)
{
if (rows.Count == 0) return Loc.L("Tooltips.Videos.Copy");
if (!rows.Any(r => Copyable(r.Entry))) return rows.All(r => r.Entry.Missing) ? Loc.L("Tooltips.Videos.Missing") : Loc.L("Tooltips.Videos.WorkspaceRow");
if (!rows.Any(r => Copyable(r.Entry)))
{
return rows.All(r => r.Entry.Missing) ? Loc.L("Tooltips.Videos.Missing")
: rows.All(r => r.Entry.IsWorkspaceSent) ? WorkspaceText.ForHome("Tooltips.Videos.SentRow", rows[0].Entry.WorkspaceServerHome)
: Loc.L("Tooltips.Videos.WorkspaceRow");
}
if (FolderProblem() is { } problem) return VideoText.FolderReason(problem);
return LocalLibrary() is { IsAvailable: true } ? null : Loc.L("Tooltips.Videos.Copy");
}
@@ -688,7 +787,8 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
internal string? DeleteBlocker(IReadOnlyList<VideoRowViewModel> rows)
{
if (rows.Count == 0) return Loc.L("Tooltips.Videos.Delete");
if (rows.All(r => r.Entry.IsUnsent)) return Loc.L("Tooltips.Videos.WorkspaceRow");
if (rows.All(r => r.Entry.IsWorkspaceSent)) return WorkspaceText.ForHome("Tooltips.Videos.SentRow", rows[0].Entry.WorkspaceServerHome);
if (rows.All(r => r.Entry.IsUnsent || r.Entry.IsWorkspaceSent)) return Loc.L("Tooltips.Videos.WorkspaceRow");
var local = rows.Any(r => r.Entry.IsLocal) && LocalLibrary() is { IsAvailable: true };
var server = rows.Any(r => !r.Entry.IsLocal && r.Entry.IsOnServer);
if (local) return null;
@@ -699,9 +799,10 @@ public sealed class VideosViewModel : SectionViewModel, Chronos.App.Editor.IVide
/// <summary>A render Copy to folder takes: this PC's file, or the server's alone (downloaded).</summary>
private bool Copyable(VideoEntry entry) =>
!entry.IsUnsent && !entry.Missing && (entry.IsLocal || (entry.IsOnServer && _server.State == VideoServerState.Available));
!entry.IsUnsent && !entry.IsWorkspaceSent && !entry.Missing && (entry.IsLocal || (entry.IsOnServer && _server.State == VideoServerState.Available));
private static bool CanOpen(VideoEntry entry) => entry.IsLocal || entry is { IsUnsent: true, WorkspaceServerHome: false };
/// <summary>Open in Edit: a render of this PC's archive, or a workspace's whose project's home is this PC's archive.</summary>
private static bool CanOpen(VideoEntry entry) => entry.IsLocal || (entry is { WorkspaceServerHome: false } && (entry.IsUnsent || entry.IsWorkspaceSent));
// ---- Actions ----