Open merge dialog instantly from pushed merge facts
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user