ManaView (Guthaben + EUR + Topf-Split 80/5/5/5/5 + Bewegungen) + ManaBalanceRow + ManaFormat + ManaCreditsModel. Pendant zur Web-<ManaPage>. Konsumiert ManaCreditsClient (ManaCore), System-Styling, app-agnostisch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
32 lines
1 KiB
Swift
32 lines
1 KiB
Swift
import ManaCore
|
|
import SwiftUI
|
|
|
|
/// Kompakte Guthaben-Zeile für Account-/Settings-Screens: „Mana-Guthaben"
|
|
/// links, aktueller Wert + EUR-Gegenwert rechts. Zeigt „—", solange das
|
|
/// Guthaben noch nicht geladen ist. Tippbar machen die Apps via
|
|
/// `NavigationLink` zu `ManaView`.
|
|
public struct ManaBalanceRow: View {
|
|
private let balance: ManaCreditBalance?
|
|
|
|
public init(balance: ManaCreditBalance?) {
|
|
self.balance = balance
|
|
}
|
|
|
|
public var body: some View {
|
|
HStack {
|
|
Label("Mana-Guthaben", systemImage: "leaf.fill")
|
|
Spacer()
|
|
if let balance {
|
|
VStack(alignment: .trailing, spacing: 1) {
|
|
Text(ManaFormat.mana(balance.balance))
|
|
.font(.body.weight(.semibold))
|
|
Text(ManaFormat.euro(balance.balance))
|
|
.font(.caption2)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
} else {
|
|
Text("—").foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
}
|
|
}
|