initial commit
This commit is contained in:
commit
8de962eeb8
44 changed files with 4843 additions and 0 deletions
53
MCMSMobileApp.swift
Normal file
53
MCMSMobileApp.swift
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct MCMSMobileApp: App {
|
||||
@State private var env = AppEnvironment()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
RootView()
|
||||
.environment(env)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Routes the app: no config → Settings; configured but signed out → Login;
|
||||
/// authenticated → main tabs.
|
||||
struct RootView: View {
|
||||
@Environment(AppEnvironment.self) private var env
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if !env.isConfigured {
|
||||
NavigationStack { SettingsView(isInitialSetup: true) }
|
||||
} else if !env.isAuthenticated {
|
||||
LoginView()
|
||||
} else if let connection = env.connection {
|
||||
MainTabView(connection: connection)
|
||||
} else {
|
||||
NavigationStack { SettingsView(isInitialSetup: true) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MainTabView: View {
|
||||
let connection: MCMSConnection
|
||||
|
||||
var body: some View {
|
||||
TabView {
|
||||
NavigationStack { DashboardView(connection: connection) }
|
||||
.tabItem { Label("Dashboard", systemImage: "chart.pie") }
|
||||
|
||||
NavigationStack { ONUListView(connection: connection) }
|
||||
.tabItem { Label("ONUs", systemImage: "point.3.connected.trianglepath.dotted") }
|
||||
|
||||
NavigationStack { OLTListView(connection: connection) }
|
||||
.tabItem { Label("OLTs", systemImage: "antenna.radiowaves.left.and.right") }
|
||||
|
||||
NavigationStack { SettingsView(isInitialSetup: false) }
|
||||
.tabItem { Label("Settings", systemImage: "gearshape") }
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue