29 lines
857 B
Swift
29 lines
857 B
Swift
// ContentView.swift
|
|
// -----------------
|
|
// Root view. Shows LoginView or DashboardView based on auth state.
|
|
|
|
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@EnvironmentObject private var auth: AuthManager
|
|
|
|
var body: some View {
|
|
Group {
|
|
if auth.isLoading && !auth.isAuthenticated {
|
|
// Splash / loading state on app launch
|
|
VStack(spacing: 16) {
|
|
Image(systemName: "checkmark.seal.fill")
|
|
.font(.system(size: 64))
|
|
.foregroundStyle(.blue)
|
|
ProgressView("Loading…")
|
|
}
|
|
} else if auth.isAuthenticated {
|
|
DashboardView()
|
|
} else {
|
|
LoginView()
|
|
}
|
|
}
|
|
.animation(.easeInOut(duration: 0.3), value: auth.isAuthenticated)
|
|
}
|
|
}
|