cards-native/Sources/Features/Decks/DashboardView.swift
Till JS 28b20cd934 v0.1.0 — Phase β-0 Setup
Repo-Skelett für cards-native, native SwiftUI-Universal-App
für Cardecky (mana e.V.). Web-Parität zu cardecky.mana.how.

- project.yml mit Bundle ev.mana.cards, ManaSwiftCore-Dep via path
- AppConfig: auth.mana.how + cardecky-api.mana.how, Keychain ev.mana.cards
- CardsTheme: forest-Werte aus mana/packages/themes/.../forest.css
- LoginView (Email/PW gegen mana-auth via ManaCore.AuthClient)
- DashboardView als β-1-Placeholder mit cardecky-api-Reachability-Probe
- Log unter Subsystem ev.mana.cards
- 3 AppConfig-Tests
- iOS-Simulator-Build grün

Phasen-Plan: mana/docs/playbooks/CARDS_NATIVE_GREENFIELD.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 19:29:45 +02:00

58 lines
2 KiB
Swift

import ManaCore
import SwiftUI
/// Phase β-0-Placeholder. Wird in β-1 durch eine echte Tab-Bar mit
/// Decks / Study / Stats / Account ersetzt.
struct DashboardView: View {
@Environment(AuthClient.self) private var auth
@State private var apiReachable: Bool?
var body: some View {
ZStack {
CardsTheme.background.ignoresSafeArea()
VStack(spacing: 24) {
Text("Cards")
.font(.largeTitle.bold())
.foregroundStyle(CardsTheme.primary)
if let email = auth.currentEmail {
Text("Angemeldet als \(email)")
.font(.subheadline)
.foregroundStyle(CardsTheme.mutedForeground)
}
ContentUnavailableView {
Label("β-1 in Vorbereitung", systemImage: "rectangle.stack")
.foregroundStyle(CardsTheme.foreground)
} description: {
Text("Decks- und Study-Views kommen in der nächsten Phase.")
.foregroundStyle(CardsTheme.mutedForeground)
}
if let reachable = apiReachable {
Label(
reachable ? "cardecky-api erreichbar" : "cardecky-api nicht erreichbar",
systemImage: reachable ? "checkmark.circle.fill" : "xmark.circle.fill"
)
.foregroundStyle(reachable ? CardsTheme.success : CardsTheme.error)
.font(.footnote)
}
Button("Abmelden", role: .destructive) {
Task { await auth.signOut() }
}
.padding(.top, 24)
}
.padding(32)
}
.task {
let api = CardsAPI(auth: auth)
apiReachable = (try? await api.healthCheck()) ?? false
}
}
}
#Preview {
DashboardView()
.environment(AuthClient(config: AppConfig.manaAppConfig))
}