Open Settings in its own roomy window, not the cramped popover
Settings was a NavigationLink pushed inside the 320pt menu-bar popover, so the grouped form was cramped and most controls sat below a non-obvious scroll (and showed a confusing "< Settings" back arrow). Add SettingsWindow (same standalone NSWindow pattern as the Editor/Templates windows) and open it from the menu-bar "Settings…" button. Drop the now-unused NavigationStack and the 320pt cap so the form uses real window width with normal macOS spacing; window is resizable.
This commit is contained in:
@@ -31,6 +31,35 @@ final class EditorWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Hosts the app Settings in a standalone resizable window. Far roomier than the
|
||||||
|
/// old in-popover NavigationLink, which cramped the form into the 320pt menu-bar
|
||||||
|
/// panel and hid most controls below a non-obvious scroll.
|
||||||
|
@MainActor
|
||||||
|
final class SettingsWindow {
|
||||||
|
static let shared = SettingsWindow()
|
||||||
|
private var window: NSWindow?
|
||||||
|
|
||||||
|
func show(settings: AppSettings) {
|
||||||
|
if let window {
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
window.makeKeyAndOrderFront(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let w = NSWindow(
|
||||||
|
contentRect: NSRect(x: 0, y: 0, width: 520, height: 660),
|
||||||
|
styleMask: [.titled, .closable, .resizable, .miniaturizable],
|
||||||
|
backing: .buffered, defer: false)
|
||||||
|
w.title = "Settings"
|
||||||
|
w.isReleasedWhenClosed = false
|
||||||
|
w.center()
|
||||||
|
w.contentViewController = NSHostingController(
|
||||||
|
rootView: SettingsView().environmentObject(settings))
|
||||||
|
window = w
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
w.makeKeyAndOrderFront(nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Hosts the recap-templates manager in its own resizable window.
|
/// Hosts the recap-templates manager in its own resizable window.
|
||||||
@MainActor
|
@MainActor
|
||||||
final class TemplatesWindow {
|
final class TemplatesWindow {
|
||||||
|
|||||||
@@ -10,21 +10,19 @@ struct MenuBarView: View {
|
|||||||
@EnvironmentObject private var session: SessionController
|
@EnvironmentObject private var session: SessionController
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
VStack(alignment: .leading, spacing: 12) {
|
||||||
VStack(alignment: .leading, spacing: 12) {
|
header
|
||||||
header
|
Divider()
|
||||||
Divider()
|
recordingSection
|
||||||
recordingSection
|
Divider()
|
||||||
Divider()
|
permissionsSection
|
||||||
permissionsSection
|
Divider()
|
||||||
Divider()
|
backendSection
|
||||||
backendSection
|
Divider()
|
||||||
Divider()
|
footer
|
||||||
footer
|
|
||||||
}
|
|
||||||
.padding(14)
|
|
||||||
.frame(width: 320)
|
|
||||||
}
|
}
|
||||||
|
.padding(14)
|
||||||
|
.frame(width: 320)
|
||||||
.onAppear { permissions.refresh() }
|
.onAppear { permissions.refresh() }
|
||||||
.task { await refreshHealth() }
|
.task { await refreshHealth() }
|
||||||
}
|
}
|
||||||
@@ -227,9 +225,7 @@ struct MenuBarView: View {
|
|||||||
|
|
||||||
private var footer: some View {
|
private var footer: some View {
|
||||||
HStack {
|
HStack {
|
||||||
NavigationLink("Settings…") {
|
Button("Settings…") { SettingsWindow.shared.show(settings: settings) }
|
||||||
SettingsView()
|
|
||||||
}
|
|
||||||
Spacer()
|
Spacer()
|
||||||
Button("Quit") { NSApplication.shared.terminate(nil) }
|
Button("Quit") { NSApplication.shared.terminate(nil) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ struct SettingsView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.formStyle(.grouped)
|
.formStyle(.grouped)
|
||||||
.frame(width: 320)
|
.frame(minWidth: 460, idealWidth: 520, maxWidth: .infinity,
|
||||||
|
minHeight: 520, idealHeight: 660, maxHeight: .infinity)
|
||||||
.navigationTitle("Settings")
|
.navigationTitle("Settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user