Skip to content

Commit 9cbede4

Browse files
mcintyre94claude
andcommitted
Restyle Quick Actions sheet to match DevTools drawer design
Replace TabView with segmented Picker in principal toolbar position, and remove opaque systemBackground to let sheet material show through. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9898dad commit 9cbede4

File tree

4 files changed

+31
-24
lines changed

4 files changed

+31
-24
lines changed

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ The app runs on iPhone, iPad, and Mac (Designed for iPad). Keep all three in min
124124
Two sheet patterns in use — match the right one:
125125

126126
- **Form sheets** (data entry, e.g. New Sprite, New Checkpoint): `NavigationStack` > `Form` > `.navigationTitle` + `.navigationBarTitleDisplayMode(.inline)` + `.toolbar` with text Cancel / action-name buttons (e.g. "Cancel" / "Create"). Keep text labels — they're more informative than icons for actions with consequences.
127-
- **Utility/panel sheets** (e.g. Quick Actions): `NavigationStack` > custom content > `.navigationTitle` + `.navigationBarTitleDisplayMode(.inline)` + `Image(systemName: "xmark")` in `.cancellationAction`. `TabView` is fine for tabs here. Note: if you ever need a transparent sheet background, `TabView` will block it — its UIKit-backed view hierarchy ignores SwiftUI `.background(.clear)` and would need replacing with a custom VStack + HStack tab bar.
127+
- **Utility/panel sheets** (e.g. Quick Actions): `NavigationStack` > custom content > `.navigationBarTitleDisplayMode(.inline)` + `Image(systemName: "xmark")` in `.cancellationAction`. For tabs, use a segmented `Picker` in `ToolbarItem(placement: .principal)` + `Group { switch selectedTab }` for content — do **not** use `TabView`. TabView consumes bottom bar space, breaks transparent backgrounds, and its swipe gesture conflicts with any horizontal scroll content inside tabs.
128128

129-
Both sheet types use opaque `Color(.systemBackground)` throughout — do **not** use material/transparent backgrounds on sheets. Materials suit bars and floating elements (popovers, context menus), not sheets.
129+
Both sheet types use `.background(.clear)` on inner content views so the system sheet material shows through. Do **not** force `Color(.systemBackground)` on sheet content — let the sheet's natural material handle the background.
130130

131131
Avoid sandwiching a fixed element (e.g. input bar) between two `Divider`s. A divider above the input bar separating scrollable content from a fixed action area is standard; a second one below it is redundant.
132132

Wisp/Views/QuickActions/BashQuickView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ struct BashQuickView: View {
138138
}
139139
}
140140
}
141-
.background(Color(.systemBackground))
141+
.background(.clear)
142142
}
143143
}
144144

Wisp/Views/QuickActions/QuickActionsView.swift

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,44 @@
11
import SwiftUI
22

3+
private enum QuickActionsTab {
4+
case chat, bash
5+
}
6+
37
struct QuickActionsView: View {
48
@Environment(SpritesAPIClient.self) private var apiClient
59
@Environment(\.dismiss) private var dismiss
610
let viewModel: QuickActionsViewModel
711
var insertCallback: ((String) -> Void)? = nil
812
var startChatCallback: ((String) -> Void)? = nil
913

10-
@State private var selectedTab = 0
14+
@State private var selectedTab: QuickActionsTab = .chat
1115

1216
var body: some View {
1317
NavigationStack {
14-
tabs
15-
.navigationTitle(selectedTab == 0 ? "Quick Chat" : "Bash")
16-
.navigationBarTitleDisplayMode(.inline)
17-
.toolbar {
18-
ToolbarItem(placement: .cancellationAction) {
19-
Button(action: handleDone) {
20-
Image(systemName: "xmark")
21-
}
18+
Group {
19+
switch selectedTab {
20+
case .chat:
21+
QuickChatView(viewModel: viewModel.quickChatViewModel)
22+
case .bash:
23+
bashTab
24+
}
25+
}
26+
.navigationBarTitleDisplayMode(.inline)
27+
.toolbar {
28+
ToolbarItem(placement: .principal) {
29+
Picker("Tab", selection: $selectedTab) {
30+
Text("Quick Chat").tag(QuickActionsTab.chat)
31+
Text("Bash").tag(QuickActionsTab.bash)
2232
}
33+
.pickerStyle(.segmented)
34+
.frame(width: 200)
2335
}
24-
}
25-
}
26-
27-
private var tabs: some View {
28-
TabView(selection: $selectedTab) {
29-
QuickChatView(viewModel: viewModel.quickChatViewModel)
30-
.tabItem { Label("Quick Chat", systemImage: "bubble.left") }
31-
.tag(0)
32-
bashTab
33-
.tabItem { Label("Bash", systemImage: "terminal") }
34-
.tag(1)
36+
ToolbarItem(placement: .cancellationAction) {
37+
Button(action: handleDone) {
38+
Image(systemName: "xmark")
39+
}
40+
}
41+
}
3542
}
3643
}
3744

Wisp/Views/QuickActions/QuickChatView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct QuickChatView: View {
8787
.padding(.vertical, 8)
8888
.padding(.bottom, isRunningOnMac ? 12 : 0)
8989
}
90-
.background(Color(.systemBackground))
90+
.background(.clear)
9191
}
9292
}
9393

0 commit comments

Comments
 (0)