The general category (Appearance, Offline & Sync, Advanced, About) sat unlabeled at the top of the sidebar, ambiguous next to the named Outline categories below it. Now has its own "Outpost" header.
58 lines
1.9 KiB
Swift
58 lines
1.9 KiB
Swift
#if os(macOS)
|
|
import SwiftUI
|
|
|
|
/// Swapped into the real sidebar's content slot (search field, collections
|
|
/// tree, account footer) while Settings is open — same sidebar, different
|
|
/// content, rather than a separate mini sidebar nested inside a page. "Done"
|
|
/// clears `AppNavigation.isShowingSettings`, which puts the collections tree
|
|
/// back.
|
|
///
|
|
/// Grouped by `SettingsCategory` — `general` (ours) sits under an "Outpost"
|
|
/// header at the top, then Outline's own Account/Workspace/Integrations &
|
|
/// Installation groups, matching the settings page structure of the
|
|
/// Outline web app.
|
|
struct SettingsSidebarList: View {
|
|
@Binding var selection: SettingsSection?
|
|
let onDone: () -> Void
|
|
|
|
var body: some View {
|
|
VStack(spacing: 0) {
|
|
HStack {
|
|
Text("Settings")
|
|
.font(.headline)
|
|
Spacer()
|
|
}
|
|
.padding(.horizontal, 16)
|
|
.padding(.vertical, 12)
|
|
|
|
Divider()
|
|
|
|
List(selection: $selection) {
|
|
ForEach(SettingsCategory.allCases) { category in
|
|
let sections = SettingsSection.allCases.filter { $0.category == category }
|
|
Section {
|
|
ForEach(sections) { section in
|
|
Label(section.title, systemImage: section.icon)
|
|
.tag(section)
|
|
}
|
|
} header: {
|
|
if let title = category.title {
|
|
Text(title)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.listStyle(.sidebar)
|
|
|
|
Divider()
|
|
|
|
Button("Done", action: onDone)
|
|
.keyboardShortcut(.cancelAction)
|
|
.buttonStyle(.borderedProminent)
|
|
.frame(maxWidth: .infinity)
|
|
.padding(12)
|
|
}
|
|
}
|
|
}
|
|
#endif
|