commit a4cdea5829da56abf4e09727a901f1711ccb33a4
parent f7a5610d8d89dcc1c1a459053b4e4ed31aa8214c
Author: Michael Camilleri <[email protected]>
Date: Wed, 17 Jun 2026 09:59:28 +0900
Display diagnostics log in sheet when called in-game
Diffstat
| M | Crossmate/Views/Puzzle/PuzzleModifiers.swift | | | 35 | ++++++++++++++++++++++++++--------- |
1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/Crossmate/Views/Puzzle/PuzzleModifiers.swift b/Crossmate/Views/Puzzle/PuzzleModifiers.swift
@@ -17,16 +17,33 @@ struct PuzzleToolbarModifier: ViewModifier {
@Binding var isShowingShareSheet: Bool
@Environment(PlayerPreferences.self) private var preferences
@AppStorage("debugMode") private var debugMode = false
+ @State private var isShowingDiagnostics = false
func body(content: Content) -> some View {
- content.toolbar {
- ToolbarItemGroup(placement: .topBarTrailing) {
- pencilButton
- entryMenu
- hintsMenu
- playersMenu
+ content
+ .toolbar {
+ ToolbarItemGroup(placement: .topBarTrailing) {
+ pencilButton
+ entryMenu
+ hintsMenu
+ playersMenu
+ }
+ }
+ .sheet(isPresented: $isShowingDiagnostics) {
+ NavigationStack {
+ DiagnosticsView()
+ .toolbar {
+ ToolbarItem(placement: .cancellationAction) {
+ Button {
+ isShowingDiagnostics = false
+ } label: {
+ Image(systemName: "xmark")
+ }
+ .accessibilityLabel("Close")
+ }
+ }
+ }
}
- }
}
private func swatchImage(for color: PlayerColor) -> Image {
@@ -80,8 +97,8 @@ struct PuzzleToolbarModifier: ViewModifier {
if debugMode {
Section {
- NavigationLink {
- DiagnosticsView()
+ Button {
+ isShowingDiagnostics = true
} label: {
Text("Diagnostics Log")
}