From 2d0e806ff1df64aa7ffd61eaf52217530a19ed4e Mon Sep 17 00:00:00 2001 From: glacials Date: Thu, 2 Apr 2026 16:10:04 +0900 Subject: [PATCH] Clarify that Apply fills a blank location with the chosen place The review card now makes the before-and-after state explicit, restores Apply as the primary action, and changes precision choices to actual place labels so users understand what metadata decision they are making. Constraint: The review card stays narrow, so long place choices must still remain scannable without losing the selected location context Rejected: Keep correctness-based button labels and rely on button copy alone | still left the card itself ambiguous about current versus future state Rejected: Add a coordinates-only precision option | PhotoKit writes CLLocation coordinates either way, so that choice would not map to a distinct persisted behavior Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep the card's current-versus-apply comparison explicit; avoid collapsing the saved-state explanation back into action labels alone Tested: make lint; make test Not-tested: Manual visual polish check in the live macOS app --- .../Features/Review/ReviewGridView.swift | 228 +++++++++++++----- .../Features/Review/ReviewView.swift | 6 +- .../Domain/LocationOption.swift | 4 +- 3 files changed, 174 insertions(+), 64 deletions(-) diff --git a/App/PhotoLocSyncMac/Features/Review/ReviewGridView.swift b/App/PhotoLocSyncMac/Features/Review/ReviewGridView.swift index 39c24b8..81858f3 100644 --- a/App/PhotoLocSyncMac/Features/Review/ReviewGridView.swift +++ b/App/PhotoLocSyncMac/Features/Review/ReviewGridView.swift @@ -51,6 +51,51 @@ private struct ReviewPreviewSourceBridge: NSViewRepresentable { } } +private struct ReviewLocationStatePanel: View { + let title: String + let value: String + let note: String + let systemImage: String + let tint: Color + let extraLines: [String] + + var body: some View { + VStack(alignment: .leading, spacing: 6) { + Label(title, systemImage: systemImage) + .font(.caption.weight(.semibold)) + .foregroundStyle(.secondary) + + Text(value) + .font(.headline) + .foregroundStyle(.primary) + .lineLimit(3) + .truncationMode(.tail) + .fixedSize(horizontal: false, vertical: true) + + ForEach(extraLines, id: \.self) { line in + Text(line) + .font(.caption) + .foregroundStyle(.secondary) + .lineLimit(2) + .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) + .background(tint.opacity(0.14), in: RoundedRectangle(cornerRadius: 12)) + .overlay { + RoundedRectangle(cornerRadius: 12) + .stroke(tint.opacity(0.35), lineWidth: 1) + } + } +} + private struct ReviewGridItemView: View { let entry: ReviewSelection let isPhotoSelected: Bool @@ -130,7 +175,6 @@ private struct ReviewGridItemView: View { var body: some View { let hasLocation = entry.item.proposedCoordinate != nil let canPasteCopiedLocation = canPasteLocation(contextMenuTargetIDs) - let selectedPrecisionTitle = entry.item.selectedPrecision?.title ?? LocationPrecision.exact.title VStack(alignment: .leading, spacing: 12) { ZStack { @@ -164,21 +208,37 @@ private struct ReviewGridItemView: View { .allowsHitTesting(false) } - VStack(alignment: .leading, spacing: 6) { - Text("Timeline suggestion") + VStack(alignment: .leading, spacing: 10) { + Text("Location") .font(.caption.weight(.semibold)) .foregroundStyle(.secondary) - Text(entry.item.locationLabel) - .font(.headline) - .lineLimit(3) - .truncationMode(.tail) - .fixedSize(horizontal: false, vertical: true) - .frame(maxWidth: .infinity, alignment: .leading) - - Text(entry.item.asset.hasLocation ? "Apple Photos already has saved location metadata." : "Apple Photos currently has no saved location metadata.") - .font(.subheadline) - .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.") + } + .font(.caption.weight(.semibold)) + .foregroundStyle(Color.accentColor) + + ReviewLocationStatePanel( + title: "Apply will save", + value: selectedLocationLabel, + note: locationSourceText, + systemImage: "mappin.and.ellipse", + tint: Color.accentColor, + extraLines: selectedLocationDetailLines + ) Label(captureDateText(entry.item), systemImage: "calendar") .foregroundStyle(.secondary) @@ -194,36 +254,10 @@ private struct ReviewGridItemView: View { Text(dispositionText(entry.item.disposition)) .font(.subheadline.weight(.medium)) .foregroundStyle(dispositionColor(entry.item.disposition)) - - if let coordinate = entry.item.proposedCoordinate { - VStack(alignment: .leading, spacing: 2) { - Text("What will be written") - .font(.caption.weight(.semibold)) - .foregroundStyle(.secondary) - Text(selectedPrecisionTitle) - .font(.caption) - .foregroundStyle(.secondary) - Text(String(format: "%.6f, %.6f", coordinate.latitude, coordinate.longitude)) - .font(.caption.monospaced()) - .textSelection(.enabled) - if let copiedFromAssetID = entry.copiedFromAssetID { - Text("Copied from: \(copiedFromAssetID)") - .font(.caption2.monospaced()) - .foregroundStyle(.tertiary) - .lineLimit(1) - .truncationMode(.middle) - } else { - Text("Source: this photo's timeline match") - .font(.caption2) - .foregroundStyle(.tertiary) - } - } - .padding(.top, 2) - } } VStack(alignment: .leading, spacing: 8) { - Text("Does this suggested location look right?") + Text("Review action") .font(.caption.weight(.semibold)) .foregroundStyle(.secondary) @@ -233,18 +267,41 @@ private struct ReviewGridItemView: View { setLocationPrecision([entry.id], option.precision) } label: { if entry.item.selectedPrecision == option.precision { - Label(option.precision.title, systemImage: "checkmark") + Label(locationOptionMenuTitle(for: option), systemImage: "checkmark") } else { - Text(option.precision.title) + Text(locationOptionMenuTitle(for: option)) } } } } label: { - Label("Precision: \(selectedPrecisionTitle)", systemImage: "slider.horizontal.3") + 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) + .foregroundStyle(.secondary) + .lineLimit(2) + .truncationMode(.tail) + .fixedSize(horizontal: false, vertical: true) + } + + Spacer(minLength: 8) + + Image(systemName: "chevron.down") + .font(.caption.weight(.semibold)) + .foregroundStyle(.secondary) + .padding(.top, 4) + } + .frame(maxWidth: .infinity, alignment: .leading) } .buttonStyle(.bordered) - Button("This Looks Correct") { + Button("Apply") { Task { await applyChange(entry.id) } @@ -252,12 +309,12 @@ private struct ReviewGridItemView: View { .buttonStyle(.borderedProminent) .disabled(entry.item.suggestedDecision == nil) - Menu("This Looks Wrong") { - Button("Skip for Now") { + Menu("Leave Blank") { + Button("This Time") { skipForNow(entry.id) } - Button("Never Show Again") { + Button("Every Time") { Task { await dismissPermanently(entry.id) } @@ -291,9 +348,9 @@ private struct ReviewGridItemView: View { setLocationPrecision(contextMenuTargetIDs, precision) } label: { if selectedContextMenuPrecision == precision { - Label(precision.title, systemImage: "checkmark") + Label(contextMenuPrecisionTitle(for: precision), systemImage: "checkmark") } else { - Text(precision.title) + Text(contextMenuPrecisionTitle(for: precision)) } } } @@ -307,7 +364,7 @@ private struct ReviewGridItemView: View { } .disabled(!canApplyContextMenuTargets) - Menu(incorrectContextMenuTitle) { + Menu(leaveBlankContextMenuTitle) { Button(skipContextMenuTitle) { skipPhotosForNow(contextMenuTargetIDs) } @@ -356,23 +413,23 @@ private struct ReviewGridItemView: View { } private var applyContextMenuTitle: String { - appliesToMultiplePhotos ? "These Look Correct (\(contextMenuTargetIDs.count))" : "This Looks Correct" + appliesToMultiplePhotos ? "Apply Selected (\(contextMenuTargetIDs.count))" : "Apply" } - private var incorrectContextMenuTitle: String { - appliesToMultiplePhotos ? "These Look Wrong (\(contextMenuTargetIDs.count))" : "This Looks Wrong" + private var leaveBlankContextMenuTitle: String { + appliesToMultiplePhotos ? "Leave Selected Blank (\(contextMenuTargetIDs.count))" : "Leave Blank" } private var skipContextMenuTitle: String { - appliesToMultiplePhotos ? "Skip Selected for Now (\(contextMenuTargetIDs.count))" : "Skip for Now" + "This Time" } private var dismissContextMenuTitle: String { - appliesToMultiplePhotos ? "Never Show Selected Again (\(contextMenuTargetIDs.count))" : "Never Show Again" + "Every Time" } private var precisionContextMenuTitle: String { - appliesToMultiplePhotos ? "Choose Precision (\(contextMenuTargetIDs.count))" : "Choose Precision" + appliesToMultiplePhotos ? "Save Selected As (\(contextMenuTargetIDs.count))" : "Save As" } private var selectionMode: ReviewPhotoSelectionMode { @@ -406,8 +463,8 @@ private struct ReviewGridItemView: View { private func dispositionText(_ disposition: MatchDisposition) -> String { switch disposition { - case .autoSuggested: "Auto-suggested" - case .ambiguous: "Needs review" + case .autoSuggested: "Timeline match" + case .ambiguous: "Timeline match needs review" case .unmatched: "Unmatched" } } @@ -419,6 +476,59 @@ private struct ReviewGridItemView: View { case .unmatched: .secondary } } + + private var selectedLocationOption: LocationOption? { + if let selectedPrecision = entry.item.selectedPrecision, + let option = entry.item.locationOption(for: selectedPrecision) { + return option + } + return entry.item.availableLocationOptions.first + } + + private var selectedLocationLabel: String { + selectedLocationOption?.label ?? entry.item.locationLabel + } + + private var selectedLocationMenuLabel: String { + truncatedLocationLabel(selectedLocationLabel, maxLength: 72) + } + + private var selectedLocationDetailLines: [String] { + guard let coordinate = entry.item.proposedCoordinate else { return [] } + + return [ + selectedLocationOption?.precision.title ?? "", + String(format: "%.6f, %.6f", coordinate.latitude, coordinate.longitude) + ] + .filter { !$0.isEmpty } + } + + private var locationSourceText: String { + if let copiedFromAssetID = entry.copiedFromAssetID { + return "Source: copied from \(copiedFromAssetID)" + } + return "Source: matched from this photo's timeline data" + } + + private func locationOptionMenuTitle(for option: LocationOption) -> String { + let subtitle = option.precision.title + return "\(truncatedLocationLabel(option.label)) (\(subtitle))" + } + + private func contextMenuPrecisionTitle(for precision: LocationPrecision) -> String { + guard contextMenuTargetIDs.count == 1, + let option = entry.item.locationOption(for: precision) else { + return precision.title + } + + return locationOptionMenuTitle(for: option) + } + + private func truncatedLocationLabel(_ label: String, maxLength: Int = 56) -> String { + guard label.count > maxLength else { return label } + let prefix = label.prefix(maxLength - 1) + return String(prefix).trimmingCharacters(in: .whitespacesAndNewlines) + "..." + } } struct ReviewGridView: View { @@ -455,7 +565,7 @@ struct ReviewGridView: View { ScrollViewReader { proxy in ScrollView { VStack(alignment: .leading, spacing: 12) { - Text("Each photo shows a timeline suggestion, not existing metadata from Apple Photos. Click a photo to focus the map. Command-click toggles photos. Shift-click selects the range between photos. Command-A selects every photo on the current day. Right-click a selected group to change precision or mark it correct or incorrect together.") + Text("Each card compares the photo's current Apple Photos location with the place Apply will save. Command-click toggles photos. Shift-click selects the range between photos. Command-A selects every photo on the current day. Right-click selected photos to leave them blank or change the saved place together.") .font(.subheadline) .foregroundStyle(.secondary) diff --git a/App/PhotoLocSyncMac/Features/Review/ReviewView.swift b/App/PhotoLocSyncMac/Features/Review/ReviewView.swift index 80c1ab6..cd41088 100644 --- a/App/PhotoLocSyncMac/Features/Review/ReviewView.swift +++ b/App/PhotoLocSyncMac/Features/Review/ReviewView.swift @@ -78,7 +78,7 @@ struct ReviewView: View { VStack(alignment: .leading, spacing: 8) { Text("Review Proposed Locations") .font(.largeTitle.bold()) - Text("Each card shows a timeline-based suggestion for a photo that currently has no saved location in Apple Photos. Review one day at a time and choose how precise the saved place should be before writing it.") + Text("Each card shows what Apple Photos has now and what Apply will save from the timeline match. Review one day at a time and choose the place you want to save before applying it.") .foregroundStyle(.secondary) HStack(spacing: 12) { @@ -118,7 +118,7 @@ struct ReviewView: View { await viewModel.applyCurrentDay() } } label: { - Label(viewModel.isApplyingCurrentDay ? "Writing..." : "Write Day", systemImage: "checkmark.circle") + Label(viewModel.isApplyingCurrentDay ? "Applying..." : "Apply Day", systemImage: "checkmark.circle") } .buttonStyle(.borderedProminent) .disabled(!viewModel.canApplyCurrentDay) @@ -141,7 +141,7 @@ struct ReviewView: View { Spacer() - Text("Mark a suggestion correct to write it, or incorrect to skip or hide it. Right-click selected photos to change precision or act on them together.") + Text("Apply writes the selected place choice. Leave Blank keeps the photo unchanged for this review or hides it from future reviews. Right-click selected photos to batch-apply either action.") .font(.subheadline) .foregroundStyle(.secondary) } diff --git a/Sources/PhotoLocSyncCore/Domain/LocationOption.swift b/Sources/PhotoLocSyncCore/Domain/LocationOption.swift index 3dd929f..5620302 100644 --- a/Sources/PhotoLocSyncCore/Domain/LocationOption.swift +++ b/Sources/PhotoLocSyncCore/Domain/LocationOption.swift @@ -10,9 +10,9 @@ public enum LocationPrecision: Int, CaseIterable, Codable, Hashable, Sendable, I public var title: String { switch self { - case .exact: "Exact place" + case .exact: "Specific match" case .city: "City" - case .region: "State / region" + case .region: "State or region" case .country: "Country" } } -- knotmirror 0.0.1