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

+9
View File
@@ -1124,6 +1124,15 @@
<data name="Admin.Videos.View.Cards.Tip" xml:space="preserve"><value>Show the videos as cards</value></data>
<data name="Admin.Videos.View.List" xml:space="preserve"><value>List</value></data>
<data name="Admin.Videos.View.List.Tip" xml:space="preserve"><value>Show the videos as a list</value></data>
<data name="Admin.Videos.View.Board" xml:space="preserve"><value>Board</value></data>
<data name="Admin.Videos.View.Board.Tip" xml:space="preserve"><value>Show the videos in two lanes: published, and sent from a workspace</value></data>
<data name="Admin.Videos.Lane.Published" xml:space="preserve"><value>Published</value></data>
<data name="Admin.Videos.Lane.Published.Tip" xml:space="preserve"><value>Every render this server holds, newest first</value></data>
<data name="Admin.Videos.Lane.Workspace" xml:space="preserve"><value>Workspace</value></data>
<data name="Admin.Videos.Lane.Workspace.Tip" xml:space="preserve"><value>Renders a PC's workspace made and sent here; those not sent yet stay on that PC</value></data>
<data name="Admin.Videos.State.Sent" xml:space="preserve"><value>Sent</value></data>
<data name="Admin.Videos.State.Sent.Tip" xml:space="preserve"><value>Sent from the workspace of {0}</value><comment>{0} a computer's name</comment></data>
<data name="Admin.Videos.Version" xml:space="preserve"><value>Version {0}</value><comment>{0} a project version number</comment></data>
<data name="Admin.Videos.Selected" xml:space="preserve"><value>Selected: {0}</value><comment>{0} a count</comment></data>
<data name="Admin.Videos.Select.Tip" xml:space="preserve"><value>Select this video</value></data>
<data name="Admin.Videos.SelectAll.Tip" xml:space="preserve"><value>Select every video shown</value></data>
+7
View File
@@ -1075,6 +1075,13 @@
<data name="Tooltips.Videos.Select" xml:space="preserve"><value>Select the video; Ctrl and Shift add to the selection</value></data>
<data name="Tooltips.Videos.SelectOne" xml:space="preserve"><value>Select one video only to do this</value></data>
<data name="Tooltips.Videos.ServerOnly" xml:space="preserve"><value>Only on the server: not on this PC</value></data>
<data name="Tooltips.Videos.View.Board" xml:space="preserve"><value>Show the videos in two lanes: published, and in the workspace</value></data>
<data name="Tooltips.Videos.Lane.Published" xml:space="preserve"><value>Renders filed in this PC's archive or on the server, newest first</value></data>
<data name="Tooltips.Videos.Lane.Workspace" xml:space="preserve"><value>Renders made in the workspace: not sent yet, or sent and still in its exports</value></data>
<data name="Tooltips.Videos.Sent" xml:space="preserve"><value>Sent to the archive; the file is still in the workspace</value></data>
<data name="Tooltips.Videos.Sent.Server" xml:space="preserve"><value>Sent to the server; the file is still in the workspace</value></data>
<data name="Tooltips.Videos.SentRow" xml:space="preserve"><value>Rendered in the workspace and sent to the archive: play it or show it here</value></data>
<data name="Tooltips.Videos.SentRow.Server" xml:space="preserve"><value>Rendered in the workspace and sent to the server: play it or show it here</value></data>
<data name="Tooltips.Settings.VideosFolder" xml:space="preserve"><value>Where Copy to folder puts videos; not inside the archive or the workspace</value></data>
<data name="Tooltips.Settings.VideosBrowse" xml:space="preserve"><value>Choose the videos folder</value></data>
<data name="Tooltips.Settings.VideosOpen" xml:space="preserve"><value>Open the videos folder in Explorer</value></data>
+8
View File
@@ -35,6 +35,14 @@
<data name="Videos.Sort.Title" xml:space="preserve"><value>Title</value></data>
<data name="Videos.View.Grid" xml:space="preserve"><value>Grid</value></data>
<data name="Videos.View.List" xml:space="preserve"><value>List</value></data>
<data name="Videos.View.Board" xml:space="preserve"><value>Board</value></data>
<data name="Videos.Lane.Published" xml:space="preserve"><value>Published</value></data>
<data name="Videos.Lane.Workspace" xml:space="preserve"><value>Workspace</value></data>
<data name="Videos.State.Sent" xml:space="preserve"><value>Sent</value></data>
<data name="Videos.Version" xml:space="preserve"><value>Version {0}</value><comment>{0} a project version number</comment></data>
<data name="Videos.Kind.One.Video" xml:space="preserve"><value>Video</value></data>
<data name="Videos.Kind.One.Still" xml:space="preserve"><value>Still</value></data>
<data name="Videos.Kind.One.Sequence" xml:space="preserve"><value>Image sequence</value></data>
<data name="Videos.Selected" xml:space="preserve"><value>Selected: {0}</value><comment>{0} a count</comment></data>
<data name="Videos.Empty" xml:space="preserve"><value>No videos</value></data>
<data name="Videos.ServerUnreachable" xml:space="preserve"><value>Server not reachable</value></data>
+9
View File
@@ -1116,6 +1116,15 @@
<data name="Admin.Videos.View.Cards.Tip" xml:space="preserve"><value>Mostra i video come schede</value></data>
<data name="Admin.Videos.View.List" xml:space="preserve"><value>Elenco</value></data>
<data name="Admin.Videos.View.List.Tip" xml:space="preserve"><value>Mostra i video come elenco</value></data>
<data name="Admin.Videos.View.Board" xml:space="preserve"><value>Bacheca</value></data>
<data name="Admin.Videos.View.Board.Tip" xml:space="preserve"><value>Mostra i video in due colonne: pubblicati e inviati da uno spazio di lavoro</value></data>
<data name="Admin.Videos.Lane.Published" xml:space="preserve"><value>Pubblicati</value></data>
<data name="Admin.Videos.Lane.Published.Tip" xml:space="preserve"><value>Tutti i render di questo server, dal più recente</value></data>
<data name="Admin.Videos.Lane.Workspace" xml:space="preserve"><value>Spazio di lavoro</value></data>
<data name="Admin.Videos.Lane.Workspace.Tip" xml:space="preserve"><value>Render fatti nello spazio di lavoro di un PC e inviati qui; quelli non ancora inviati restano su quel PC</value></data>
<data name="Admin.Videos.State.Sent" xml:space="preserve"><value>Inviato</value></data>
<data name="Admin.Videos.State.Sent.Tip" xml:space="preserve"><value>Inviato dallo spazio di lavoro di {0}</value></data>
<data name="Admin.Videos.Version" xml:space="preserve"><value>Versione {0}</value></data>
<data name="Admin.Videos.Selected" xml:space="preserve"><value>Selezionati: {0}</value></data>
<data name="Admin.Videos.Select.Tip" xml:space="preserve"><value>Seleziona questo video</value></data>
<data name="Admin.Videos.SelectAll.Tip" xml:space="preserve"><value>Seleziona tutti i video mostrati</value></data>
+7
View File
@@ -1057,6 +1057,13 @@
<data name="Tooltips.Videos.Select" xml:space="preserve"><value>Seleziona il video; Ctrl e Maiusc aggiungono alla selezione</value></data>
<data name="Tooltips.Videos.SelectOne" xml:space="preserve"><value>Seleziona un solo video per farlo</value></data>
<data name="Tooltips.Videos.ServerOnly" xml:space="preserve"><value>Solo sul server: non su questo PC</value></data>
<data name="Tooltips.Videos.View.Board" xml:space="preserve"><value>Mostra i video in due colonne: pubblicati e nello spazio di lavoro</value></data>
<data name="Tooltips.Videos.Lane.Published" xml:space="preserve"><value>Render archiviati nell'archivio di questo PC o sul server, dal più recente</value></data>
<data name="Tooltips.Videos.Lane.Workspace" xml:space="preserve"><value>Render fatti nello spazio di lavoro: non ancora inviati, o inviati e ancora nelle sue esportazioni</value></data>
<data name="Tooltips.Videos.Sent" xml:space="preserve"><value>Inviato all'archivio; il file è ancora nello spazio di lavoro</value></data>
<data name="Tooltips.Videos.Sent.Server" xml:space="preserve"><value>Inviato al server; il file è ancora nello spazio di lavoro</value></data>
<data name="Tooltips.Videos.SentRow" xml:space="preserve"><value>Renderizzato nello spazio di lavoro e inviato all'archivio: riproducilo o mostralo qui</value></data>
<data name="Tooltips.Videos.SentRow.Server" xml:space="preserve"><value>Renderizzato nello spazio di lavoro e inviato al server: riproducilo o mostralo qui</value></data>
<data name="Tooltips.Videos.ServerOffline" xml:space="preserve"><value>Non connesso a un server: sono elencati solo i video di questo PC</value></data>
<data name="Tooltips.Videos.ServerOld" xml:space="preserve"><value>Il Chronos del server non ha la libreria video; aggiornalo per vederne i video</value></data>
<data name="Tooltips.Videos.ShowInFolder" xml:space="preserve"><value>Mostra il file in Esplora file</value></data>
+8
View File
@@ -35,6 +35,14 @@
<data name="Videos.Sort.Title" xml:space="preserve"><value>Titolo</value></data>
<data name="Videos.View.Grid" xml:space="preserve"><value>Griglia</value></data>
<data name="Videos.View.List" xml:space="preserve"><value>Elenco</value></data>
<data name="Videos.View.Board" xml:space="preserve"><value>Bacheca</value></data>
<data name="Videos.Lane.Published" xml:space="preserve"><value>Pubblicati</value></data>
<data name="Videos.Lane.Workspace" xml:space="preserve"><value>Spazio di lavoro</value></data>
<data name="Videos.State.Sent" xml:space="preserve"><value>Inviato</value></data>
<data name="Videos.Version" xml:space="preserve"><value>Versione {0}</value></data>
<data name="Videos.Kind.One.Video" xml:space="preserve"><value>Video</value></data>
<data name="Videos.Kind.One.Still" xml:space="preserve"><value>Fotogramma</value></data>
<data name="Videos.Kind.One.Sequence" xml:space="preserve"><value>Sequenza di immagini</value></data>
<data name="Videos.Selected" xml:space="preserve"><value>Selezionati: {0}</value></data>
<data name="Videos.Empty" xml:space="preserve"><value>Nessun video</value></data>
<data name="Videos.ServerUnreachable" xml:space="preserve"><value>Server non raggiungibile</value></data>
+28 -2
View File
@@ -518,17 +518,22 @@ public sealed class SampleData
DateTimeOffset created, string? project = null) =>
new(id, sequence, preset, codec, width, height, fps, seconds, bytes, created, "nas", null, null, null, RenderKind.Video, title, first, project, project is null ? null : 3,
VideoStates.Ok, [], $"{first:yyyy-MM-dd} {title} - {preset}.mp4");
var lakeVertical = Guid.CreateVersion7();
var lakeCreated = Now.AddDays(-30);
IReadOnlyList<VideoDto> server =
[
OnServer(Guid.CreateVersion7(), _sunrise, "Sunrise over Superga", new DateTime(2026, 7, 2, 5, 12, 0), "4K HEVC", "hevc", 3840, 2160, 24, 120, 3_960_000_000L, Now.AddHours(-6)),
OnServer(cometVideo.Id, comet.Id, comet.DisplayTitle, comet.FirstCapture!.Value, cometVideo.PresetName, "hevc", 3840, 2160, 24, 41.9, cometVideo.Bytes, cometVideo.Created),
OnServer(Guid.CreateVersion7(), _lakeComo, "Lake Como storm", new DateTime(2026, 8, 21, 16, 30, 0), "Vertical 1080p", "h264", 1080, 1920, 30, 48.3, 248_000_000L,
Now.AddDays(-30), project: "Vertical social"),
OnServer(lakeVertical, _lakeComo, "Lake Como storm", new DateTime(2026, 8, 21, 16, 30, 0), "Vertical 1080p", "h264", 1080, 1920, 30, 48.3, 248_000_000L,
lakeCreated, project: "Vertical social"),
];
var milan = await LocalAsync("Milan skyline dusk");
var gif = Path.Combine(_services.Environment.DataDirectory, "workspace-sample", "exports", $"{milan.FirstCapture:yyyy-MM-dd} {milan.DisplayTitle} - GIF preview.gif");
WriteStandIn(gif);
// A render the workspace sent to the server, whose file is still in its exports: the Board's Workspace lane, as sent.
var vertical = Path.Combine(_services.Environment.DataDirectory, "workspace-sample", "exports", "2026-08-21 Lake Como storm - Vertical 1080p.mp4");
WriteStandIn(vertical);
IReadOnlyList<VideoEntry> workspace =
[
new()
@@ -551,6 +556,27 @@ public sealed class SampleData
WorkspaceProjectId = Guid.CreateVersion7(),
ProjectName = "Social cut",
},
new()
{
Id = lakeVertical,
SequenceId = _lakeComo,
Title = "Lake Como storm",
PresetName = "Vertical 1080p",
Codec = "h264",
Width = 1080,
Height = 1920,
Fps = 30,
DurationSeconds = 48.3,
Bytes = 248_000_000L,
Created = lakeCreated,
Kind = RenderKind.Video,
FileName = Path.GetFileName(vertical),
LocalPath = vertical,
IsWorkspaceSent = true,
WorkspaceProjectId = Guid.CreateVersion7(),
WorkspaceServerHome = true,
ProjectName = "Vertical social",
},
];
videos.ServerVideos = () => new VideoServer(VideoServerState.Available, () => new SampleRemoteVideos(server), CanEdit: true, CanDelete: true);
@@ -22,6 +22,9 @@ public enum LibraryLayout
/// <summary>Year bands with photos per month above the card grid.</summary>
Timeline,
/// <summary>The Videos section's two lanes, Published and Workspace (the Library has no board).</summary>
Board,
}
/// <summary>Rendering quality profile (Settings › Rendering).</summary>
@@ -164,7 +167,10 @@ public sealed class AppSettings
public LibraryLayout LibraryLayout { get; set; } = LibraryLayout.Grid;
public SequenceSort LibrarySort { get; set; } = SequenceSort.Newest;
/// <summary>The Videos section as cards (<see cref="LibraryLayout.Grid"/>) or as a list (<see cref="LibraryLayout.List"/>).</summary>
/// <summary>
/// The Videos section as cards (<see cref="LibraryLayout.Grid"/>), as a list (<see cref="LibraryLayout.List"/>) or as the
/// Board (<see cref="LibraryLayout.Board"/>).
/// </summary>
public LibraryLayout VideosLayout { get; set; } = LibraryLayout.Grid;
// ---- Rendering ----
+8 -2
View File
@@ -5,10 +5,16 @@ namespace Chronos.App.Infrastructure;
/// <summary>Culture-aware number, size and duration formatting for the UI.</summary>
public static class Formatting
{
/// <summary>U+00A0, which joins a number to its unit.</summary>
public const char NoBreakSpace = '\u00A0';
/// <summary>Localized "{0} KB" formats from bytes to petabytes (BRIEF §16: sizes follow the language, "96,2 Go").</summary>
private static readonly string[] ByteUnits = ["Common.Size.B", "Common.Size.KB", "Common.Size.MB", "Common.Size.GB", "Common.Size.TB", "Common.Size.PB"];
/// <summary>1,536 → "1.5 KB" (decimal units, as Explorer shows for drives).</summary>
/// <summary>
/// 1,536 → "1.5 KB" (decimal units, as Explorer shows for drives), the number and its unit held together by a no-break
/// space (U+00A0) so a wrapped or trimmed line never parts them (issue #28).
/// </summary>
public static string Bytes(long bytes)
{
double value = bytes;
@@ -19,7 +25,7 @@ public static class Formatting
unit++;
}
var format = unit == 0 || value >= 100 ? "0" : "0.#";
return Loc.L(ByteUnits[unit], value.ToString(format, Loc.Culture));
return Loc.L(ByteUnits[unit], value.ToString(format, Loc.Culture)).Replace(' ', NoBreakSpace);
}
public static string Count(long n) => n.ToString("N0", Loc.Culture);
+127 -2
View File
@@ -101,6 +101,70 @@
<Setter Property="ContextMenu" Value="{StaticResource Menu.Video}" />
<EventSetter Event="MouseDoubleClick" Handler="OnItemDoubleClick" />
</Style>
<Style x:Key="ListBoxItem.VideoBoard" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.Row}">
<Setter Property="Padding" Value="14,10" />
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
<Setter Property="Tag" Value="{Binding DataContext, RelativeSource={RelativeSource AncestorType=ListBox}}" />
<Setter Property="ContextMenu" Value="{StaticResource Menu.Video}" />
<EventSetter Event="MouseDoubleClick" Handler="OnItemDoubleClick" />
</Style>
<!-- A Board card: title, project and version, preset · codec · duration · size, kind · date, state chips, and its actions. -->
<DataTemplate x:Key="Template.BoardCard" DataType="{x:Type vid:VideoRowViewModel}">
<Grid ToolTip="{Binding ToolTip}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="{Binding Title}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
<TextBlock Style="{StaticResource Text.Secondary}" Text="{Binding ProjectText}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0"
Visibility="{Binding HasProject, Converter={StaticResource BoolToVisibility}}" />
<TextBlock Style="{StaticResource Text.Secondary}" Text="{Binding CardText}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0" />
<TextBlock Style="{StaticResource Text.Faint}" Text="{Binding BoardFactsText}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0" />
<ItemsControl Margin="0,6,0,0" ItemsSource="{Binding States}" ItemTemplate="{StaticResource Template.Status}" ItemsPanel="{StaticResource Panel.Row}"
Focusable="False" ClipToBounds="True" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" Margin="8,0,0,0">
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Play}"
Command="{Binding DataContext.PlayCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"
ToolTip="{Binding PlayToolTip}" AutomationProperties.Name="{l:Loc Videos.Play}" />
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.FolderOpen}"
Command="{Binding DataContext.ShowInFolderCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"
ToolTip="{Binding MenuShowInFolderToolTip}" AutomationProperties.Name="{l:Loc Videos.ShowInFolder}" />
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Sequence}"
Command="{Binding DataContext.OpenInEditCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"
ToolTip="{Binding MenuOpenInEditToolTip}" AutomationProperties.Name="{l:Loc Videos.OpenInEdit}" />
<Button Style="{StaticResource Button.Quick}" ui:ButtonIcon.Glyph="{StaticResource Icon.Upload}"
Command="{Binding DataContext.SendCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" CommandParameter="{Binding}"
ToolTip="{Binding SendToolTip}" AutomationProperties.Name="{l:Loc Editor.Render.SendAgain}"
Visibility="{Binding CanSend, Converter={StaticResource BoolToVisibility}}" />
</StackPanel>
</Grid>
</DataTemplate>
<Style x:Key="ListBox.Lane" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="ItemContainerStyle" Value="{StaticResource ListBoxItem.VideoBoard}" />
<Setter Property="ItemTemplate" Value="{StaticResource Template.BoardCard}" />
<Setter Property="SelectionMode" Value="Extended" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
<Setter Property="VirtualizingPanel.VirtualizationMode" Value="Recycling" />
<Setter Property="VirtualizingPanel.ScrollUnit" Value="Pixel" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue" />
</Style>
<Style x:Key="Border.LaneCount" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource Brush.Card}" />
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Stroke}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="9" />
<Setter Property="Padding" Value="7,0" />
<Setter Property="MinWidth" Value="22" />
<Setter Property="Height" Value="18" />
<Setter Property="Margin" Value="8,0,0,0" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</UserControl.Resources>
<Grid>
@@ -115,7 +179,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Toolbar: search, kind, codec, year, source, order · cards or list (decision 20). -->
<!-- Toolbar: search, kind, codec, year, source, order · cards, list or Board (decision 20). -->
<Grid Grid.ColumnSpan="2" Margin="20,0" MinHeight="56">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="160" MaxWidth="260" />
@@ -141,6 +205,7 @@
AutomationProperties.Name="{l:Loc Videos.View.Grid}">
<v:SegmentedItem Glyph="{StaticResource Icon.ViewGrid}" ToolTip="{l:Loc Tooltips.Videos.View}" AutomationProperties.Name="{l:Loc Videos.View.Grid}" />
<v:SegmentedItem Glyph="{StaticResource Icon.ViewList}" ToolTip="{l:Loc Tooltips.Videos.View}" AutomationProperties.Name="{l:Loc Videos.View.List}" />
<v:SegmentedItem Glyph="{StaticResource Icon.ViewBoard}" ToolTip="{l:Loc Tooltips.Videos.View.Board}" AutomationProperties.Name="{l:Loc Videos.View.Board}" />
</v:SegmentedControl>
<Button Grid.Column="3" Style="{StaticResource Button.Quick}" VerticalAlignment="Top" Margin="8,14,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Refresh}"
Command="{Binding RefreshCommand}" ToolTip="{l:Loc Tooltips.Videos.Refresh}" AutomationProperties.Name="{l:Loc Videos.Refresh}" />
@@ -166,7 +231,7 @@
</ListBox.InputBindings>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type vid:VideoRowViewModel}">
<v:SequenceCard Title="{Binding Title}" Subtitle="{Binding DetailsText}" Badge="{Binding DurationText}" Statuses="{Binding States}" Thumbnail="{Binding Poster}"
<v:SequenceCard Title="{Binding Title}" Subtitle="{Binding CardText}" Badge="{Binding DurationText}" Statuses="{Binding States}" Thumbnail="{Binding Poster}"
IsSelected="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}, Mode=TwoWay}"
SelectToolTip="{l:Loc Tooltips.Videos.Select}" ToolTip="{Binding ToolTip}" Loaded="OnCardLoaded">
<v:SequenceCard.ActionsContent>
@@ -248,6 +313,66 @@
</Grid>
</Border>
<!--
Board (owner request of 2026-11-06): Published, the renders filed at this PC's archive or the server, and Workspace, the
workspace's renders not sent yet and those sent still in its exports; newest first, a count per lane, the list's filters.
-->
<Grid Grid.Row="2" Margin="20,4,20,12" Visibility="{Binding IsBoard, Converter={StaticResource BoolToVisibility}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="16" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Style="{StaticResource Border.Panel}">
<DockPanel>
<Border DockPanel.Dock="Top" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,10" Background="Transparent"
ToolTip="{l:Loc Tooltips.Videos.Lane.Published}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{l:Loc Videos.Lane.Published}" FontWeight="SemiBold" VerticalAlignment="Center" />
<Border Style="{StaticResource Border.LaneCount}">
<TextBlock Style="{StaticResource Text.Faint}" Text="{Binding PublishedCountText}" HorizontalAlignment="Center" VerticalAlignment="Center"
Typography.NumeralAlignment="Tabular" />
</Border>
</StackPanel>
</Border>
<Grid>
<ListBox x:Name="PublishedLane" Style="{StaticResource ListBox.Lane}" ItemsSource="{Binding PublishedRows}" AutomationProperties.Name="{l:Loc Videos.Lane.Published}">
<ListBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding PlayCommand}" />
<KeyBinding Key="Delete" Command="{Binding DeleteCommand}" />
</ListBox.InputBindings>
</ListBox>
<TextBlock Style="{StaticResource Text.Hint}" Text="{l:Loc Videos.Empty}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,24,0,0"
Visibility="{Binding IsPublishedEmpty, Converter={StaticResource BoolToVisibility}}" />
</Grid>
</DockPanel>
</Border>
<Border Grid.Column="2" Style="{StaticResource Border.Panel}">
<DockPanel>
<Border DockPanel.Dock="Top" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,10" Background="Transparent"
ToolTip="{l:Loc Tooltips.Videos.Lane.Workspace}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{l:Loc Videos.Lane.Workspace}" FontWeight="SemiBold" VerticalAlignment="Center" />
<Border Style="{StaticResource Border.LaneCount}">
<TextBlock Style="{StaticResource Text.Faint}" Text="{Binding WorkspaceCountText}" HorizontalAlignment="Center" VerticalAlignment="Center"
Typography.NumeralAlignment="Tabular" />
</Border>
</StackPanel>
</Border>
<Grid>
<ListBox x:Name="WorkspaceLane" Style="{StaticResource ListBox.Lane}" ItemsSource="{Binding WorkspaceRows}" AutomationProperties.Name="{l:Loc Videos.Lane.Workspace}">
<ListBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding PlayCommand}" />
<KeyBinding Key="Delete" Command="{Binding DeleteCommand}" />
</ListBox.InputBindings>
</ListBox>
<TextBlock Style="{StaticResource Text.Hint}" Text="{l:Loc Videos.Empty}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,24,0,0"
Visibility="{Binding IsWorkspaceEmpty, Converter={StaticResource BoolToVisibility}}" />
</Grid>
</DockPanel>
</Border>
</Grid>
<!-- Empty states: no video anywhere, or none the filters keep. -->
<ui:EmptyState Grid.Row="2" Message="{l:Loc Videos.Empty}" Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisibility}}" />
<ui:EmptyState Grid.Row="2" Message="{l:Loc Videos.Empty}" Visibility="{Binding IsNoMatch, Converter={StaticResource BoolToVisibility}}">
+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 ----
+6 -1
View File
@@ -230,7 +230,8 @@ public static class ScreenCapture
/// <summary>
/// The Videos section (owner review 1, R9) on <see cref="SampleData.FillVideosAsync"/> in both themes: the cards of this
/// PC's, the server's and the workspace's renders (<c>videos</c>), then the list with the still selected and shown in the
/// player pane (<c>videos-list</c>); the cards again after, with nothing selected.
/// player pane (<c>videos-list</c>), then the Board's two lanes (<c>videos-board</c>); the cards again after, with nothing
/// selected.
/// </summary>
private static async Task<int> CaptureVideosAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
{
@@ -258,6 +259,10 @@ public static class ScreenCapture
written += await SaveAsync(window, directory, "videos-list", theme);
videos.ClosePlayerCommand.Execute(null);
videos.ClearSelectionCommand.Execute(null);
// The Board (owner request of 2026-11-06): Published beside Workspace, the workspace's sent render among its own.
videos.LayoutIndex = 2;
written += await SaveAsync(window, directory, "videos-board", theme);
videos.LayoutIndex = 0;
}
return written;
+50 -1
View File
@@ -2,6 +2,7 @@ using System.Globalization;
using System.Windows.Media;
using Chronos.App.Archiving;
using Chronos.App.Infrastructure;
using Chronos.App.Workspace;
using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Data.Videos;
@@ -49,6 +50,24 @@ public static class VideoText
return string.Join(Loc.Separator, new[] { Format(entry), Duration(entry), Formatting.Bytes(entry.Bytes) }.Where(p => p.Length > 0));
}
/// <summary>
/// "4K archive · HEVC · 0:41 · 1.4 GB": a card's line (issue #28), the preset first, then the codec, the duration (a still
/// has none) and the size.
/// </summary>
public static string Card(VideoEntry entry)
{
ArgumentNullException.ThrowIfNull(entry);
return string.Join(Loc.Separator, new[] { entry.PresetName, VideoSources.CodecText(entry.Codec), Duration(entry), Formatting.Bytes(entry.Bytes) }.Where(p => p.Length > 0));
}
/// <summary>"Social cut · Version 3": the project rendered and its version, when known; empty for a render of the sequence's settings.</summary>
public static string Project(VideoEntry entry)
{
ArgumentNullException.ThrowIfNull(entry);
if (entry.ProjectName is not { Length: > 0 } project) return string.Empty;
return entry.ProjectVersionNumber is { } number ? project + Loc.Separator + Loc.L("Videos.Version", Formatting.Count(number)) : project;
}
/// <summary>The state chips of a render: where its file is, whether it was copied, and a missing file.</summary>
public static IReadOnlyList<CardStatus> States(VideoEntry entry)
{
@@ -56,6 +75,7 @@ public static class VideoText
var states = new List<CardStatus>();
if (entry.Missing) states.Add(new CardStatus(StatusKind.Warning, Loc.L("Videos.State.Missing"), Loc.L("Tooltips.Videos.Missing")));
if (entry.IsUnsent) states.Add(new CardStatus(StatusKind.Queued, Loc.L("Videos.State.NotSent"), Loc.L("Tooltips.Videos.NotSent")));
else if (entry.IsWorkspaceSent) states.Add(new CardStatus(StatusKind.Synced, Loc.L("Videos.State.Sent"), WorkspaceText.ForHome("Tooltips.Videos.Sent", entry.WorkspaceServerHome)));
else if (entry.IsLocal && entry.IsOnServer) states.Add(new CardStatus(StatusKind.Synced, Loc.L("Videos.State.HereAndServer"), Loc.L("Tooltips.Videos.HereAndServer")));
else if (entry.IsLocal) states.Add(new CardStatus(StatusKind.Done, Loc.L("Videos.State.Here"), Loc.L("Tooltips.Videos.Here")));
else if (entry.IsOnServer) states.Add(new CardStatus(StatusKind.Remote, Loc.L("Videos.State.OnServer"), Loc.L("Tooltips.Videos.OnServer")));
@@ -120,6 +140,24 @@ public sealed class VideoRowViewModel(VideoEntry entry) : ObservableObject
public string Subtitle => Entry.ProjectName is { Length: > 0 } project ? Entry.PresetName + Loc.Separator + project : Entry.PresetName;
public string DetailsText => VideoText.Details(Entry);
/// <summary>The card's line: preset, codec, duration and size (<see cref="VideoText.Card"/>).</summary>
public string CardText => VideoText.Card(Entry);
/// <summary>The project and its version on a Board card; empty when none was rendered.</summary>
public string ProjectText => VideoText.Project(Entry);
public bool HasProject => ProjectText.Length > 0;
/// <summary>A Board card's facts: the kind and when it was made.</summary>
public string BoardFactsText => KindLabel(Entry.Kind) + Loc.Separator + DateText;
/// <summary>Send, on a workspace render not sent yet.</summary>
public bool CanSend => Entry.IsUnsent;
/// <summary>What Send does for the render, worded for its project's home.</summary>
public string SendToolTip => WorkspaceText.ForHome("Tooltips.Editor.Render.SendAgain", Entry.WorkspaceServerHome);
public string FormatText => VideoText.Format(Entry);
public string DurationText => VideoText.Duration(Entry);
public string SizeText => Formatting.Bytes(Entry.Bytes);
@@ -128,7 +166,18 @@ public sealed class VideoRowViewModel(VideoEntry entry) : ObservableObject
public IReadOnlyList<CardStatus> States { get; } = VideoText.States(entry);
/// <summary>The card's and the row's tooltip: what it is, then how to select it.</summary>
public string ToolTip => Entry.IsUnsent ? Loc.L("Tooltips.Videos.WorkspaceRow") : Loc.L("Tooltips.Videos.Select");
public string ToolTip => Entry.IsUnsent ? Loc.L("Tooltips.Videos.WorkspaceRow")
: Entry.IsWorkspaceSent ? WorkspaceText.ForHome("Tooltips.Videos.SentRow", Entry.WorkspaceServerHome)
: Loc.L("Tooltips.Videos.Select");
/// <summary>"Video", "Still", "Image sequence": one render's kind; a newer kind as it is.</summary>
private static string KindLabel(string kind) => kind switch
{
RenderKind.Video => Loc.L("Videos.Kind.One.Video"),
RenderKind.Still => Loc.L("Videos.Kind.One.Still"),
RenderKind.Sequence => Loc.L("Videos.Kind.One.Sequence"),
_ => kind,
};
/// <summary>
/// Play's tooltip: what it does, or why it waits (a server's video plays here once it is copied to this PC, a file
+61 -8
View File
@@ -81,6 +81,12 @@ public sealed record VideoEntry
/// <summary>A workspace render not at its home yet: read-only here (Play, Show in folder, Send).</summary>
public bool IsUnsent { get; init; }
/// <summary>
/// A workspace render its home took already, whose file is still in the project's <c>exports/</c>: the Board's Workspace
/// lane shows it as sent (its home's entry stands for it everywhere else). Read-only here (Play, Show in folder).
/// </summary>
public bool IsWorkspaceSent { get; init; }
/// <summary>The file is not where it was recorded (here, or on the server for a render the server alone holds).</summary>
public bool Missing { get; init; }
@@ -93,6 +99,9 @@ public sealed record VideoEntry
/// <summary>The project rendered; null for a render of the sequence's settings.</summary>
public string? ProjectName { get; init; }
/// <summary>The number of the project version rendered; null when not known.</summary>
public int? ProjectVersionNumber { get; init; }
/// <summary>The paths of its verified copies in videos folders (of this PC and of the server).</summary>
public IReadOnlyList<string> Copies { get; init; } = [];
@@ -140,7 +149,7 @@ public sealed record VideoFilter
if (Year is { } year && entry.Year != year) return false;
if (Source switch
{
VideoSourceFilter.Local => !entry.IsLocal && !entry.IsUnsent,
VideoSourceFilter.Local => !entry.IsLocal && !entry.IsUnsent && !entry.IsWorkspaceSent,
VideoSourceFilter.Server => !entry.IsOnServer,
VideoSourceFilter.NotSent => !entry.IsUnsent,
_ => false,
@@ -260,6 +269,7 @@ public static class VideoSources
IsLocal = true,
Missing = item.Missing,
ProjectName = item.ProjectName,
ProjectVersionNumber = item.ProjectVersionNumber,
Copies = [.. item.Copies.Select(c => c.Path)],
};
}
@@ -286,11 +296,12 @@ public static class VideoSources
IsOnServer = true,
Missing = video.State == VideoStates.Missing,
ProjectName = video.ProjectName,
ProjectVersionNumber = video.ProjectVersionNumber,
Copies = [.. video.Copies.Select(c => c.Path)],
};
}
/// <summary>A workspace render not sent yet (<paramref name="path"/> its file on this PC).</summary>
/// <summary>A workspace render, sent or not yet (<paramref name="path"/> its file on this PC).</summary>
public static VideoEntry FromWorkspace(WorkspaceRenderEntry render, WorkspaceEntry project, string path, bool exists)
{
ArgumentNullException.ThrowIfNull(render);
@@ -311,7 +322,8 @@ public static class VideoSources
Kind = RenderKind.Of(null, render.Codec, render.Fps, render.DurationSeconds),
FileName = Path.GetFileName(path.TrimEnd('/', '\\')),
LocalPath = path,
IsUnsent = true,
IsUnsent = render.IsUnsent,
IsWorkspaceSent = render.IsSent,
Missing = !exists,
WorkspaceProjectId = project.ProjectId,
WorkspaceServerHome = project.IsServerHome,
@@ -345,8 +357,9 @@ public static class VideoSources
order.Add(entry.Id);
}
}
// A workspace render the archive or the server holds was sent: the library's entry stands for it.
foreach (var entry in workspace)
// A workspace render the archive or the server holds was sent: the library's entry stands for it. One the ledger marks
// sent belongs to the Board's Workspace lane alone (VideoBoard).
foreach (var entry in workspace.Where(e => !e.IsWorkspaceSent))
{
if (merged.TryAdd(entry.Id, entry)) order.Add(entry.Id);
}
@@ -409,8 +422,9 @@ public static class VideoSources
}
/// <summary>
/// The workspace renders not at their home yet, of every project whose ledger reads (one that does not is logged and
/// skipped: it never hides the others).
/// The workspace renders of every project whose ledger reads (one that does not is logged and skipped: it never hides the
/// others): those not at their home yet (<see cref="VideoEntry.IsUnsent"/>) and those sent whose file is still in
/// <c>exports/</c> (<see cref="VideoEntry.IsWorkspaceSent"/>).
/// </summary>
public static IReadOnlyList<VideoEntry> ReadWorkspace(WorkspaceStore store, IEnumerable<WorkspaceEntry> projects)
{
@@ -422,7 +436,7 @@ public static class VideoSources
try
{
var folder = store.Project(project.ProjectId);
foreach (var render in folder.ReadRenders().Unsent)
foreach (var render in folder.ReadRenders().Entries)
{
var path = folder.ExportFile(render.File);
entries.Add(FromWorkspace(render, project, path, File.Exists(path) || Directory.Exists(path)));
@@ -449,6 +463,45 @@ public static class VideoSources
public static bool ShowsAsImage(string? path) => path is not null && ImageExtensions.Contains(Path.GetExtension(path), StringComparer.OrdinalIgnoreCase);
}
/// <summary>The two lanes of the Videos section's Board (owner request of 2026-11-06).</summary>
public enum VideoLane
{
/// <summary>Renders filed at a home: this PC's archive or the signed-in server (a workspace's sent ones among them).</summary>
Published,
/// <summary>Renders in a workspace project's <c>exports/</c>: not sent yet, or sent and still there.</summary>
Workspace,
}
/// <summary>
/// The Board of the Videos section: every render in the lane of where it is, published at a home or in a workspace, newest
/// first. A workspace render its home took shows in both lanes: as the home's entry under Published, as sent under Workspace.
/// WPF-free.
/// </summary>
public static class VideoBoard
{
/// <summary>The lane of <paramref name="entry"/>.</summary>
public static VideoLane LaneOf(VideoEntry entry)
{
ArgumentNullException.ThrowIfNull(entry);
return entry.IsUnsent || entry.IsWorkspaceSent ? VideoLane.Workspace : VideoLane.Published;
}
/// <summary>
/// The lanes of <paramref name="entries"/> (the merged list) and <paramref name="sent"/> (the workspace's sent renders),
/// each with what <paramref name="filter"/> keeps, newest first whatever the list's order.
/// </summary>
public static (IReadOnlyList<VideoEntry> Published, IReadOnlyList<VideoEntry> Workspace) Split(IEnumerable<VideoEntry> entries, IEnumerable<VideoEntry> sent,
VideoFilter filter)
{
ArgumentNullException.ThrowIfNull(entries);
ArgumentNullException.ThrowIfNull(sent);
ArgumentNullException.ThrowIfNull(filter);
var kept = (filter with { Sort = null }).Apply(entries.Concat(sent));
return ([.. kept.Where(e => LaneOf(e) == VideoLane.Published)], [.. kept.Where(e => LaneOf(e) == VideoLane.Workspace)]);
}
}
/// <summary>The videos folder of this PC (decision 15): where Copy to folder puts renders.</summary>
public static class VideosFolders
{
+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";
}
+1
View File
@@ -108,6 +108,7 @@
<ui:IconData x:Key="Icon.Vectors" Stroke="M2.5 12.5 L7 8 M7 8 H4.5 M7 8 V10.5 M9 7 L13.5 2.5 M13.5 2.5 H11 M13.5 2.5 V5" />
<ui:IconData x:Key="Icon.Verify" Stroke="M8 1.5 L13.5 3.5 V7.5 C13.5 11 11 13.3 8 14.5 C5 13.3 2.5 11 2.5 7.5 V3.5 Z M5.5 8 L7.3 9.8 L10.6 6.3" />
<ui:IconData x:Key="Icon.Videos" Stroke="M3.0 4 H11.0 A1.5 1.5 0 0 1 12.5 5.5 V12.5 A1.5 1.5 0 0 1 11.0 14 H3.0 A1.5 1.5 0 0 1 1.5 12.5 V5.5 A1.5 1.5 0 0 1 3.0 4 Z M4.5 1.5 H13 A1.5 1.5 0 0 1 14.5 3 V11.5" Fill="M5.5 6.5 L9.5 9 L5.5 11.5 Z" />
<ui:IconData x:Key="Icon.ViewBoard" Stroke="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" />
<ui:IconData x:Key="Icon.ViewGrid" Stroke="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" />
<ui:IconData x:Key="Icon.ViewList" Stroke="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" IsDirectional="True" />
<ui:IconData x:Key="Icon.ViewTimeline" Stroke="M2 13.5 H14 M3.5 11 V8 M6 11 V5 M8.5 11 V7 M11 11 V3.5 M13.5 11 V9" />
@@ -45,8 +45,8 @@ public sealed class ArchiveLanguageTests
var tree = ArchiveTree.Build(Main, ArchiveAvailability.Online, [harbour]);
var year = new ArchiveTreeRowViewModel(tree.Root.Children[0], ArchiveAvailability.Online, _ => { });
var sequence = new ArchiveTreeRowViewModel(tree.Root.Children[0].Children[0], ArchiveAvailability.Online, _ => { });
Assert.Equal("Construction cam · weekly · 3,600 photos · 72 GB", sequence.RowToolTip);
Assert.Equal("2026 · 1 sequence · 72 GB · Right arrow opens the year, Left arrow closes it", year.RowToolTip);
Assert.Equal("Construction cam · weekly · 3,600 photos · 72\u00A0GB", sequence.RowToolTip);
Assert.Equal("2026 · 1 sequence · 72\u00A0GB · Right arrow opens the year, Left arrow closes it", year.RowToolTip);
try
{
Loc.SetCulture(CultureInfo.GetCultureInfo("he"));
@@ -45,8 +45,8 @@ public sealed class ArchiveLogicTests
Assert.Equal("ChronosArchive", tree.Root.Title);
Assert.SequenceEqual(new[] { "2026", "2025", "Undated" }, tree.Root.Children.Select(n => n.Title));
Assert.SequenceEqual(new[] { "Harbour", "Comet" }, tree.Root.Children[0].Children.Select(n => n.Title));
Assert.Equal("3,600 photos · 72 GB", tree.Root.Children[0].Children[0].Detail);
Assert.Equal("2 sequences · 72 GB", tree.Root.Children[0].Detail);
Assert.Equal("3,600 photos · 72\u00A0GB", tree.Root.Children[0].Children[0].Detail);
Assert.Equal("2 sequences · 72\u00A0GB", tree.Root.Children[0].Detail);
// Collapsed years show only themselves; expanding one reveals its sequences.
Assert.Equal(4, tree.Visible().Count);
@@ -137,7 +137,7 @@ public sealed class ArchiveLogicTests
var stats = Stats();
var years = ArchiveFigures.StorageByYear(stats);
Assert.SequenceEqual(new[] { "2024", "2026" }, years.Select(b => b.Label));
Assert.Equal("2.1 TB", years[1].ValueText);
Assert.Equal("2.1\u00A0TB", years[1].ValueText);
var cameras = ArchiveFigures.ByCamera(stats);
Assert.Equal(ArchiveFigures.TopCameras + 1, cameras.Count);
@@ -176,7 +176,7 @@ public sealed class ArchiveLogicTests
var tiles = ArchiveFigures.Tiles(Stats());
Assert.Equal(5, tiles.Count);
Assert.Equal("10,000", tiles[0].Value);
Assert.Equal("9.4 TB", tiles[2].Value);
Assert.Equal("9.4\u00A0TB", tiles[2].Value);
Assert.Equal("6", tiles[3].Value);
Assert.Equal("cameras · 8 formats", tiles[3].Caption);
Assert.Equal(Formatting.LeftToRight("2024 – 2026"), tiles[4].Value, "a year range keeps its order in right-to-left text");
@@ -42,10 +42,10 @@ public sealed class CardPoolTests
Assert.Equal("New card", pool[0].StateText);
Assert.Equal("EOS R5 · card A", pool[1].Title);
Assert.Equal("Known card", pool[1].StateText);
Assert.Equal("128 GB · 96.2 GB used", pool[1].Subtitle);
Assert.Equal("128 GB · serial 3F2A-9C11 · Canon EOS R5 #0431", pool[1].IdentityText);
Assert.Equal("128\u00A0GB · 96.2\u00A0GB used", pool[1].Subtitle);
Assert.Equal("128\u00A0GB · serial 3F2A-9C11 · Canon EOS R5 #0431", pool[1].IdentityText);
Assert.Equal(SourceKind.Drive, pool[2].Kind);
Assert.Equal("no DCIM · 1.8 TB free", pool[2].Subtitle);
Assert.Equal("no DCIM · 1.8\u00A0TB free", pool[2].Subtitle);
Assert.False(pool[3].IsInserted);
Assert.Null(pool[3].Root);
Assert.Equal("Canon EOS R5 · not inserted", pool[3].Subtitle);
@@ -72,8 +72,8 @@ public sealed class CardPoolTests
public void TheEntryTooltipCarriesTheStateAndTheWholeSubtitle()
{
var pool = CardPool.Build([CardA, Usb], [Known(CardA, "EOS R5 · card A", DateTimeOffset.UtcNow)], @"D:\Shoots\2026");
Assert.Equal("Known card · 128 GB · 96.2 GB used", pool[0].ToolTip);
Assert.Equal("no DCIM · 1.8 TB free", pool[1].ToolTip);
Assert.Equal("Known card · 128\u00A0GB · 96.2\u00A0GB used", pool[0].ToolTip);
Assert.Equal("no DCIM · 1.8\u00A0TB free", pool[1].ToolTip);
Assert.Equal(@"Folder · D:\Shoots\2026", pool[2].ToolTip);
}
@@ -40,11 +40,11 @@ public sealed class ImportPlansTests
Assert.Equal(80_000_000L, totals.FreeAfter);
Assert.True(totals.HasEnoughSpace);
Assert.Equal(TimeSpan.FromSeconds(3), totals.Estimate);
Assert.Equal("3 sessions · 7 photos · 120 MB · about 3 s", totals.Text);
Assert.Equal("3 sessions · 7 photos · 120 MB", totals.SummaryText);
Assert.Equal("3 sessions · 7 photos · 120\u00A0MB · about 3 s", totals.Text);
Assert.Equal("3 sessions · 7 photos · 120\u00A0MB", totals.SummaryText);
Assert.Equal("1 duplicate", totals.DuplicatesText);
Assert.Equal("Import 5 photos", totals.ImportText);
Assert.Equal("80 MB free after import", totals.SpaceText);
Assert.Equal("80\u00A0MB free after import", totals.SpaceText);
}
[Test]
@@ -52,7 +52,7 @@ public sealed class ImportPlansTests
{
var totals = ImportPlans.Totals(ThreeSessions(available: 100_000_000), verify: false);
Assert.False(totals.HasEnoughSpace);
Assert.Equal("20 MB missing", totals.SpaceText);
Assert.Equal("20\u00A0MB missing", totals.SpaceText);
Assert.Equal(string.Empty, ImportPlans.Totals(ThreeSessions(available: null), verify: false).SpaceText);
Assert.Equal(TimeSpan.FromSeconds(2), ImportPlans.Totals(ThreeSessions(), verify: false).Estimate);
}
@@ -105,7 +105,7 @@ public sealed class ImportPlansTests
Assert.Equal("Adds to · 2026/2026-09-29 Canon EOS R5", rows[1].TargetText);
Assert.Equal("2026-09-28 Canon EOS R5", rows[0].DefaultTitle);
Assert.Equal("Canon EOS R5", rows[0].CameraText);
Assert.Equal("96 MB", rows[0].SizeText);
Assert.Equal("96\u00A0MB", rows[0].SizeText);
Assert.Contains("6:02", rows[0].TimeText);
Assert.Equal("Server", ImportPlans.Sessions(plan, ImportDestinationKind.Server, new HashSet<string>())[0].TargetText);
}
@@ -140,7 +140,7 @@ public sealed class ImportPlansTests
Assert.True(details.Rows.Single(r => r.Source.EndsWith("0007.CR2", StringComparison.Ordinal)).IsSkipped);
Assert.Equal(3, details.Conflicts.Count);
Assert.Contains("IMG_0099.CR2", details.Conflicts[0]);
Assert.Equal("7 files · copy 5 (120 MB) · 1 imported before · 1 duplicate", details.TotalsText);
Assert.Equal("7 files · copy 5 (120\u00A0MB) · 1 imported before · 1 duplicate", details.TotalsText);
var folder = ImportPlans.Details(plan, ImportDestinationKind.Folder, verify: true);
Assert.Equal("2026/2026-09-28 Canon EOS R5/" + plan.Sessions[0].Items[0].FileName, folder.Rows[1].Destination);
@@ -26,7 +26,7 @@ public sealed class SampleCardsTests(TestContext context)
var pool = CardPool.Build(devices.Devices, await db.MediaCards.ListAsync(context.Cancellation), null, contents);
Assert.SequenceEqual(new[] { SourceKind.Card, SourceKind.Card, SourceKind.Drive, SourceKind.Card }, pool.Select(s => s.Kind));
Assert.Equal("EOS R5 · card A", pool[0].Title);
Assert.Equal("128 GB · serial 3F2A-9C11 · Canon EOS R5 #0431", pool[0].IdentityText);
Assert.Equal("128\u00A0GB · serial 3F2A-9C11 · Canon EOS R5 #0431", pool[0].IdentityText);
Assert.Equal("Canon EOS R5 · 50 photos", pool[0].ToastText);
Assert.Contains("50 photos", pool[0].Subtitle);
Assert.Equal("SONY", pool[1].Title);
@@ -172,7 +172,7 @@ public sealed class JobListModelTests
Assert.Equal("Render · Harbour sunset · 2,232 / 3,600 · 11.3 fps · 2 min left", JobText.Bar(running));
Assert.Equal("2 min", JobText.Left(running, 0));
// Imports and verifies count bytes; scans count folders; frame jobs read in fps (owner review 1).
Assert.Equal("118 B/s", JobText.Speed(JobKind.Import, 118));
Assert.Equal("118\u00A0B/s", JobText.Speed(JobKind.Import, 118));
Assert.Equal(JobText.Speed(JobKind.Verify, 57_000_000), Loc.L("Jobs.Speed.Bytes", Formatting.Bytes(57_000_000)));
Assert.Equal("4/s", JobText.Speed(JobKind.Scan, 4));
Assert.Equal("1.7 fps", JobText.Speed(JobKind.Proxies, 1.7));
@@ -565,7 +565,7 @@ public sealed class SettingsLogicTests
pending.SetResult(new WorkspaceUsage(MediaBytes: 9_000_000_000, TotalBytes: 12_400_000_000, TrashBytes: 1_200_000_000, TrashItems: 3));
await measuring;
Assert.False(rows.IsMeasuring);
Assert.Equal(("12.4 GB used", "3 items, 1.2 GB"), (rows.UsageText, rows.TrashText));
Assert.Equal(("12.4\u00A0GB used", "3 items, 1.2\u00A0GB"), (rows.UsageText, rows.TrashText));
Assert.True(rows.HasUsageText);
Assert.True(rows.HasTrash);
Assert.True(rows.EmptyTrashCommand.CanExecute(null));
@@ -573,13 +573,13 @@ public sealed class SettingsLogicTests
workspace.Measure = _ => Task.FromResult(new WorkspaceUsage(0, 4_000, 0, 0));
await rows.MeasureAsync();
Assert.Equal(("4 KB used", "Nothing in trash"), (rows.UsageText, rows.TrashText));
Assert.Equal(("4\u00A0KB used", "Nothing in trash"), (rows.UsageText, rows.TrashText));
Assert.False(rows.HasTrash);
Assert.False(rows.EmptyTrashCommand.CanExecute(null));
Assert.Equal(Loc.L("Tooltips.Settings.Workspace.EmptyTrash.Disabled"), rows.EmptyTrashToolTip);
workspace.Measure = _ => Task.FromResult(new WorkspaceUsage(0, 1_000, 2_000, 1));
await rows.MeasureAsync();
Assert.Equal("1 item, 2 KB", rows.TrashText);
Assert.Equal("1 item, 2\u00A0KB", rows.TrashText);
}
[Test]
@@ -600,7 +600,7 @@ public sealed class SettingsLogicTests
Assert.True(firstToken.IsCancellationRequested, "the older measure is told to stop");
first.SetResult(new WorkspaceUsage(0, 9_000_000_000, 0, 5));
await older;
Assert.Equal(("2 MB used", false, false), (rows.UsageText, rows.HasTrash, rows.IsMeasuring));
Assert.Equal(("2\u00A0MB used", false, false), (rows.UsageText, rows.HasTrash, rows.IsMeasuring));
workspace.Measure = _ => Task.FromException<WorkspaceUsage>(new IOException("the drive went away"));
await rows.MeasureAsync();
@@ -631,9 +631,9 @@ public sealed class SettingsLogicTests
Assert.Equal((Loc.L("Settings.Workspace.TrashPlan.Action"), Loc.L("Tooltips.Settings.Workspace.TrashPlan.Action"), Loc.L("Tooltips.Settings.Workspace.TrashPlan.Keep")),
(request.ActionText, request.ActionToolTip, request.SafeToolTip));
var lines = request.Detail!.Split(Environment.NewLine);
Assert.Equal(("Entries: 8", "Size: 36 MB"), (lines[0], lines[1]));
Assert.Equal(("Entries: 8", "Size: 36\u00A0MB"), (lines[0], lines[1]));
// The newest entries are named, the rest counted.
Assert.Equal(Loc.L("Settings.Workspace.TrashPlan.Item", items[7].Name, "8 MB", Formatting.Date(items[7].Trashed)), lines[2]);
Assert.Equal(Loc.L("Settings.Workspace.TrashPlan.Item", items[7].Name, "8\u00A0MB", Formatting.Date(items[7].Trashed)), lines[2]);
Assert.Equal(2 + DeletePlansListed + 1, lines.Length);
Assert.Equal(Loc.Plural("Archive.Delete.More", 2), lines[^1]);
@@ -642,7 +642,7 @@ public sealed class SettingsLogicTests
workspace.Measure = _ => Task.FromResult(new WorkspaceUsage(0, 14_000_000, 0, 0));
await rows.EmptyTrashAsync();
Assert.Same(plan, Assert.Contains(workspace.Emptied, _ => true));
Assert.Equal((Loc.L("Settings.Workspace.TrashEmptied"), "36 MB", false), Assert.Contains(workspace.Notices, _ => true));
Assert.Equal((Loc.L("Settings.Workspace.TrashEmptied"), "36\u00A0MB", false), Assert.Contains(workspace.Notices, _ => true));
Assert.Equal("Nothing in trash", rows.TrashText);
// An empty trash asks nothing.
@@ -666,7 +666,7 @@ public sealed class SettingsLogicTests
var (_, rows, _) = WorkspaceRows(workspace);
await rows.EmptyTrashAsync();
Assert.Equal((Loc.L("Settings.Workspace.TrashNotEmptied"), Loc.L("Errors.Workspace.TrashChanged"), true), Assert.Contains(workspace.Notices, _ => true));
Assert.Equal("1 item, 1 KB", rows.TrashText);
Assert.Equal("1 item, 1\u00A0KB", rows.TrashText);
workspace.Notices.Clear();
workspace.Empty = _ => throw new UnauthorizedAccessException("denied");
@@ -8,11 +8,14 @@ using Chronos.App.Settings;
using Chronos.App.Shell;
using Chronos.App.Tests.Windows;
using Chronos.App.Videos;
using Chronos.App.Workspace;
using Chronos.Core.Localization;
using Chronos.Core.Model;
using Chronos.Core.Project;
using Chronos.Core.Windows.Shell;
using Chronos.Data.Archiving.Jobs;
using Chronos.Data.Videos;
using Chronos.Data.Workspaces;
using Chronos.Protocol;
using Chronos.Testing;
using Chronos.Ui.Controls;
@@ -200,6 +203,88 @@ public sealed class VideoSourcesTests
}
}
[Test]
public void TheBoardPutsEachRenderInTheLaneOfWhereItIs()
{
var local = Local(Guid.CreateVersion7(), Harbour, "Harbour sunset", 100);
var remote = Server(Guid.CreateVersion7(), Comet, "Comet", 300);
var unsent = Unsent(Guid.CreateVersion7(), Comet);
// Sent from the workspace to this PC's archive: the archive's entry under Published, its file still in exports/ under Workspace.
var sent = Unsent(local.Id, Harbour) with { IsUnsent = false, IsWorkspaceSent = true, Created = local.Created, Title = "Harbour sunset" };
Assert.Equal(VideoLane.Published, VideoBoard.LaneOf(local));
Assert.Equal(VideoLane.Published, VideoBoard.LaneOf(remote));
Assert.Equal(VideoLane.Workspace, VideoBoard.LaneOf(unsent));
Assert.Equal(VideoLane.Workspace, VideoBoard.LaneOf(sent));
// The list has one row per render: the sent one is the archive's.
var merged = VideoSources.Merge([local], [remote], [unsent, sent]);
Assert.SequenceEqual([local.Id, remote.Id, unsent.Id], merged.Select(e => e.Id));
Assert.False(merged.Any(e => e.IsWorkspaceSent));
// Newest first in each lane whatever the list's order; the list's filters narrow both lanes.
var (published, workspace) = VideoBoard.Split(merged, [sent], new VideoFilter { Sort = VideoSorts.Title });
Assert.SequenceEqual([local.Id, remote.Id], published.Select(e => e.Id));
Assert.SequenceEqual([unsent.Id, sent.Id], workspace.Select(e => e.Id));
Assert.True(workspace[1].IsWorkspaceSent);
var harbour = VideoBoard.Split(merged, [sent], new VideoFilter { SequenceId = Harbour });
Assert.SequenceEqual([local.Id], harbour.Published.Select(e => e.Id));
Assert.SequenceEqual([sent.Id], harbour.Workspace.Select(e => e.Id));
Assert.Empty(VideoBoard.Split(merged, [sent], new VideoFilter { Text = "instagram" }).Published);
// This PC holds a sent render's file; it is not the server's, nor waiting to be sent.
Assert.True(new VideoFilter { Source = VideoSourceFilter.Local }.Matches(sent));
Assert.False(new VideoFilter { Source = VideoSourceFilter.NotSent }.Matches(sent));
Assert.False(new VideoFilter { Source = VideoSourceFilter.Server }.Matches(sent));
// Its chip says it was sent, worded for its project's home.
Assert.Contains(VideoText.States(sent), s => s.Text == Loc.L("Videos.State.Sent") && s.ToolTip == Loc.L("Tooltips.Videos.Sent"));
Assert.Contains(VideoText.States(sent with { WorkspaceServerHome = true }), s => s.ToolTip == Loc.L("Tooltips.Videos.Sent.Server"));
Assert.Equal(Loc.L("Tooltips.Videos.SentRow"), new VideoRowViewModel(sent).ToolTip);
Assert.False(new VideoRowViewModel(sent).CanSend);
Assert.True(new VideoRowViewModel(unsent).CanSend);
}
[Test]
public void AWorkspaceLedgerEntryReadsAsSentOrNot()
{
var home = new BundleHome(BundleHome.ArchiveKind, Harbour);
var project = new WorkspaceEntry(Guid.CreateVersion7(), Harbour, "Social cut", false, home, "Harbour sunset", true, DateTimeOffset.UtcNow);
var render = new WorkspaceRenderEntry(Guid.CreateVersion7(), Guid.CreateVersion7(), "harbour.mp4", new string('a', 64), 1_000, "Instagram", "h264", 1080, 1920, 30, 12,
project.ProjectId, null, null, DateTimeOffset.UtcNow);
var pending = VideoSources.FromWorkspace(render, project, @"C:\ws\exports\harbour.mp4", exists: true);
Assert.True(pending is { IsUnsent: true, IsWorkspaceSent: false, Missing: false, ProjectName: "Social cut" });
var sent = VideoSources.FromWorkspace(render.AsSent(DateTimeOffset.UtcNow), project, @"C:\ws\exports\harbour.mp4", exists: true);
Assert.True(sent is { IsUnsent: false, IsWorkspaceSent: true, HasLocalFile: true });
Assert.Equal(VideoLane.Workspace, VideoBoard.LaneOf(sent));
// A failed send waits to be sent again.
Assert.True(VideoSources.FromWorkspace(render.AsFailed("no"), project, @"C:\ws\exports\harbour.mp4", exists: false) is { IsUnsent: true, Missing: true });
}
[Test]
public void ACardStartsWithItsPresetAndKeepsSizesWhole()
{
var video = Local(Guid.CreateVersion7(), Harbour, "Harbour sunset", 100) with { PresetName = "4K archive", Codec = "hevc", DurationSeconds = 41, Bytes = 1_400_000_000 };
// Issue #28: "4K archive · HEVC · 0:41 · 1.4 GB", the number and its unit held together by a no-break space.
var size = Formatting.Bytes(video.Bytes);
Assert.True(size.Contains('\u00A0', StringComparison.Ordinal) && !size.Contains(' ', StringComparison.Ordinal), size);
Assert.Equal(string.Join(Loc.Separator, "4K archive", "HEVC", VideoText.Duration(video), size), VideoText.Card(video));
Assert.Equal(VideoText.Card(video), new VideoRowViewModel(video).CardText);
var still = video with { Kind = RenderKind.Still, PresetName = "Frame 512", Codec = null, DurationSeconds = 0, Bytes = 3_400_000 };
Assert.Equal(string.Join(Loc.Separator, "Frame 512", Formatting.Bytes(still.Bytes)), VideoText.Card(still), "no codec, no duration");
Assert.False(Formatting.Bytes(999).Contains(' ', StringComparison.Ordinal));
// A Board card names the project and its version when known.
Assert.Equal(string.Empty, VideoText.Project(video));
Assert.Equal("Social cut", VideoText.Project(video with { ProjectName = "Social cut" }));
Assert.Equal("Social cut" + Loc.Separator + Loc.L("Videos.Version", "3"), VideoText.Project(video with { ProjectName = "Social cut", ProjectVersionNumber = 3 }));
var row = new VideoRowViewModel(video with { ProjectName = "Social cut", ProjectVersionNumber = 3 });
Assert.True(row.HasProject);
Assert.Equal(Loc.L("Videos.Kind.One.Video") + Loc.Separator + row.DateText, row.BoardFactsText);
Assert.Equal(3, VideoSources.FromServer(new VideoDto(Guid.CreateVersion7(), Comet, "4K", "h264", 1, 1, 1, 1, 1, DateTimeOffset.UtcNow, "nas", null, null, null,
RenderKind.Video, "Comet", null, "Social cut", 3, VideoStates.Ok, [])).ProjectVersionNumber);
}
[Test]
public void ACopyToTheVideosFolderEndsWithAToast()
{
@@ -505,6 +590,105 @@ public sealed class VideosSectionTests(TestContext context)
Assert.True(shell.Settings.OpenVideosFolderCommand.CanExecute(null));
});
[Test]
public Task TheBoardShowsPublishedAndWorkspaceLanes() => WithSectionAsync(async (shell, section, library, _) =>
{
var folder = context.CreateTempDirectory("videos-board");
var unsentFile = Path.Combine(folder, "comet-instagram.mp4");
var sentFile = Path.Combine(folder, "harbour-4k.mp4");
File.WriteAllBytes(unsentFile, [1]);
File.WriteAllBytes(sentFile, [1]);
var project = Guid.CreateVersion7();
var unsent = new VideoEntry
{
Id = Guid.CreateVersion7(),
SequenceId = library.Items[1].Render.SequenceId,
Title = "Comet",
PresetName = "Instagram",
Codec = "h264",
Bytes = 10,
Created = DateTimeOffset.UtcNow,
Kind = RenderKind.Video,
FileName = "comet-instagram.mp4",
LocalPath = unsentFile,
IsUnsent = true,
WorkspaceProjectId = project,
ProjectName = "Social cut",
};
// The archive's first render, sent from the workspace, its file still in exports/.
var archived = library.Items[0].Render;
var sent = unsent with
{
Id = archived.Id,
SequenceId = archived.SequenceId,
Title = "Harbour sunset",
PresetName = archived.PresetName,
Created = archived.Created,
FileName = "harbour-4k.mp4",
LocalPath = sentFile,
IsUnsent = false,
IsWorkspaceSent = true,
};
section.WorkspaceRenders = _ => Task.FromResult<IReadOnlyList<VideoEntry>>([unsent, sent]);
await section.RefreshAsync();
// The list and the cards: one row per render, the sent one being the archive's.
Assert.Equal(library.Items.Count + 1, section.Rows.Count);
Assert.Equal(sent.Id, Assert.NotNull(section.SentEntries.SingleOrDefault()).Id);
Assert.False(section.IsBoard);
// The Board: kept for the next run, Published beside Workspace, newest first, a count per lane.
section.LayoutIndex = 2;
Assert.True(section.IsBoard);
Assert.Equal(LibraryLayout.Board, shell.Services.Settings.VideosLayout);
Assert.Equal(2, new VideosViewModel(shell).LayoutIndex, "a new section opens on the Board");
Assert.SequenceEqual(library.Items.OrderByDescending(i => i.Render.Created).Select(i => i.Render.Id), section.PublishedRows.Select(r => r.Entry.Id));
Assert.SequenceEqual([unsent.Id, sent.Id], section.WorkspaceRows.Select(r => r.Entry.Id));
Assert.Equal((Formatting.Count(3), Formatting.Count(2)), (section.PublishedCountText, section.WorkspaceCountText));
Assert.Same(section.Rows.Single(r => r.Entry.Id == unsent.Id), section.WorkspaceRows[0]);
var sentRow = section.WorkspaceRows[1];
Assert.True(sentRow.Entry.IsWorkspaceSent);
Assert.False(ReferenceEquals(section.Rows.Single(r => r.Entry.Id == sent.Id), sentRow), "a row of its own beside the archive's");
// The sent row's actions: Play, Show in folder and Open in Edit (its home is this PC's archive); no copy, delete or send.
Assert.True(section.PlayCommand.CanExecute(sentRow));
Assert.True(section.ShowInFolderCommand.CanExecute(sentRow));
Assert.True(section.OpenInEditCommand.CanExecute(sentRow));
Assert.False(section.SendCommand.CanExecute(sentRow));
Assert.Equal(Loc.L("Tooltips.Videos.SentRow"), section.CopyBlocker([sentRow]));
Assert.Equal(Loc.L("Tooltips.Videos.SentRow"), section.DeleteBlocker([sentRow]));
Assert.True(section.SendCommand.CanExecute(section.WorkspaceRows[0]), "the unsent one sends");
// Selected on the Board, it is part of the selection; off the Board, it is let go.
sentRow.IsSelected = true;
Assert.True(section.HasSelection);
Assert.Contains(sentRow, section.SelectedRows);
Assert.Equal(Loc.L("Videos.Selected", Formatting.Count(1)), section.SelectionText);
section.LayoutIndex = 0;
Assert.False(sentRow.IsSelected);
Assert.False(section.HasSelection);
section.LayoutIndex = 2;
// The list's filters narrow both lanes; none kept is the section's empty state.
section.SearchText = "instagram";
Assert.SequenceEqual([unsent.Id], section.WorkspaceRows.Select(r => r.Entry.Id));
Assert.Empty(section.PublishedRows);
Assert.True(section.IsPublishedEmpty, "the lane says it is empty");
section.SearchText = "no such video";
Assert.True(section.IsNoMatch);
Assert.False(section.IsPublishedEmpty || section.IsWorkspaceEmpty, "one empty state, not three");
section.SearchText = string.Empty;
// Laid out: both lanes' headings and cards, with the card's line starting with the preset (issue #28).
var view = new VideosView { DataContext = section };
Layout(view, 1400);
var texts = Descendants(view).OfType<System.Windows.Controls.TextBlock>().Where(t => t.ActualWidth > 0).Select(t => t.Text).ToList();
Assert.Contains(Loc.L("Videos.Lane.Published"), texts);
Assert.Contains(Loc.L("Videos.Lane.Workspace"), texts);
Assert.Contains(sentRow.CardText, texts);
Assert.True(sentRow.CardText.StartsWith(sent.PresetName + Loc.Separator, StringComparison.Ordinal), sentRow.CardText);
});
private static void Layout(System.Windows.FrameworkElement view, double width = 1200)
{
view.Measure(new System.Windows.Size(width, 800));
@@ -48,12 +48,16 @@ public sealed partial class AdminVideosTests(TestContext context)
var page = await server.Client.GetStringAsync("/admin/pages/videos.js");
var calls = ApiCall().Matches(page).Select(m => (Method: m.Groups[1].Value, Target: m.Groups[2].Value)).ToList();
Assert.True(calls.Count >= 4, string.Join(", ", calls));
// Reads the list, the server's videos folder and a filtered sequence's title; writes only the videos' delete and copy:
// no settings, no project, no render, no job of its own.
// Reads the list, the server's videos folder, its name (the board's lanes) and a filtered sequence's title; writes only
// the videos' delete and copy: no settings, no project, no render, no job of its own.
foreach (var (method, target) in calls)
{
Assert.True(method is "get" or "post", $"api.{method}({target}");
if (method == "get") Assert.True(target is "listQuery(" or @"""/api/v1/server/settings""" or "`/api/v1/sequences/${encodeURIComponent(id)}`", target);
if (method == "get")
{
Assert.True(target is "listQuery(" or @"""/api/v1/server/settings""" or @"""/api/v1/server/info""" or "`/api/v1/sequences/${encodeURIComponent(id)}`",
target);
}
else Assert.True(target is @"""/api/v1/videos/copy""" or @"""/api/v1/videos/delete""", target);
}
Assert.Contains("return `/api/v1/videos?${p}`;", page);
@@ -103,6 +107,29 @@ public sealed partial class AdminVideosTests(TestContext context)
Assert.Equal("missing", VideoStates.Missing);
}
[Test]
public async Task TheBoardShowsPublishedAndWorkspaceLanes()
{
await using var server = await TestServer.StartAsync(context);
var page = await server.Client.GetStringAsync("/admin/pages/videos.js");
// A third view beside cards and list, kept like them; its icon is the panel's.
Assert.Contains(@"data-view=""board"" aria-pressed=""${view === ""board""}"" data-i18n-title=""Admin.Videos.View.Board.Tip""", page);
Assert.Contains(@"return stored === ""list"" || stored === ""board"" ? stored : ""cards"";", page);
Assert.Contains(" board: `<svg", await server.Client.GetStringAsync("/admin/icons.js"));
// Two lanes, newest first whatever the order chosen, each with its count; Workspace holds the renders a PC's workspace
// sent here (a project named, produced by a machine other than this server), marked Sent.
Assert.Contains("const newest = [...rows].sort((a, b) => (Date.parse(b.created) - Date.parse(a.created))", page);
Assert.Contains(@"return lane(""Published"", newest, false) + lane(""Workspace"", sent, true);", page);
Assert.Contains(@"<span class=""pill num"">${escapeHtml(formatNumber(items.length))}</span>", page);
Assert.Contains("export function boardLane(v, serverName)", page);
Assert.Contains(@"return v.projectId && producer && producer !== String(serverName ?? """") ? ""workspace"" : ""published"";", page);
Assert.Contains(@"${workspace ? sentChip(v) : """"}${stateChips(v)}", page);
// The server's name comes from its public info, the name its own renders carry.
Assert.Contains(@"api.get(""/api/v1/server/info"").then((info) => {", page);
var css = await server.Client.GetStringAsync("/admin/admin.css");
Assert.Contains(".seq-items.board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));", css);
}
[Test]
public async Task TheVideosStringsAreInEnglishAndItalian()
{
@@ -117,7 +144,8 @@ public sealed partial class AdminVideosTests(TestContext context)
// The keys the pages build from a value.
keys.AddRange(VideoSorts.All.Select(s => $"Admin.Videos.Sort.{char.ToUpperInvariant(s[0])}{s[1..]}"));
keys.AddRange(["Admin.Videos.Kind.Video", "Admin.Videos.Kind.Still", "Admin.Videos.Kind.Sequence", "Admin.Trash.Kind.Videos", "Admin.Nav.Videos", "Admin.Nav.Videos.Tip",
"Admin.Settings.VideosPath", "Admin.Settings.VideosPath.Tip", "Admin.Job.Kind.VideoCopy"]);
"Admin.Settings.VideosPath", "Admin.Settings.VideosPath.Tip", "Admin.Job.Kind.VideoCopy", "Admin.Videos.Lane.Published", "Admin.Videos.Lane.Published.Tip",
"Admin.Videos.Lane.Workspace", "Admin.Videos.Lane.Workspace.Tip"]);
keys.AddRange(Regex.Matches(trash + sequence, @"""(Admin\.(?:Trash\.[A-Za-z]*Video[A-Za-z]*|Videos\.[A-Za-z.]+)(?:\.[A-Za-z]+)*)""").Select(m => m.Groups[1].Value));
Assert.Contains("Admin.Trash.RestoredVideo", keys);
Assert.Contains("Admin.Videos.AllVideos.Tip", keys);