Open merge dialog instantly from pushed merge facts

This commit is contained in:
Ian Gulliver
2026-10-21 11:48:21 -07:00
parent 4bb6f1fa11
commit 890fb6b691
15 changed files with 736 additions and 678 deletions
+4 -4
View File
@@ -23,7 +23,7 @@ struct ModalButton {
struct OverlayModal {
let content: AnyView
let buttons: [ModalButton]
let buttons: @MainActor () -> [ModalButton]
let anchor: CGRect?
let inPane: Bool
let canSubmit: @MainActor () -> Bool
@@ -79,7 +79,7 @@ final class Overlays {
alerts.append(OverlayAlert(content: AnyView(content)))
}
func showModal(_ content: some View, _ buttons: [ModalButton], anchor: CGRect? = nil, inPane: Bool = false, canSubmit: @escaping @MainActor () -> Bool = { true }) async -> String {
func showModal(_ content: some View, _ buttons: @autoclosure @escaping @MainActor () -> [ModalButton], anchor: CGRect? = nil, inPane: Bool = false, canSubmit: @escaping @MainActor () -> Bool = { true }) async -> String {
modal?.done("cancel")
menu = nil
return await withCheckedContinuation { cont in
@@ -183,7 +183,7 @@ final class Overlays {
}
if let modal {
if enter && !marked {
if modal.canSubmit(), let last = modal.buttons.last {
if modal.canSubmit(), let last = modal.buttons().last {
answerModal(last.value)
}
return true
@@ -417,7 +417,7 @@ private struct ModalBox: View {
.fixedSize(horizontal: false, vertical: true)
HStack(spacing: 8) {
Spacer()
ForEach(Array(modal.buttons.enumerated()), id: \.offset) { _, b in
ForEach(Array(modal.buttons().enumerated()), id: \.offset) { _, b in
Button(b.label) {
answer(b.value)
}