feat: add habit creation, savings tabs, fix dashboard, fix tab order
This commit is contained in:
@@ -5,7 +5,6 @@ struct DashboardView: View {
|
||||
@State private var tasks: [PulseTask] = []
|
||||
@State private var habits: [Habit] = []
|
||||
@State private var readiness: ReadinessResponse?
|
||||
@State private var summary: FinanceSummary?
|
||||
@State private var isLoading = true
|
||||
|
||||
var greeting: String {
|
||||
@@ -66,8 +65,8 @@ struct DashboardView: View {
|
||||
HStack(spacing: 12) {
|
||||
StatCard(icon: "checkmark.circle.fill", value: "\(pendingTasks.count)", label: "Задач", color: "00d4aa")
|
||||
StatCard(icon: "flame.fill", value: "\(completedHabitsToday)/\(habits.count)", label: "Привычек", color: "ffa502")
|
||||
if let s = summary, let balance = s.balance {
|
||||
StatCard(icon: "rublesign.circle.fill", value: "\(Int(balance))₽", label: "Финансы", color: "7c3aed")
|
||||
if let r = readiness {
|
||||
StatCard(icon: "heart.fill", value: "\(r.score)", label: "Готовность", color: r.score >= 80 ? "00d4aa" : r.score >= 60 ? "ffa502" : "ff4757")
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
@@ -109,11 +108,9 @@ struct DashboardView: View {
|
||||
async let t = APIService.shared.getTodayTasks(token: authManager.token)
|
||||
async let h = APIService.shared.getHabits(token: authManager.token)
|
||||
async let r = HealthAPIService.shared.getReadiness(apiKey: authManager.healthApiKey)
|
||||
async let s = APIService.shared.getFinanceSummary(token: authManager.token)
|
||||
tasks = (try? await t) ?? []
|
||||
habits = (try? await h) ?? []
|
||||
readiness = try? await r
|
||||
summary = try? await s
|
||||
isLoading = false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user