From 8dffe6fab24d86d8f3bfe1b748f736edbd4e90f3 Mon Sep 17 00:00:00 2001 From: glacials Date: Thu, 2 Apr 2026 17:28:47 +0900 Subject: [PATCH] Make review rows read left-to-right as photo changes The review list now presents each item as a horizontal row with the thumbnail on the left and a compact current-to-apply location strip on the right. This keeps the intended change visible in one scan without reworking the surrounding review behavior. Constraint: Preserve existing review actions, selection, and context-menu behavior Rejected: Keep a separate trailing action column | too cramped at the review pane's minimum width Confidence: high Scope-risk: narrow Reversibility: clean Directive: If this row gets denser later, prefer responsive fallbacks over reintroducing stacked location panels by default Tested: make lint; make test Not-tested: Manual macOS visual verification of spacing and wrapping in the updated review row --- .../Features/Review/ReviewGridView.swift | 190 +++++++++--------- 1 file changed, 100 insertions(+), 90 deletions(-) diff --git a/App/PhotoLocSyncMac/Features/Review/ReviewGridView.swift b/App/PhotoLocSyncMac/Features/Review/ReviewGridView.swift index 7f927ba..25f07dd 100644 --- a/App/PhotoLocSyncMac/Features/Review/ReviewGridView.swift +++ b/App/PhotoLocSyncMac/Features/Review/ReviewGridView.swift @@ -51,16 +51,15 @@ private struct ReviewPreviewSourceBridge: NSViewRepresentable { } } -private struct ReviewLocationStatePanel: View { +private struct ReviewLocationChangeBadge: View { let title: String let value: String - let note: String let systemImage: String let tint: Color - let extraLines: [String] + let detailLines: [String] var body: some View { - VStack(alignment: .leading, spacing: 6) { + VStack(alignment: .leading, spacing: 5) { Label(title, systemImage: systemImage) .font(.caption.weight(.semibold)) .foregroundStyle(.secondary) @@ -72,7 +71,7 @@ private struct ReviewLocationStatePanel: View { .truncationMode(.tail) .fixedSize(horizontal: false, vertical: true) - ForEach(extraLines, id: \.self) { line in + ForEach(detailLines, id: \.self) { line in Text(line) .font(.caption) .foregroundStyle(.secondary) @@ -80,11 +79,6 @@ private struct ReviewLocationStatePanel: View { .truncationMode(.tail) .fixedSize(horizontal: false, vertical: true) } - - Text(note) - .font(.caption) - .foregroundStyle(.secondary) - .fixedSize(horizontal: false, vertical: true) } .frame(maxWidth: .infinity, alignment: .leading) .padding(12) @@ -178,7 +172,7 @@ private struct ReviewListItemView: View { let canPasteCopiedLocation = canPasteLocation(contextMenuTargetIDs) let status = ReviewSuggestionStatusDescriptor(item: entry.item) - VStack(alignment: .leading, spacing: 12) { + HStack(alignment: .top, spacing: 16) { ZStack { RoundedRectangle(cornerRadius: 12) .fill(Color.secondary.opacity(0.08)) @@ -193,8 +187,6 @@ private struct ReviewListItemView: View { .foregroundStyle(.secondary) } } - .frame(maxWidth: .infinity) - .frame(height: 220) .clipShape(RoundedRectangle(cornerRadius: 12)) .task { thumbnailLoader.loadIfNeeded() @@ -209,38 +201,45 @@ private struct ReviewListItemView: View { } .allowsHitTesting(false) } + .frame(width: 168, height: 132) VStack(alignment: .leading, spacing: 10) { Text("Location") .font(.caption.weight(.semibold)) .foregroundStyle(.secondary) - ReviewLocationStatePanel( - title: "Current in Apple Photos", - value: entry.item.asset.hasLocation ? "Location already saved" : "Blank", - note: entry.item.asset.hasLocation - ? "This photo already has saved location metadata." - : "This photo has no saved location metadata yet.", - systemImage: "circle.dashed", - tint: Color.secondary, - extraLines: [] - ) - - HStack(spacing: 6) { - Image(systemName: "arrow.down.circle.fill") - Text("Apply saves coordinates for the selected place below.") + HStack(alignment: .center, spacing: 10) { + ReviewLocationChangeBadge( + title: "Now", + value: currentLocationSummary, + systemImage: "circle.dashed", + tint: Color.secondary, + detailLines: [] + ) + + Image(systemName: "arrow.right.circle.fill") + .font(.title3) + .foregroundStyle(Color.accentColor) + + ReviewLocationChangeBadge( + title: "Apply", + value: selectedLocationLabel, + systemImage: "mappin.and.ellipse", + tint: Color.accentColor, + detailLines: selectedLocationDetailLines + ) } - .font(.caption.weight(.semibold)) - .foregroundStyle(Color.accentColor) + .frame(maxWidth: .infinity, alignment: .leading) - ReviewLocationStatePanel( - title: "Apply will save", - value: selectedLocationLabel, - note: locationSourceText, - systemImage: "mappin.and.ellipse", - tint: Color.accentColor, - extraLines: selectedLocationDetailLines - ) + Text(currentLocationDetailText) + .font(.caption) + .foregroundStyle(.secondary) + .fixedSize(horizontal: false, vertical: true) + + Text(locationSourceText) + .font(.caption) + .foregroundStyle(.secondary) + .fixedSize(horizontal: false, vertical: true) Label(captureDateText(entry.item), systemImage: "calendar") .foregroundStyle(.secondary) @@ -279,74 +278,75 @@ private struct ReviewListItemView: View { .font(.caption) .foregroundStyle(.tertiary) } - } - - VStack(alignment: .leading, spacing: 8) { - Text("Review action") - .font(.caption.weight(.semibold)) - .foregroundStyle(.secondary) + VStack(alignment: .leading, spacing: 8) { + Text("Review action") + .font(.caption.weight(.semibold)) + .foregroundStyle(.secondary) - Menu { - ForEach(entry.item.availableLocationOptions) { option in - Button { - setLocationPrecision([entry.id], option.precision) - } label: { - if entry.item.selectedPrecision == option.precision { - Label(locationOptionMenuTitle(for: option), systemImage: "checkmark") - } else { - Text(locationOptionMenuTitle(for: option)) + Menu { + ForEach(entry.item.availableLocationOptions) { option in + Button { + setLocationPrecision([entry.id], option.precision) + } label: { + if entry.item.selectedPrecision == option.precision { + Label(locationOptionMenuTitle(for: option), systemImage: "checkmark") + } else { + Text(locationOptionMenuTitle(for: option)) + } } } - } - } label: { - HStack(alignment: .top, spacing: 8) { - Image(systemName: "slider.horizontal.3") - .foregroundStyle(.secondary) - .padding(.top, 2) - - VStack(alignment: .leading, spacing: 2) { - Text("Save as") - .font(.subheadline.weight(.semibold)) - Text(selectedLocationMenuLabel) - .font(.caption) + } label: { + HStack(alignment: .top, spacing: 8) { + Image(systemName: "slider.horizontal.3") .foregroundStyle(.secondary) - .lineLimit(2) - .truncationMode(.tail) - .fixedSize(horizontal: false, vertical: true) - } + .padding(.top, 2) + + VStack(alignment: .leading, spacing: 2) { + Text("Save as") + .font(.subheadline.weight(.semibold)) + Text(selectedLocationMenuLabel) + .font(.caption) + .foregroundStyle(.secondary) + .lineLimit(2) + .truncationMode(.tail) + .fixedSize(horizontal: false, vertical: true) + } - Spacer(minLength: 8) + Spacer(minLength: 8) - Image(systemName: "chevron.down") - .font(.caption.weight(.semibold)) - .foregroundStyle(.secondary) - .padding(.top, 4) + Image(systemName: "chevron.down") + .font(.caption.weight(.semibold)) + .foregroundStyle(.secondary) + .padding(.top, 4) + } + .frame(maxWidth: .infinity, alignment: .leading) } - .frame(maxWidth: .infinity, alignment: .leading) - } - .buttonStyle(.bordered) + .buttonStyle(.bordered) - Button("Apply") { - Task { - await applyChange(entry.id) + Button("Apply") { + Task { + await applyChange(entry.id) + } } - } - .buttonStyle(.borderedProminent) - .disabled(entry.item.suggestedDecision == nil) + .buttonStyle(.borderedProminent) + .disabled(entry.item.suggestedDecision == nil) - Menu("Leave Blank") { - Button("This Time") { - skipForNow(entry.id) - } + Menu("Leave Blank") { + Button("This Time") { + skipForNow(entry.id) + } - Button("Every Time") { - Task { - await dismissPermanently(entry.id) + Button("Every Time") { + Task { + await dismissPermanently(entry.id) + } } } + .buttonStyle(.bordered) } - .buttonStyle(.bordered) + .padding(.top, 2) } + .frame(maxWidth: .infinity, alignment: .leading) } .padding() .frame(maxWidth: .infinity, alignment: .leading) @@ -493,6 +493,16 @@ private struct ReviewListItemView: View { truncatedLocationLabel(selectedLocationLabel, maxLength: 72) } + private var currentLocationSummary: String { + entry.item.asset.hasLocation ? "Saved in Photos" : "Blank" + } + + private var currentLocationDetailText: String { + entry.item.asset.hasLocation + ? "This photo already has saved location metadata." + : "This photo has no saved location metadata yet." + } + private var selectedLocationDetailLines: [String] { guard let coordinate = entry.item.proposedCoordinate else { return [] } -- knotmirror 0.0.1