phase two
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import SwiftUI
|
||||
|
||||
struct IOSRootView: View {
|
||||
@EnvironmentObject private var appState: AppState
|
||||
@EnvironmentObject private var workspaceStore: WorkspaceStore
|
||||
@State private var selection: IOSSection? = .dashboard
|
||||
|
||||
enum IOSSection: Hashable {
|
||||
case dashboard
|
||||
case projects
|
||||
case settings
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationSplitView {
|
||||
List(selection: $selection) {
|
||||
Section {
|
||||
Label("Dashboard", systemImage: "gauge.with.dots.needle.50percent")
|
||||
.tag(IOSSection.dashboard)
|
||||
Label("Projects", systemImage: "square.stack.3d.up")
|
||||
.tag(IOSSection.projects)
|
||||
}
|
||||
|
||||
Section("Workspace") {
|
||||
Picker("Workspace", selection: $workspaceStore.selectedWorkspaceID) {
|
||||
ForEach(workspaceStore.workspaces) { workspace in
|
||||
Text(workspace.name).tag(workspace.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
Label("Settings", systemImage: "gearshape")
|
||||
.tag(IOSSection.settings)
|
||||
}
|
||||
}
|
||||
.navigationTitle("SonarDesk")
|
||||
} detail: {
|
||||
switch selection ?? .dashboard {
|
||||
case .dashboard:
|
||||
IOSDashboardView()
|
||||
case .projects:
|
||||
IOSProjectsView()
|
||||
case .settings:
|
||||
IOSSettingsView()
|
||||
}
|
||||
}
|
||||
.task {
|
||||
if appState.selectedServer != nil && appState.projects.isEmpty {
|
||||
await appState.refresh()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user