51 lines
1.5 KiB
Swift
51 lines
1.5 KiB
Swift
import SwiftUI
|
|
|
|
enum AppSection: String, CaseIterable, Hashable {
|
|
case dashboard = "Dashboard"
|
|
case oracle = "Oracle"
|
|
case sentinel = "Sentinel"
|
|
case inventory = "Inventory"
|
|
case settings = "Settings"
|
|
|
|
var systemImage: String {
|
|
switch self {
|
|
case .dashboard: return "square.grid.2x2"
|
|
case .oracle: return "message"
|
|
case .sentinel: return "person.crop.rectangle"
|
|
case .inventory: return "shippingbox"
|
|
case .settings: return "gearshape"
|
|
}
|
|
}
|
|
}
|
|
|
|
struct ContentView: View {
|
|
@State private var selectedSection: AppSection? = .dashboard
|
|
|
|
var body: some View {
|
|
NavigationSplitView {
|
|
List(AppSection.allCases, selection: $selectedSection) { section in
|
|
Label(section.rawValue, systemImage: section.systemImage)
|
|
.tag(section)
|
|
}
|
|
.navigationTitle("Velocity")
|
|
} detail: {
|
|
Group {
|
|
switch selectedSection {
|
|
case .dashboard: DashboardView()
|
|
case .oracle: OracleView()
|
|
case .sentinel: SentinelView()
|
|
case .inventory: InventoryView()
|
|
case .settings: SettingsView()
|
|
case .none: DashboardView()
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
.background(Color(uiColor: .systemGroupedBackground))
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
ContentView()
|
|
}
|