summaryrefslogblamecommitdiff
path: root/makima/ios/Sources/Makima/App/RootView.swift
blob: a7665e1abf2718308cd0ee61c0b1a6e8fa98261c (plain) (tree)
1
2
3
4
5
6
7
8
9
10

              
                                                                              
                   
                       

                                                 


                                                
 







                                          
                          






                                                                 













                                                         

     
import SwiftUI

/// Top-level router: Onboarding until we have a validated ServerProfile + API
/// key, then Home.
struct RootView: View {
    @Environment(AuthStore.self) private var auth

    var body: some View {
        ZStack {
            Palette.background.ignoresSafeArea()

            switch auth.state {
            case .needsOnboarding, .error:
                OnboardingFlow()
                    .transition(.opacity)
            case .validating:
                ValidatingView()
                    .transition(.opacity)
            case .authenticated:
                HomeView()
                    .transition(.opacity)
            }
        }
        .animation(.easeInOut(duration: 0.25), value: auth.state)
    }
}

struct ValidatingView: View {
    var body: some View {
        VStack(spacing: 16) {
            Spacer()
            Logo(size: 80)
            ProgressView()
                .progressViewStyle(.circular)
                .tint(Palette.accent)
            Text("CONNECTING…")
                .font(Typography.navLabel)
                .tracking(2)
                .foregroundStyle(Palette.foregroundMuted)
            Spacer()
        }
    }
}