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

@@ -0,0 +1,123 @@
using System.Windows.Input;
using Chronos.App.Infrastructure;
using Chronos.App.Settings;
using Chronos.Core.Localization;
using Chronos.Data.Copies;
using Chronos.Data.Sync;
using Chronos.Ui.Controls;
using Chronos.Ui.Mvvm;
namespace Chronos.App.Server.Copies;
/// <summary>A line of the Photos part's class table: glyph and class, count, bytes on each side, what it means.</summary>
public sealed class CopyClassRow(PhotoClassTotal total) : ObservableObject
{
public PhotoClass Class { get; } = total.Class;
public StatusKind Kind => CopyText.ClassKind(Class);
public string Text => CopyText.Class(Class);
public string CountText => Formatting.Count(total.Count);
public string HereBytesText => total.HereBytes > 0 ? Formatting.Bytes(total.HereBytes) : string.Empty;
public string ThereBytesText => total.ThereBytes > 0 ? Formatting.Bytes(total.ThereBytes) : string.Empty;
public string ToolTip => CopyText.ClassToolTip(Class);
public int Count => total.Count;
}
/// <summary>
/// A photo of the Photos part's list: capture time, name, size, where it lies, and per policy a Bring tick (Only here,
/// Only there under Choose each), a version choice (Different under Choose each) or Drop… (Two versions).
/// </summary>
public sealed class CopyPhotoRow : ObservableObject
{
private readonly Action _changed;
private bool _bring;
private bool _isSelected;
private SettingsOption<PhotoChoice>? _choice;
public CopyPhotoRow(ComparedPhoto photo, bool isMerge, bool canBring, bool canChoose, IReadOnlyList<SettingsOption<PhotoChoice>> choices,
PhotoChoice? current, Action changed, Func<CopyPhotoRow, Task>? drop)
{
Photo = photo;
IsMerge = isMerge;
CanBring = canBring;
CanChoose = canChoose;
Choices = choices;
_changed = changed;
_bring = current == PhotoChoice.Bring;
_choice = current is { } c and not PhotoChoice.Bring ? choices.FirstOrDefault(o => o.Value == c) : null;
if (drop is not null) DropCommand = new AsyncRelayCommand(() => drop(this));
}
public ComparedPhoto Photo { get; }
public bool IsMerge { get; }
public string Key => Photo.Key;
private CopyPhotoInput? Input => Photo.Here ?? Photo.There;
public string TimeText => Input?.CapturedAt is { } at ? Formatting.Date(at) + " " + at.ToString("T", Loc.Culture) : string.Empty;
public string Name => Input?.FileName ?? Photo.Key;
public string SizeText => Formatting.Bytes(Photo.Bytes);
/// <summary>"This PC", "Server" (Kept, Other for a merge), or both.</summary>
public string SideText => (Photo.Here, Photo.There) switch
{
(not null, not null) => string.Join(Loc.Separator, Side(true), Side(false)),
(not null, null) => Side(true),
_ => Side(false),
};
public string ToolTip => string.Join(Loc.Separator, Name, SizeText, SideText);
/// <summary>Only here or Only there under Choose each: a Bring tick.</summary>
public bool CanBring { get; }
/// <summary>Different under Choose each: Keep both, This PC's, Server's, Leave.</summary>
public bool CanChoose { get; }
public IReadOnlyList<SettingsOption<PhotoChoice>> Choices { get; }
public ICommand? DropCommand { get; }
public bool CanDrop => DropCommand is not null;
public bool Bring
{
get => _bring;
set
{
if (!Set(ref _bring, value)) return;
_changed();
}
}
public SettingsOption<PhotoChoice>? Choice
{
get => _choice;
set
{
if (!Set(ref _choice, value)) return;
OnPropertyChanged(nameof(ChoiceAccessibleName));
_changed();
}
}
/// <summary>The row is selected in the list (To trash… acts on the selection).</summary>
public bool IsSelected { get => _isSelected; set => Set(ref _isSelected, value); }
/// <summary>The user's choice for this photo, or null when none.</summary>
public PhotoChoice? Chosen => CanBring ? (_bring ? PhotoChoice.Bring : null) : _choice?.Value;
public string BringAccessibleName => Loc.L("Server.Copies.ControlFor", Name, Loc.L("Server.Copies.Photo.Bring"));
public string ChoiceAccessibleName => Loc.L("Server.Copies.ControlFor", Name, _choice?.Label ?? Loc.L("Server.Copies.Version.Leave"));
public string DropAccessibleName => Loc.L("Server.Copies.ControlFor", Name, Loc.L("Server.Copies.Action.Drop"));
/// <summary>Sets the tick or the choice without raising one change per row (Bring all, All: keep both).</summary>
internal void SetQuietly(bool bring, SettingsOption<PhotoChoice>? choice)
{
_bring = bring;
_choice = choice;
OnPropertyChanged(nameof(Bring));
OnPropertyChanged(nameof(Choice));
OnPropertyChanged(nameof(ChoiceAccessibleName));
}
private string Side(bool here) => Loc.L(IsMerge ? (here ? "Server.Copies.Detail.Kept" : "Server.Copies.Detail.Other")
: here ? "Server.Copies.Detail.ThisPc" : "Server.Copies.Detail.Server");
}