Files
sure/bitrig/App/SureBudgetsView.swift
T
0aa43de10a Add experimental Swift-native Sure Insights app (#3134)
* Add Swift-native Sure app

* Fix push subscriptions schema for CI

* Address native app review feedback

* Address remaining native app review feedback

* Use Flutter app logo for native icon

* Honor insight notification preferences and locale

---------

Co-authored-by: Juan Jose Mata <2v8shcb6pz@privaterelay.appleid.com>
Co-authored-by: sure-admin <sure-admin@splashblot.com>
2026-08-25 04:16:24 +02:00

53 lines
1.7 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import SwiftUI
struct SureBudgetsView: View {
@Environment(SureStore.self) private var store
var body: some View {
NavigationStack {
ScrollView {
LazyVStack(spacing: 14) {
ForEach(store.budgets) { budget in
VStack(alignment: .leading, spacing: 12) {
HStack {
VStack(alignment: .leading, spacing: 3) {
Text(budget.name)
.font(.headline)
Text("\(budget.startDate) \(budget.endDate)")
.font(.caption)
.foregroundStyle(.secondary)
}
Spacer()
if budget.current {
Text("CURRENT")
.font(.caption2.bold())
.foregroundStyle(Color.sureMint)
}
}
Divider()
LabeledContent("Allocated", value: budget.allocatedSpending)
if let planned = budget.budgetedSpending {
LabeledContent("Planned", value: planned)
}
}
.padding(18)
.background(.background.secondary, in: .rect(cornerRadius: 18))
.accessibilityElement(children: .combine)
}
if store.budgets.isEmpty && !store.isLoading {
ContentUnavailableView(
"No budgets yet",
systemImage: "chart.pie",
description: Text("Create a budget in Sure to track it here.")
)
}
}
.frame(maxWidth: .infinity)
.padding()
}
.refreshable { await store.refreshAll() }
.navigationTitle("Budgets")
}
}
}