spb/admin-ka-ios
Public
Swift 100%
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()1011 WebView(model: model)12 .ignoresSafeArea(.container, edges: .bottom)13 .opacity(model.loaded ? 1 : 0)1415 // barre de progression fine en haut pendant le chargement16 if !model.loaded && !model.failed {17 VStack(spacing: 0) {18 GeometryReader { geo in19 Rectangle()20 .fill(Ka.orange)21 .frame(width: geo.size.width * max(0.04, model.progress), height: 3)22 .animation(.easeOut(duration: 0.25), value: model.progress)23 }24 .frame(height: 3)25 Spacer()26 }27 }2829 if showSplash { splash.transition(.opacity) }30 if model.failed { offline }31 }32 .onChange(of: model.loaded) { loaded in33 if loaded {34 DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {35 withAnimation(.easeInOut(duration: 0.4)) { showSplash = false }36 }37 }38 }39 }4041 private var splash: some View {42 ZStack {43 Ka.bg.ignoresSafeArea()44 VStack(spacing: 18) {45 KaMark(size: 92)46 Text("Admin-Ka")47 .font(.system(size: 26, weight: .heavy, design: .rounded))48 .foregroundColor(Ka.ink)49 Text("Console Claude Code · Groupe KA")50 .font(.system(size: 13, weight: .semibold, design: .rounded))51 .foregroundColor(Ka.muted)52 if !model.failed {53 ProgressView().tint(Ka.orange).padding(.top, 6)54 }55 }56 }57 }5859 private var offline: some View {60 ZStack {61 Ka.bg.ignoresSafeArea()62 VStack(spacing: 16) {63 KaMark(size: 72)64 Text("Hors ligne")65 .font(.system(size: 22, weight: .heavy, design: .rounded))66 .foregroundColor(Ka.ink)67 Text("Impossible de joindre administration-ka.com")68 .font(.system(size: 14, weight: .medium, design: .rounded))69 .foregroundColor(Ka.muted)70 .multilineTextAlignment(.center)71 .padding(.horizontal, 40)72 Button {73 showSplash = true74 model.reload()75 } label: {76 Text("Réessayer")77 .font(.system(size: 16, weight: .heavy, design: .rounded))78 .foregroundColor(Ka.ink)79 .padding(.horizontal, 26).padding(.vertical, 13)80 .background(81 Capsule().fill(Ka.orange)82 .overlay(Capsule().strokeBorder(Ka.ink, lineWidth: 2))83 )84 .shadow(color: Ka.ink, radius: 0, x: 3, y: 3)85 }86 .padding(.top, 6)87 }88 }89 }90}91