diff --git a/NucleicRemote/NucleicRemote/Views/HomeView.swift b/NucleicRemote/NucleicRemote/Views/HomeView.swift index 643a0e9..6c240f7 100644 --- a/NucleicRemote/NucleicRemote/Views/HomeView.swift +++ b/NucleicRemote/NucleicRemote/Views/HomeView.swift @@ -36,7 +36,10 @@ struct HomeView: View { } var body: some View { - NavigationStack { + // Computed once and threaded down so the badge and grid agree on the streak and which + // days a freeze bridged. + let streak = streakState + return NavigationStack { ScrollView { VStack(alignment: .leading, spacing: 22) { HStack(alignment: .top) { @@ -45,14 +48,14 @@ struct HomeView: View { Text(subtitle).font(.subheadline).foregroundStyle(.secondary) } Spacer() - if streak > 0 { StreakBadge(days: streak) } + if streak.streak > 0 { StreakBadge(days: streak.streak, freezes: streak.availableFreezes) } } statCards VStack(alignment: .leading, spacing: 10) { Text("Activity").font(.headline) - ActivityGrid(activityByDay: activityByDay) + ActivityGrid(activityByDay: activityByDay, frozenDays: streak.frozenDays) } .frame(maxWidth: .infinity, alignment: .leading) .card()