feat(app): matches list, compare dialog, settings rows, library and picker surfaces (owner review 6, P6)

Server > Matches shows the pairs the copy engine found (same sequence on the
server and this PC, or twice here), attention first, with the design 8.1
actions; Keep apart and Unlink toast with Undo. The in-window Compare dialog
walks photos, details, projects and the plan, blocks until details are
chosen, and confirms only what replaces or merges (typed count for a merge).
Sync rows of an unanswered pair read "match found" and offer Compare first;
Upload all local skips suspected copies and says why. Settings > Server gains
Link matches, Integrate photos and Integrate projects. Library cards carry the
match status with Compare..., the sequence picker marks twins, and Jobs opens
Integrate and Merge targets. The sample engine and capture scenes render every
state; tests cover the text rules and the screens.

Refs #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-16 20:29:07 +01:00
1 parent 283d04d9cd
commit 06b826e39d
34 files changed
+3762 -43

No files matched your search

+115
View File
@@ -0,0 +1,115 @@
using Chronos.App.Infrastructure;
using Chronos.App.Shell;
using Chronos.Data.Copies;
using Chronos.Data.Sync;
namespace Chronos.App.Server.Copies;
/// <summary>
/// The Matches states that <c>--capture</c> renders (<c>server-copies-&lt;scene&gt;-&lt;theme&gt;.png</c>, design §8.7) and the
/// screen smoke tests check, on the sample pairs: the list, the dialog at each part and with each list, the plan with and
/// without a block, the merge of a local pair, the toast of Find matches, and the sync rows a pair marks.
/// </summary>
public static class CopyScenes
{
/// <summary>Scenes shown in the window (dialogs in-window included); the confirmations are separate windows.</summary>
public static readonly IReadOnlyList<string> Views =
[
"server-copies", "server-copies-toast", "server-copies-photos", "server-copies-choose", "server-copies-versions",
"server-copies-review", "server-copies-details", "server-copies-projects", "server-copies-plan", "server-copies-blocked",
"server-copies-merge", "server-sync-copyfound", "server-copies-gone",
];
/// <summary>The Lighthouse pair (a match found on the server).</summary>
public const string Lighthouse = "Lighthouse 2026-08-13";
/// <summary>The Alps pair (twice on this PC).</summary>
public const string Alps = "Alps 2025";
/// <summary>Shows <paramref name="view"/>; returns the dialog it opened, if any.</summary>
public static async Task<CopyDialogViewModel?> ShowAsync(ShellViewModel shell, string view)
{
var server = shell.Server;
var sync = server.Sync;
var list = sync.Copies;
shell.Navigate(SectionKey.Server);
if (server.Dialog is { } open) server.CloseDialog(open);
sync.SearchText = string.Empty;
await sync.ReloadAsync();
await list.ReloadAsync();
switch (view)
{
case "server-sync-copyfound":
sync.ShowFilter(SyncFilter.All);
return null;
case "server-copies-gone":
sync.ShowFilter(SyncFilter.All, "Garden");
return null;
case "server-copies-toast":
sync.ShowFilter(SyncFilter.FoundCopies);
if (list.Engine is { } engine) list.Announce(await engine.FindAsync(shell.Services.Sync.Remote, CancellationToken.None));
return null;
}
sync.ShowFilter(SyncFilter.FoundCopies);
if (view == "server-copies") return null;
var title = view is "server-copies-versions" or "server-copies-merge" ? Alps : view == "server-copies-review" ? "Bridge works wk 41" : Lighthouse;
if (list.Pairs.FirstOrDefault(p => p.Here.Title == title) is not { } pair) return null;
var (part, photos) = view switch
{
"server-copies-photos" => (CopyDialogPart.Photos, PhotoClass.OnlyHere),
"server-copies-choose" => (CopyDialogPart.Photos, PhotoClass.Differs),
"server-copies-versions" => (CopyDialogPart.Photos, PhotoClass.Versions),
"server-copies-review" => (CopyDialogPart.Photos, PhotoClass.DeletedThere),
"server-copies-details" => (CopyDialogPart.Details, (PhotoClass?)null),
"server-copies-projects" => (CopyDialogPart.Projects, null),
_ => (CopyDialogPart.Plan, null),
};
if (list.Open(pair, part, photos) is not { } dialog) return null;
await dialog.LoadAsync();
switch (view)
{
case "server-copies-choose":
dialog.Policy = dialog.Policies.First(o => o.Value == CopyPhotoPolicy.ChoosePerPhoto);
dialog.SelectedClass = dialog.Classes.FirstOrDefault(c => c.Class == PhotoClass.Differs);
break;
case "server-copies-details":
if (dialog.Details.Count > 0) dialog.Details[0].ChoiceIndex = 0;
break;
case "server-copies-plan":
dialog.AllHereCommand.Execute(null);
dialog.Part = CopyDialogPart.Plan;
break;
}
if (dialog.IsPlan) await dialog.PlanNowAsync();
return dialog;
}
/// <summary>"Replace photos?": the Lighthouse plan where this PC's version of the different photos wins.</summary>
public static async Task<ConfirmRequest?> ReplaceRequestAsync(ShellViewModel shell)
{
if (await ShowAsync(shell, "server-copies-plan") is not { } dialog) return null;
dialog.Policy = dialog.Policies.First(o => o.Value == CopyPhotoPolicy.ThisPcWins);
await dialog.PlanNowAsync();
var request = dialog.Plan is { } plan ? CopyDialogViewModel.ReplaceRequest(plan) : null;
shell.Server.CloseDialog(dialog);
return request;
}
/// <summary>"Merge sequences?": the Alps merge, with the typed photo count.</summary>
public static async Task<ConfirmRequest?> MergeRequestAsync(ShellViewModel shell)
{
if (await ShowAsync(shell, "server-copies-merge") is not { } dialog) return null;
dialog.AllHereCommand.Execute(null);
await dialog.PlanNowAsync();
var request = dialog.MergePlan is { } plan ? dialog.MergeRequest(plan) : null;
shell.Server.CloseDialog(dialog);
return request;
}
/// <summary>Back to the sync table with no dialog and no search.</summary>
public static void Reset(ShellViewModel shell)
{
if (shell.Server.Dialog is { } open) shell.Server.CloseDialog(open);
shell.Server.Sync.ShowFilter(SyncFilter.All, string.Empty);
}
}