Settings now swaps the actual app sidebar's content (search field, collections tree, account footer) for a section list, instead of SettingsView drawing its own nested sidebar inside the detail pane. Done, wherever it's triggered from, restores the collections tree and detail content exactly as they were. AppNavigation gains selectedSettingsSection (and the SettingsSection enum moves there, shared by the new list and the sidebar host) so the sidebar's list and the detail pane agree on which section is showing. Also deferred the profile menu's "Settings…" action by one runloop tick — setting isShowingSettings synchronously in the same call that dismisses the popover was very likely the source of the AppKit "CA commit" transaction warnings in the console.
39 lines
1.2 KiB
Swift
39 lines
1.2 KiB
Swift
import Observation
|
|
|
|
enum SettingsSection: String, CaseIterable, Identifiable, Hashable {
|
|
case appearance, account, offlineSync, about
|
|
|
|
var id: String { rawValue }
|
|
|
|
var title: String {
|
|
switch self {
|
|
case .appearance: return "Appearance"
|
|
case .account: return "Account"
|
|
case .offlineSync: return "Offline & Sync"
|
|
case .about: return "About"
|
|
}
|
|
}
|
|
|
|
var icon: String {
|
|
switch self {
|
|
case .appearance: return "paintbrush"
|
|
case .account: return "person.crop.circle"
|
|
case .offlineSync: return "arrow.triangle.2.circlepath"
|
|
case .about: return "info.circle"
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Cross-cutting UI state that doesn't belong to any one screen. Lives at
|
|
/// `OutpostApp` (so both `RootView`'s content and its `⌘,` command can reach
|
|
/// it) and is read wherever something needs to open Settings (the profile
|
|
/// menu) or render it — as a swap of the *existing* sidebar/detail panes in
|
|
/// `ContentView_macOS`, not a separate popup window or an overlay that hides
|
|
/// the sidebar.
|
|
@Observable
|
|
@MainActor
|
|
final class AppNavigation {
|
|
var isShowingSettings = false
|
|
var selectedSettingsSection: SettingsSection? = .appearance
|
|
}
|