SPB Git forge
2commits 1branches 0releases
180.0 KBsize
maindefault branch
1 mo agolast push
Swift 100%
2.6 KB · 66 lines swift
Raw Blame History
1import SwiftUI23struct RootView: View {4    @StateObject private var model = WebModel()5    @State private var showSplash = true67    var body: some View {8        ZStack {9            Ka.bg.ignoresSafeArea()10            WebView(model: model).opacity(model.loaded ? 1 : 0)1112            if !model.loaded && !model.failed {13                VStack(spacing: 0) {14                    GeometryReader { geo in15                        Rectangle().fill(Ka.orange)16                            .frame(width: geo.size.width * max(0.04, model.progress), height: 3)17                            .animation(.easeOut(duration: 0.25), value: model.progress)18                    }.frame(height: 3)19                    Spacer()20                }21            }22            if showSplash { splash.transition(.opacity) }23            if model.failed { offline }24        }25        .onChange(of: model.loaded) { loaded in26            if loaded {27                DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {28                    withAnimation(.easeInOut(duration: 0.4)) { showSplash = false }29                }30            }31        }32    }3334    private var splash: some View {35        ZStack {36            Ka.bg.ignoresSafeArea()37            VStack(spacing: 16) {38                KaMark(size: 88)39                Text("Admin-Ka").font(.system(size: 24, weight: .heavy, design: .rounded)).foregroundColor(Ka.ink)40                Text("Console Claude Code · Groupe KA")41                    .font(.system(size: 13, weight: .semibold, design: .rounded)).foregroundColor(Ka.muted)42                if !model.failed { ProgressView().controlSize(.small).padding(.top, 4) }43            }44        }45    }4647    private var offline: some View {48        ZStack {49            Ka.bg.ignoresSafeArea()50            VStack(spacing: 14) {51                KaMark(size: 68)52                Text("Hors ligne").font(.system(size: 20, weight: .heavy, design: .rounded)).foregroundColor(Ka.ink)53                Text("Impossible de joindre administration-ka.com")54                    .font(.system(size: 13, weight: .medium, design: .rounded)).foregroundColor(Ka.muted)55                Button {56                    showSplash = true; model.reload()57                } label: {58                    Text("Réessayer").font(.system(size: 14, weight: .heavy, design: .rounded))59                        .foregroundColor(Ka.ink).padding(.horizontal, 22).padding(.vertical, 10)60                        .background(Capsule().fill(Ka.orange).overlay(Capsule().strokeBorder(Ka.ink, lineWidth: 2)))61                }.buttonStyle(.plain).padding(.top, 4)62            }63        }64    }65}66