Lots of UI quality of life changes.

This commit is contained in:
Max Goedjen
2020-09-10 23:07:31 -07:00
parent 78dc4c0d93
commit c2fc71d299
7 changed files with 70 additions and 65 deletions

View File

@@ -91,8 +91,12 @@ struct ContentView<UpdaterType: UpdaterProtocol, AgentStatusCheckerType: AgentSt
}
func updateNotice() -> ToolbarItem<Void, AnyView> {
let update = updater.update ?? Release(name: "", html_url: URL(string:"https://example.com")!, body: "")
// guard let update = updater.update else { fatalError() }
// let update = updater.update ?? Release(name: "", html_url: URL(string:"https://example.com")!, body: "")
guard let update = updater.update else {
return ToolbarItem {
AnyView(Spacer())
}
}
let color: Color
let text: String
if update.critical {

View File

@@ -33,16 +33,14 @@ struct CreateSecretView: View {
Spacer()
}
}
.onExitCommand(perform: dismissalBlock)
}
HStack {
Spacer()
Button(action: dismissalBlock) {
Text("Cancel")
}
Button(action: save) {
Text("Create")
}.disabled(name.isEmpty)
Button("Cancel", action: dismissalBlock)
.keyboardShortcut(.cancelAction)
Button("Create", action: save)
.disabled(name.isEmpty)
.keyboardShortcut(.defaultAction)
}
}.padding()
}

View File

@@ -43,14 +43,16 @@ struct DeleteSecretView<StoreType: SecretStoreModifiable>: View {
}
HStack {
Spacer()
Button(action: delete) {
Text("Delete")
}.disabled(confirm != secret.name)
Button(action: { self.dismissalBlock(false) }) {
Text("Don't Delete")
Button("Delete", action: delete)
.disabled(confirm != secret.name)
.keyboardShortcut(.delete)
Button("Don't Delete") {
self.dismissalBlock(false)
}
.keyboardShortcut(.cancelAction)
}
}.padding()
}
.padding()
.frame(minWidth: 400)
}

View File

@@ -1,14 +1,10 @@
import SwiftUI
import Brief
//struct UpdateView<UpdaterType: UpdaterProtocol>: View {
//
//
//}
struct UpdateDetailView: View {
struct UpdateDetailView<UpdaterType: Updater>: View {
private let update: Release
@EnvironmentObject var updater: UpdaterType
init(update: Release) {
self.update = update
@@ -22,11 +18,19 @@ struct UpdateDetailView: View {
attributedBody
}
}
Button(action: {
NSWorkspace.shared.open(update.html_url)
}, label: {
Text("Update")
})
HStack {
if !update.critical {
Button("Ignore") {
updater.ignore(release: update)
}
Spacer()
}
Button("Update") {
NSWorkspace.shared.open(update.html_url)
}
.keyboardShortcut(.defaultAction)
}
}
.padding()
.frame(maxWidth: 500)