Files
Chronos/src/Titano.App/Archive/ArchiveScenes.cs
T
Claude 58ae096061 fix(app): archive tree selection, toolbar, filters and dialogs after review
- reloads and expanding never clear the tree selection; only jobs on this
  archive reload it, once they settle
- one-row toolbar with the view switch and last scan on their own row; figure
  tiles shrink instead of cutting at the minimum width
- set filter by camera, status and tag; duplicates and orphans searches can be
  cancelled; health fixes cover every matching sequence
- Right/Left/Enter open and close years; dialogs hold the keyboard and only
  close themselves; disabled commands say why
- adopt folder can copy into the layout (Import screen); database backup in
  Maintenance; Move dialog capture state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-03 10:44:22 +00:00

49 lines
2.0 KiB
C#

using Titano.App.Shell;
namespace Titano.App.Archiving;
/// <summary>
/// The Archive views that <c>--capture</c> renders (<c>archive-&lt;view&gt;-&lt;theme&gt;.png</c>) and the screen smoke
/// tests check, on the sample archive: the tree with figures and charts, the maintenance view with its reports, the
/// rebuild dialog, and the Move dialog with its dry run.
/// </summary>
public static class ArchiveScenes
{
public static readonly IReadOnlyList<string> Views = ["overview", "maintenance", "rebuild", "move"];
public static async Task ShowAsync(ShellViewModel shell, string view)
{
var archive = shell.Archive;
shell.Navigate(SectionKey.Archive);
archive.Dialog?.CloseCommand.Execute(null);
await archive.LoadAsync();
var db = shell.Services.Database ?? throw new InvalidOperationException("The sample index is not open.");
var locations = archive.SelectedArchive is { } selected ? await db.Sequences.ListLocationsAsync(selected.Id) : [];
switch (view)
{
case "overview":
archive.ViewIndex = 0;
break;
case "maintenance":
archive.ViewIndex = 1;
archive.ShowReports(SampleReports.Duplicates(locations), SampleReports.Orphans(locations), locations);
break;
case "rebuild":
archive.ViewIndex = 0;
(await archive.OpenRebuildDialogAsync())?.ShowFolders(SampleReports.Folders(locations));
break;
case "move":
archive.ViewIndex = 0;
await archive.OpenRenameDialogAsync(RenameMode.Folders);
if (archive.Dialog is RenameDialogViewModel move)
{
move.Template.Text = "{year}/{date} {title}";
await move.PlanAsync();
}
break;
default:
throw new ArgumentOutOfRangeException(nameof(view), view, "Unknown Archive view.");
}
}
}