Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(ui): dim the full screen behind confirmation dialogs

leepokai37b627eba2d7
diff --git a/apps/desktop/src/renderer/components/overlay.css b/apps/desktop/src/renderer/components/overlay.css
index a9bc6025..9979efb0 100644
--- a/apps/desktop/src/renderer/components/overlay.css
+++ b/apps/desktop/src/renderer/components/overlay.css
@@ -61,11 +61,12 @@
display: grid;
place-items: center;
opacity: 0;
- transform: scale(0.98);
- transition: opacity var(--fade), transform var(--fade);
+ transition: opacity var(--fade);
}
.dialog.shown {
opacity: 1;
+}
+.dialog.shown .dialog-card {
transform: none;
}
.dialog-dim {
@@ -75,6 +76,8 @@
}
.dialog-card {
position: relative;
+ transform: scale(0.98);
+ transition: transform var(--fade);
width: min(320px, calc(100vw - 48px));
padding: 18px;
background: var(--bubble-agent);
diff --git a/apps/ios/Kit/Sources/CodyncUI/Chrome.swift b/apps/ios/Kit/Sources/CodyncUI/Chrome.swift
index e7467150..3f779e7e 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Chrome.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Chrome.swift
@@ -226,11 +226,17 @@ private struct FadeLayer<Layer: View>: View {
@Environment(\.accessibilityReduceMotion) private var reduceMotion
var body: some View {
- layer(animateClose)
- .environment(\.dismissModal, DismissModalAction { animateClose() })
- .opacity(shown ? 1 : 0)
- .scaleEffect(shown ? 1 : 0.98)
- .onAppear { withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { shown = true } }
+ GeometryReader { geometry in
+ layer(animateClose)
+ .environment(\.dismissModal, DismissModalAction { animateClose() })
+ // Preserve safe areas for controls (including the screen viewer's toolbar),
+ // but composite the fade over the whole screen so the scrim cannot be clipped.
+ .safeAreaPadding(geometry.safeAreaInsets)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .opacity(shown ? 1 : 0)
+ .ignoresSafeArea(.container)
+ }
+ .onAppear { withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { shown = true } }
}
private func animateClose() {
diff --git a/apps/ios/Kit/Sources/CodyncUI/Controls.swift b/apps/ios/Kit/Sources/CodyncUI/Controls.swift
index 76981f41..e554a6fe 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Controls.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Controls.swift
@@ -539,133 +539,6 @@ public struct Disclosure<Label: View, Content: View>: View {
}
}
-// MARK: - Dialogs
-
-/// A button in a Codync dialog.
-public struct DialogAction: Identifiable {
- public let id = UUID()
- public var title: String
- public var destructive: Bool
- public var action: () -> Void
-
- public init(_ title: String, destructive: Bool = false, action: @escaping () -> Void) {
- self.title = title
- self.destructive = destructive
- self.action = action
- }
-}
-
-public extension View {
- /// A centered card over a dimmed screen with the actions and Cancel:
- /// the replacement for `confirmationDialog` and `alert`.
- /// Set `inPlace` only at the navigation root to keep underlying glass unchanged.
- func codyncDialog(_ title: String, isPresented: Binding<Bool>, message: String? = nil,
- cancel: String? = "Cancel", inPlace: Bool = false,
- actions: @escaping () -> [DialogAction]) -> some View {
- modifier(CodyncDialog(title: title, message: message, cancel: cancel, inPlace: inPlace,
- isPresented: isPresented, actions: actions))
- }
-}
-
-private struct CodyncDialog: ViewModifier {
- let title: String
- let message: String?
- let cancel: String?
- /// Use only above the navigation container so the scrim also covers its toolbar.
- let inPlace: Bool
- @Binding var isPresented: Bool
- let actions: () -> [DialogAction]
- @Environment(\.accessibilityReduceMotion) private var reduceMotion
-
- func body(content: Content) -> some View {
- if inPlace {
- content
- .allowsHitTesting(!isPresented)
- .accessibilityHidden(isPresented)
- .overlay {
- if isPresented {
- DialogCard(title: title, message: message, cancel: cancel, actions: actions()) {
- isPresented = false
- }
- .transition(.opacity)
- .onAppear {
- UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder),
- to: nil, from: nil, for: nil)
- }
- }
- }
- .animation(Motion.reduced(Motion.fade, reduceMotion), value: isPresented)
- } else {
- content.codyncOverlay(isPresented: $isPresented) { close in
- DialogCard(title: title, message: message, cancel: cancel, actions: actions(), dismiss: close)
- }
- }
- }
-}
-
-private struct DialogCard: View {
- let title: String
- let message: String?
- let cancel: String?
- let actions: [DialogAction]
- let dismiss: () -> Void
-
- var body: some View {
- ZStack {
- Color.black.opacity(0.35).ignoresSafeArea()
- .onTapGesture { if cancel != nil { dismiss() } }
- VStack(spacing: 14) {
- VStack(spacing: 6) {
- Text(title).font(.headline).foregroundStyle(Palette.text)
- if let message, !message.isEmpty {
- Text(message).font(.subheadline).foregroundStyle(Palette.secondary)
- }
- }
- .multilineTextAlignment(.center)
- VStack(spacing: 8) {
- ForEach(actions) { action in
- Button {
- dismiss()
- action.action()
- } label: {
- Text(action.title).frame(maxWidth: .infinity)
- }
- .buttonStyle(DialogButtonStyle(destructive: action.destructive, prominent: true))
- }
- if let cancel {
- Button(action: dismiss) { Text(cancel).frame(maxWidth: .infinity) }
- .buttonStyle(DialogButtonStyle(destructive: false, prominent: false))
- .keyboardShortcut(.cancelAction)
- }
- }
- }
- .padding(18)
- .frame(maxWidth: 320)
- .background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 22, style: .continuous))
- .shadow(color: .black.opacity(0.25), radius: 24, y: 10)
- .padding(24)
- }
- .accessibilityAddTraits(.isModal)
- }
-}
-
-private struct DialogButtonStyle: ButtonStyle {
- let destructive: Bool
- let prominent: Bool
-
- func makeBody(configuration: Configuration) -> some View {
- configuration.label
- .font(.body.weight(.medium))
- .foregroundStyle(destructive ? Color.white : (prominent ? Palette.onAccent : Palette.text))
- .padding(.vertical, 12)
- .background(destructive ? Palette.danger : (prominent ? Palette.accentFill : Palette.bubbleUser), in: Capsule())
- .opacity(configuration.isPressed ? 0.85 : 1)
- .scaleEffect(configuration.isPressed ? Motion.pressScale : 1)
- .animation(Motion.press, value: configuration.isPressed)
- .contentShape(Capsule())
- }
-}
-
// MARK: - Shared bits
extension View {
diff --git a/apps/ios/Kit/Sources/CodyncUI/Dialog.swift b/apps/ios/Kit/Sources/CodyncUI/Dialog.swift
new file mode 100644
index 00000000..3b39a9dc
--- /dev/null
+++ b/apps/ios/Kit/Sources/CodyncUI/Dialog.swift
@@ -0,0 +1,131 @@
+import CodyncKit
+import SwiftUI
+import UIKit
+
+// MARK: - Dialogs
+
+/// A button in a Codync dialog.
+public struct DialogAction: Identifiable {
+ public let id = UUID()
+ public var title: String
+ public var destructive: Bool
+ public var action: () -> Void
+
+ public init(_ title: String, destructive: Bool = false, action: @escaping () -> Void) {
+ self.title = title
+ self.destructive = destructive
+ self.action = action
+ }
+}
+
+public extension View {
+ /// A centered card over a dimmed screen with the actions and Cancel:
+ /// the replacement for `confirmationDialog` and `alert`.
+ /// Set `inPlace` only at the navigation root to keep underlying glass unchanged.
+ func codyncDialog(_ title: String, isPresented: Binding<Bool>, message: String? = nil,
+ cancel: String? = "Cancel", inPlace: Bool = false,
+ actions: @escaping () -> [DialogAction]) -> some View {
+ modifier(CodyncDialog(title: title, message: message, cancel: cancel, inPlace: inPlace,
+ isPresented: isPresented, actions: actions))
+ }
+}
+
+private struct CodyncDialog: ViewModifier {
+ let title: String
+ let message: String?
+ let cancel: String?
+ /// Use only above the navigation container so the scrim also covers its toolbar.
+ let inPlace: Bool
+ @Binding var isPresented: Bool
+ let actions: () -> [DialogAction]
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ func body(content: Content) -> some View {
+ if inPlace {
+ content
+ .allowsHitTesting(!isPresented)
+ .accessibilityHidden(isPresented)
+ .overlay {
+ if isPresented {
+ DialogCard(title: title, message: message, cancel: cancel, actions: actions()) {
+ isPresented = false
+ }
+ .ignoresSafeArea(.container)
+ .transition(.opacity)
+ .onAppear {
+ UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder),
+ to: nil, from: nil, for: nil)
+ }
+ }
+ }
+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: isPresented)
+ } else {
+ content.codyncOverlay(isPresented: $isPresented) { close in
+ DialogCard(title: title, message: message, cancel: cancel, actions: actions(), dismiss: close)
+ }
+ }
+ }
+}
+
+private struct DialogCard: View {
+ let title: String
+ let message: String?
+ let cancel: String?
+ let actions: [DialogAction]
+ let dismiss: () -> Void
+
+ var body: some View {
+ ZStack {
+ Color.black.opacity(0.35).ignoresSafeArea()
+ .onTapGesture { if cancel != nil { dismiss() } }
+ VStack(spacing: 14) {
+ VStack(spacing: 6) {
+ Text(title).font(.headline).foregroundStyle(Palette.text)
+ if let message, !message.isEmpty {
+ Text(message).font(.subheadline).foregroundStyle(Palette.secondary)
+ }
+ }
+ .multilineTextAlignment(.center)
+ VStack(spacing: 8) {
+ ForEach(actions) { action in
+ Button {
+ dismiss()
+ action.action()
+ } label: {
+ Text(action.title).frame(maxWidth: .infinity)
+ }
+ .buttonStyle(DialogButtonStyle(destructive: action.destructive, prominent: true))
+ }
+ if let cancel {
+ Button(action: dismiss) { Text(cancel).frame(maxWidth: .infinity) }
+ .buttonStyle(DialogButtonStyle(destructive: false, prominent: false))
+ .keyboardShortcut(.cancelAction)
+ }
+ }
+ }
+ .padding(18)
+ .frame(maxWidth: 320)
+ .background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 22, style: .continuous))
+ .shadow(color: .black.opacity(0.25), radius: 24, y: 10)
+ .padding(24)
+ }
+ .accessibilityAddTraits(.isModal)
+ }
+}
+
+private struct DialogButtonStyle: ButtonStyle {
+ let destructive: Bool
+ let prominent: Bool
+
+ func makeBody(configuration: Configuration) -> some View {
+ configuration.label
+ .font(.body.weight(.medium))
+ .foregroundStyle(destructive ? Color.white : (prominent ? Palette.onAccent : Palette.text))
+ .padding(.vertical, 12)
+ .background(destructive ? Palette.danger : (prominent ? Palette.accentFill : Palette.bubbleUser), in: Capsule())
+ .opacity(configuration.isPressed ? 0.85 : 1)
+ .scaleEffect(configuration.isPressed ? Motion.pressScale : 1)
+ .animation(Motion.press, value: configuration.isPressed)
+ .contentShape(Capsule())
+ }
+}