Polish Power Mode UI buttons, backgrounds, and links
This commit is contained in:
parent
42cde699a8
commit
decc83acf8
@ -167,7 +167,7 @@ struct ConfigurationView: View {
|
|||||||
HStack {
|
HStack {
|
||||||
Text("Applications")
|
Text("Applications")
|
||||||
Spacer()
|
Spacer()
|
||||||
Button("Add…") {
|
AddIconButton(helpText: "Add application") {
|
||||||
loadInstalledApps()
|
loadInstalledApps()
|
||||||
isShowingAppPicker = true
|
isShowingAppPicker = true
|
||||||
}
|
}
|
||||||
@ -224,12 +224,9 @@ struct ConfigurationView: View {
|
|||||||
.textFieldStyle(.roundedBorder)
|
.textFieldStyle(.roundedBorder)
|
||||||
.onSubmit { addWebsite() }
|
.onSubmit { addWebsite() }
|
||||||
|
|
||||||
Button {
|
AddIconButton(helpText: "Add website", isDisabled: newWebsiteURL.isEmpty) {
|
||||||
addWebsite()
|
addWebsite()
|
||||||
} label: {
|
|
||||||
Image(systemName: "plus")
|
|
||||||
}
|
}
|
||||||
.disabled(newWebsiteURL.isEmpty)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if websiteConfigs.isEmpty {
|
if websiteConfigs.isEmpty {
|
||||||
@ -451,21 +448,19 @@ struct ConfigurationView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.formStyle(.grouped)
|
.formStyle(.grouped)
|
||||||
|
.scrollContentBackground(.hidden)
|
||||||
|
.background(Color(NSColor.controlBackgroundColor))
|
||||||
.navigationTitle(mode.title)
|
.navigationTitle(mode.title)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .cancellationAction) {
|
|
||||||
Button("Cancel") {
|
|
||||||
presentationMode.wrappedValue.dismiss()
|
|
||||||
}
|
|
||||||
.keyboardShortcut(.escape, modifiers: [])
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolbarItem(placement: .primaryAction) {
|
ToolbarItem(placement: .primaryAction) {
|
||||||
Button(mode.isAdding ? "Add" : "Save") {
|
Button("Save") {
|
||||||
saveConfiguration()
|
saveConfiguration()
|
||||||
}
|
}
|
||||||
.keyboardShortcut(.defaultAction)
|
.keyboardShortcut(.defaultAction)
|
||||||
.disabled(!canSave)
|
.disabled(!canSave)
|
||||||
|
.buttonStyle(.bordered)
|
||||||
|
.controlSize(.regular)
|
||||||
|
.padding(.horizontal, 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
if case .edit = mode {
|
if case .edit = mode {
|
||||||
@ -473,6 +468,9 @@ struct ConfigurationView: View {
|
|||||||
Button("Delete", role: .destructive) {
|
Button("Delete", role: .destructive) {
|
||||||
isShowingDeleteConfirmation = true
|
isShowingDeleteConfirmation = true
|
||||||
}
|
}
|
||||||
|
.buttonStyle(.bordered)
|
||||||
|
.controlSize(.regular)
|
||||||
|
.padding(.horizontal, 4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,7 +80,7 @@ struct PowerModeView: View {
|
|||||||
InfoTip(
|
InfoTip(
|
||||||
title: "What is Power Mode?",
|
title: "What is Power Mode?",
|
||||||
message: "Automatically apply custom configurations based on the app/website you are using",
|
message: "Automatically apply custom configurations based on the app/website you are using",
|
||||||
learnMoreURL: "https://www.youtube.com/@tryvoiceink/videos"
|
learnMoreURL: "https://tryvoiceink.com/docs/power-mode"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,26 @@ struct PowerModeConfigurationsGrid: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Small, consistent icon-only add button used across Power Mode configuration rows.
|
||||||
|
struct AddIconButton: View {
|
||||||
|
let helpText: String
|
||||||
|
var isDisabled: Bool = false
|
||||||
|
let action: () -> Void
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Button(action: action) {
|
||||||
|
Image(systemName: "plus.circle.fill")
|
||||||
|
.font(.system(size: 18))
|
||||||
|
.symbolRenderingMode(.hierarchical)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.help(helpText)
|
||||||
|
.accessibilityLabel(helpText)
|
||||||
|
.disabled(isDisabled)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct ConfigurationRow: View {
|
struct ConfigurationRow: View {
|
||||||
@Binding var config: PowerModeConfig
|
@Binding var config: PowerModeConfig
|
||||||
let isEditing: Bool
|
let isEditing: Bool
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user