← All repositories

crossmate

A collaborative crossword app for iPhone and iPad

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


commit 7ee412cd06166ef3cddb87c1bd5fe0468ee8d8a2
parent 36dac94cc745eef10c4a10cc04c71499695ca350
Author: Michael Camilleri <[email protected]>
Date:   Fri,  1 May 2026 16:28:32 +0900

Adjust centring approach

Diffstat

MCrossmate/Views/PuzzleView.swift | 62++++++++++++++++++++++++++++++++++----------------------------

1 file changed, 34 insertions(+), 28 deletions(-)

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

@@ -15,7 +15,6 @@ struct PuzzleView: View {
     @State private var leaveError: String?
     @State private var isRevokedBannerDismissed = false
     @State private var isShowingShareSheet = false
-    @ScaledMetric(relativeTo: .headline) private var puzzleTitleOffset = 18
 
     private func swatchImage(for color: PlayerColor) -> Image {
         let tint = UIColor(color.tint)
@@ -44,33 +43,8 @@ struct PuzzleView: View {
 
     var body: some View {
         VStack(spacing: 0) {
-            ZStack {
-                VStack(spacing: 0) {
-                    PuzzleTitle(title: titleParts.title, subtitle: titleParts.subtitle)
-                    GridView(session: session, roster: roster)
-                        .padding(.bottom, puzzleTitleOffset)
-                }
-
-                if session.isRebusActive {
-                    Color.black.opacity(0.35)
-                        .ignoresSafeArea(edges: .top)
-                        .contentShape(Rectangle())
-                        .onTapGesture {
-                            session.commitRebus()
-                        }
-                    RebusModal(text: session.rebusBuffer)
-                        .padding(.horizontal)
-                        .contentShape(Rectangle())
-                        .onTapGesture { /* swallow */ }
-                }
-            }
-
-            VStack(spacing: 0) {
-                ClueBarSlot(session: session)
-                KeyboardView(session: session)
-                    .disabled(isSolved)
-                    .background(Color(.systemGroupedBackground))
-            }
+            puzzleArea
+            controlsArea
         }
         .overlay(alignment: .top) {
             if session.mutator.isAccessRevoked && !isRevokedBannerDismissed {
@@ -263,6 +237,38 @@ struct PuzzleView: View {
         }
     }
 
+    private var puzzleArea: some View {
+        ZStack {
+            VStack(spacing: 0) {
+                PuzzleTitle(title: titleParts.title, subtitle: titleParts.subtitle)
+                GridView(session: session, roster: roster)
+                    .frame(maxWidth: .infinity, maxHeight: .infinity)
+            }
+
+            if session.isRebusActive {
+                Color.black.opacity(0.35)
+                    .ignoresSafeArea(edges: .top)
+                    .contentShape(Rectangle())
+                    .onTapGesture {
+                        session.commitRebus()
+                    }
+                RebusModal(text: session.rebusBuffer)
+                    .padding(.horizontal)
+                    .contentShape(Rectangle())
+                    .onTapGesture { /* swallow */ }
+            }
+        }
+    }
+
+    private var controlsArea: some View {
+        VStack(spacing: 0) {
+            ClueBarSlot(session: session)
+            KeyboardView(session: session)
+                .disabled(isSolved)
+                .background(Color(.systemGroupedBackground))
+        }
+    }
+
     private func leaveSharedGame() async {
         guard let shareController else { return }
         do {