mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 18:18:43 +00:00
feat(bar-app): label settings clearly and confirm before quit
Rename the footer 'Alerts' button to 'Settings' (gear icon) since it opens all preferences including the appearance/theme picker, which was undiscoverable behind an alerts label. Add a confirmation to the Quit button so a stray click no longer closes the whole menu-bar app with no easy way back.
This commit is contained in:
@@ -9,6 +9,7 @@ struct BarMenuView: View {
|
|||||||
@ObservedObject var viewModel: BarViewModel
|
@ObservedObject var viewModel: BarViewModel
|
||||||
/// Drives the preferences sheet from the footer gear.
|
/// Drives the preferences sheet from the footer gear.
|
||||||
@State private var showingPrefs = false
|
@State private var showingPrefs = false
|
||||||
|
@State private var confirmingQuit = false
|
||||||
/// The prefs adapter the sheet edits; shares the standard suite with the
|
/// The prefs adapter the sheet edits; shares the standard suite with the
|
||||||
/// view model so a write-through is visible on the next poll.
|
/// view model so a write-through is visible on the next poll.
|
||||||
private let prefs = BarPreferences()
|
private let prefs = BarPreferences()
|
||||||
@@ -216,9 +217,9 @@ struct BarMenuView: View {
|
|||||||
Button {
|
Button {
|
||||||
showingPrefs = true
|
showingPrefs = true
|
||||||
} label: {
|
} label: {
|
||||||
Label("Alerts", systemImage: "bell.badge")
|
Label("Settings", systemImage: "gearshape")
|
||||||
}
|
}
|
||||||
.help("Configure alerts and the menu-bar glance")
|
.help("Settings — appearance/theme, menu-bar glance, and alerts")
|
||||||
Spacer()
|
Spacer()
|
||||||
Button {
|
Button {
|
||||||
viewModel.onOpen()
|
viewModel.onOpen()
|
||||||
@@ -226,12 +227,20 @@ struct BarMenuView: View {
|
|||||||
Image(systemName: "arrow.clockwise")
|
Image(systemName: "arrow.clockwise")
|
||||||
}
|
}
|
||||||
.help("Refresh")
|
.help("Refresh")
|
||||||
|
// Quit confirms first — a stray click here previously closed the whole
|
||||||
|
// app (removing the menu-bar item) with no easy way back.
|
||||||
Button {
|
Button {
|
||||||
NSApplication.shared.terminate(nil)
|
confirmingQuit = true
|
||||||
} label: {
|
} label: {
|
||||||
Image(systemName: "power")
|
Image(systemName: "power")
|
||||||
}
|
}
|
||||||
.help("Quit CCS Bar")
|
.help("Quit CCS Bar")
|
||||||
|
.confirmationDialog("Quit CCS Bar?", isPresented: $confirmingQuit) {
|
||||||
|
Button("Quit", role: .destructive) { NSApplication.shared.terminate(nil) }
|
||||||
|
Button("Cancel", role: .cancel) {}
|
||||||
|
} message: {
|
||||||
|
Text("This closes the menu-bar app. Reopen it from Applications.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.buttonStyle(.borderless)
|
.buttonStyle(.borderless)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
|
|||||||
Reference in New Issue
Block a user