Sources/OrgstarMobile/AppSidebar.swift
29 lines · 1078 bytes
1 symbol in this file
1#if os(iOS)
2import OrgApp
3import SwiftUI
4
5/// The sidebar of a regular-width iPad window: the iPhone's tabs, search, and each added folder.
6struct AppSidebar: View {
7 let workspace: WorkspaceModel
8 @Binding var selection: AppTab
9
10 var body: some View {
11 List(selection: Binding<AppTab?> { selection } set: { if let new = $0 { selection = new } }) {
12 Section {
13 Label("Agenda", systemImage: "calendar").tag(AppTab.agenda)
14 Label("Search", systemImage: "magnifyingglass").tag(AppTab.search)
15 }
16 Section("Folders") {
17 Label("All Folders", systemImage: "folder").tag(AppTab.folders)
18 ForEach(workspace.rootPaths, id: \.self) { root in
19 Label((root as NSString).lastPathComponent, systemImage: "folder").tag(AppTab.folder(root))
20 }
21 }
22 Section {
23 Label("Settings", systemImage: "gearshape").tag(AppTab.settings)
24 }
25 }
26 .navigationTitle(Text(verbatim: "orgstar"))
27 }
28}
29#endif