7d4c5c07d716c9f6f5bcdbc18824072053609cf1

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Fix glass button hit testing and split speech reveal into chips

Diff

 1diff --git a/Sources/japanese/EntryView.swift b/Sources/japanese/EntryView.swift
 2index 0f1d7993c7d17e5b1e1ffa98a83c498a582670c8..365ec226ae8458a86d96857d9156ea68d4b79072 100644
 3--- a/Sources/japanese/EntryView.swift
 4+++ b/Sources/japanese/EntryView.swift
 5@@ -52,23 +52,23 @@ struct EntryView: View {
 6     }
 7 
 8     private var speechCard: some View {
 9-        VStack(alignment: .leading, spacing: 0) {
10-            if hasRomaji {
11-                revealRow(title: "Romaji", revealed: $showRomaji, text: entry.romaji)
12-            }
13-            if hasRomaji && hasEnglish {
14-                Divider()
15-            }
16-            if hasEnglish {
17-                revealRow(title: "Translation", revealed: $showEnglish, text: entry.english)
18+        GlassEffectContainer(spacing: 6) {
19+            VStack(alignment: .leading, spacing: 8) {
20+                if hasRomaji {
21+                    revealChip(title: "Romaji", revealed: $showRomaji, text: entry.romaji)
22+                }
23+                if hasEnglish {
24+                    revealChip(title: "Translation", revealed: $showEnglish, text: entry.english)
25+                }
26             }
27         }
28-        .glassEffect(in: .rect(cornerRadius: 16))
29     }
30 
31-    private func revealRow(title: String, revealed: Binding<Bool>, text: String?) -> some View {
32+    private func revealChip(title: String, revealed: Binding<Bool>, text: String?) -> some View {
33         Button {
34-            revealed.wrappedValue.toggle()
35+            withAnimation(.snappy) {
36+                revealed.wrappedValue.toggle()
37+            }
38         } label: {
39             HStack(alignment: .firstTextBaseline, spacing: 8) {
40                 if revealed.wrappedValue {
41@@ -83,7 +83,10 @@ struct EntryView: View {
42             }
43             .foregroundStyle(revealed.wrappedValue ? AnyShapeStyle(.primary) : AnyShapeStyle(.secondary))
44             .frame(maxWidth: .infinity, alignment: .leading)
45-            .padding(12)
46+            .padding(.horizontal, 14)
47+            .padding(.vertical, 10)
48+            .glassEffect(in: .rect(cornerRadius: 12))
49+            .contentShape(.interaction, .rect(cornerRadius: 12))
50         }
51         .buttonStyle(.plain)
52     }
53diff --git a/Sources/japanese/GameView.swift b/Sources/japanese/GameView.swift
54index 1abc62658f9d819f8730bef0fdda279f9d8da842..42b35d3f24f50786c4b05f0dccecc591e33c3953 100644
55--- a/Sources/japanese/GameView.swift
56+++ b/Sources/japanese/GameView.swift
57@@ -132,6 +132,7 @@ struct GameView: View {
58                             .foregroundStyle(store.phase == .recording ? Color.red : Color.primary)
59                             .frame(width: 44, height: 44)
60                             .glassEffect(.regular.interactive(), in: .circle)
61+                            .contentShape(.interaction, .circle)
62                     }
63                     .buttonStyle(.plain)
64                     .disabled(store.phase != .idle && store.phase != .recording)
65@@ -145,6 +146,7 @@ struct GameView: View {
66                             Image(systemName: "arrow.up")
67                                 .frame(width: 44, height: 44)
68                                 .glassEffect(.regular.interactive(), in: .circle)
69+                                .contentShape(.interaction, .circle)
70                         }
71                         .buttonStyle(.plain)
72                         .disabled(!GameStore.isSendable(input.trimmingCharacters(in: .whitespacesAndNewlines)))