Streak Freeze Feature Implementation

Nucleic-Session: 89DB7BC1-F74C-4768-BC7B-25F898265E0E
This commit is contained in:
Nucleic
2026-06-26 01:18:24 -07:00
parent 09d4c80edf
commit e11fda7fa2
@@ -135,6 +135,8 @@ private struct StatCard: View {
/// A lightning bolt whose charge grows with the streak (mirrors the Mac StreakBadge). /// A lightning bolt whose charge grows with the streak (mirrors the Mac StreakBadge).
struct StreakBadge: View { struct StreakBadge: View {
let days: Int let days: Int
/// Streak freezes in reserve (one per five days), shown as a small snowflake tally.
var freezes: Int = 0
private var intensity: Double { min(1, Double(max(0, days - 1)) / 20) } private var intensity: Double { min(1, Double(max(0, days - 1)) / 20) }
var body: some View { var body: some View {
@@ -152,6 +154,14 @@ struct StreakBadge: View {
Text("\(days)").font(.headline.monospacedDigit()) Text("\(days)").font(.headline.monospacedDigit())
Text("day streak").font(.caption2).foregroundStyle(.secondary) Text("day streak").font(.caption2).foregroundStyle(.secondary)
} }
if freezes > 0 {
HStack(spacing: 2) {
Image(systemName: "snowflake")
Text("\(freezes)").monospacedDigit()
}
.font(.caption.weight(.semibold))
.foregroundStyle(Palette.frozen)
}
} }
.padding(.horizontal, 12).padding(.vertical, 8) .padding(.horizontal, 12).padding(.vertical, 8)
.background(Color(.secondarySystemBackground), in: Capsule()) .background(Color(.secondarySystemBackground), in: Capsule())