← All repositories

crossmate

A collaborative crossword app for iPhone and iPad

git clone https://code.inqk.net/crossmate.git


commit 6f4eb9a148ee46f120a2ee889e446fcd806c7a1b
parent 7497b0e087480865b11c3393fb38bb4eae22e690
Author: Michael Camilleri <[email protected]>
Date:   Tue, 30 Jun 2026 15:04:14 +0900

Improve menu consistency

Diffstat

MCrossmate/Views/Puzzle/PuzzleCommands.swift | 2+-
MCrossmate/Views/Puzzle/PuzzleModifiers.swift | 14++++++++++++--
MCrossmate/Views/Puzzle/PuzzleView.swift | 3+++

3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/Crossmate/Views/Puzzle/PuzzleCommands.swift b/Crossmate/Views/Puzzle/PuzzleCommands.swift

@@ -107,7 +107,7 @@ struct PuzzleCommands: Commands {
             Button("Reveal Word") { target?.requestReveal(.word) }
                 .keyboardShortcut("r", modifiers: [.command, .shift])
                 .disabled(!isEnabled)
-            Button("Reveal Puzzle") { target?.requestReveal(.puzzle) }
+            Button("Reveal Puzzle", role: .destructive) { target?.requestReveal(.puzzle) }
                 .keyboardShortcut("r", modifiers: [.command, .control])
                 .disabled(!isEnabled)
         }

diff --git a/Crossmate/Views/Puzzle/PuzzleModifiers.swift b/Crossmate/Views/Puzzle/PuzzleModifiers.swift

@@ -20,6 +20,7 @@ struct PuzzleToolbarModifier: ViewModifier {
     @Binding var isConfirmingLeave: Bool
     @Binding var isConfirmingReveal: Bool
     @Binding var pendingRevealScope: RevealScope
+    @Binding var isConfirmingClear: Bool
     @Binding var isShowingShareSheet: Bool
     @Environment(PlayerPreferences.self) private var preferences
     @AppStorage("debugMode") private var debugMode = false
@@ -113,7 +114,7 @@ struct PuzzleToolbarModifier: ViewModifier {
 
             Section {
                 Button("Clear Word") { session.clearCurrentWord() }
-                Button("Clear Puzzle", role: .destructive) { session.clearPuzzle() }
+                Button("Clear Puzzle", role: .destructive) { isConfirmingClear = true }
             }
         } label: {
             Label("Entry", systemImage: "squareshape.split.2x2")
@@ -135,7 +136,7 @@ struct PuzzleToolbarModifier: ViewModifier {
             Section {
                 Button("Reveal Square") { confirmReveal(.square) }
                 Button("Reveal Word") { confirmReveal(.word) }
-                Button("Reveal Puzzle") { confirmReveal(.puzzle) }
+                Button("Reveal Puzzle", role: .destructive) { confirmReveal(.puzzle) }
             }
         } label: {
             Label("Hints", systemImage: "lightbulb")
@@ -304,6 +305,7 @@ struct PuzzlePresentationModifier: ViewModifier {
     @Binding var isConfirmingLeave: Bool
     @Binding var isConfirmingReveal: Bool
     @Binding var pendingRevealScope: RevealScope
+    @Binding var isConfirmingClear: Bool
     @Binding var leaveError: String?
     @Binding var destructiveActionError: String?
     @Binding var isShowingShareSheet: Bool
@@ -351,6 +353,14 @@ struct PuzzlePresentationModifier: ViewModifier {
             } message: {
                 Text(pendingRevealScope.message)
             }
+            .alert("Clear Puzzle?", isPresented: $isConfirmingClear) {
+                Button("Clear", role: .destructive) {
+                    session.clearPuzzle()
+                }
+                Button("Cancel", role: .cancel) {}
+            } message: {
+                Text("This will clear all entered squares in the puzzle.")
+            }
             .alert(
                 "Couldn't Leave",
                 isPresented: .init(

diff --git a/Crossmate/Views/Puzzle/PuzzleView.swift b/Crossmate/Views/Puzzle/PuzzleView.swift

@@ -58,6 +58,7 @@ struct PuzzleView: View {
     @State private var isConfirmingLeave = false
     @State private var isConfirmingReveal = false
     @State private var pendingRevealScope: RevealScope = .square
+    @State private var isConfirmingClear = false
     @State private var leaveError: String?
     @State private var destructiveActionError: String?
     @State private var isShowingShareSheet = false
@@ -168,6 +169,7 @@ struct PuzzleView: View {
             isConfirmingLeave: $isConfirmingLeave,
             isConfirmingReveal: $isConfirmingReveal,
             pendingRevealScope: $pendingRevealScope,
+            isConfirmingClear: $isConfirmingClear,
             isShowingShareSheet: $isShowingShareSheet
         ))
         .modifier(PuzzleLifecycleModifier(
@@ -190,6 +192,7 @@ struct PuzzleView: View {
             isConfirmingLeave: $isConfirmingLeave,
             isConfirmingReveal: $isConfirmingReveal,
             pendingRevealScope: $pendingRevealScope,
+            isConfirmingClear: $isConfirmingClear,
             leaveError: $leaveError,
             destructiveActionError: $destructiveActionError,
             isShowingShareSheet: $isShowingShareSheet,