1// Auteur : Simon-Pierre Boucher — contact@spboucher.ai2// ProfileView.swift — profil : KA ID (compte unique de l'écosystème), univers3// favoris, apparence, contacts complets du Groupe KA, pages légales, à propos.4import SwiftUI56struct ProfileView: View {7 @AppStorage("ka.favUniverses") private var favUniversesRaw = ""8 @AppStorage("ka.appearance") private var appearance = "auto"9 @Environment(\.colorScheme) private var scheme1011 private var favIDs: Set<String> {12 Set(favUniversesRaw.split(separator: ",").map(String.init))13 }1415 var body: some View {16 NavigationStack {17 List {18 Section {19 HStack(spacing: 14) {20 ZStack {21 RoundedRectangle(cornerRadius: 14, style: .continuous)22 .fill(KATheme.inkLight)23 .frame(width: 56, height: 56)24 Text("KA").font(.system(size: 22, weight: .bold, design: .rounded))25 .foregroundStyle(KATheme.lime)26 .rotationEffect(.degrees(-4))27 }28 VStack(alignment: .leading, spacing: 3) {29 Text("Votre KA ID").font(.headline)30 Text("Un seul compte pour tout l'écosystème — création et gestion sur groupe-ka.com.")31 .font(.caption).foregroundStyle(.secondary)32 }33 }34 Link(destination: Ecosystem.signupURL) {35 Label("Se connecter / créer un compte KA ID", systemImage: "person.crop.circle.badge.checkmark")36 }37 }3839 Section {40 ForEach(Ecosystem.all) { u in41 Button {42 var ids = favIDs43 if ids.contains(u.id) { ids.remove(u.id) } else { ids.insert(u.id) }44 favUniversesRaw = ids.sorted().joined(separator: ",")45 Haptics.tap()46 } label: {47 HStack {48 Image(systemName: u.symbol).foregroundStyle(u.accent).frame(width: 26)49 Text(u.name).foregroundStyle(.primary)50 Spacer()51 if favIDs.contains(u.id) {52 Image(systemName: "star.fill").foregroundStyle(.yellow)53 }54 }55 }56 }57 } header: {58 Text("Mes univers favoris")59 } footer: {60 Text("Vos univers favoris remontent en tête de l'accueil.")61 }6263 Section("Apparence") {64 Picker("Thème", selection: $appearance) {65 Text("Automatique").tag("auto")66 Text("Clair").tag("clair")67 Text("Sombre").tag("sombre")68 }69 }7071 Section("Joindre le Groupe KA") {72 ForEach(Ecosystem.contacts, id: \.email) { c in73 Link(destination: URL(string: "mailto:\(c.email)")!) {74 VStack(alignment: .leading, spacing: 2) {75 Text(c.email).font(.subheadline.weight(.semibold))76 Text(c.role).font(.caption).foregroundStyle(.secondary)77 }78 }79 }80 Link(destination: Ecosystem.hubURL) {81 Label("groupe-ka.com — le portail", systemImage: "globe")82 }83 Link(destination: Ecosystem.statusURL) {84 Label("État des services en direct", systemImage: "waveform.path.ecg")85 }86 }8788 Section("Légal") {89 ForEach(Ecosystem.legal, id: \.path) { l in90 Link(destination: Ecosystem.hubURL.appendingPathComponent(l.path)) {91 Text(l.label)92 }93 }94 Text(Ecosystem.disclaimer)95 .font(.caption2).foregroundStyle(.secondary)96 }9798 Section("À propos") {99 LabeledContent("Version", value: Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0")100 LabeledContent("Écosystème", value: "\(Ecosystem.all.count) univers")101 Text("KA — tout l'écosystème Groupe-KA dans votre poche. Fait au Québec. 💚")102 .font(.caption).foregroundStyle(.secondary)103 }104 }105 .navigationTitle("Profil")106 .scrollContentBackground(.hidden)107 .background(KATheme.paper(scheme))108 }109 }110}111