learning_ai_clock/ios/ChronoMind/Views/Components/CascadeProgressBar.swift
2026-02-27 21:15:30 -08:00

45 lines
1.4 KiB
Swift

// Cascade Progress Bar
import SwiftUI
struct CascadeProgressBar: View {
let fired: Int
let total: Int
let urgency: UrgencyLevel
private var progress: Double {
guard total > 0 else { return 0 }
return Double(fired) / Double(total)
}
var body: some View {
VStack(alignment: .leading, spacing: CMSpacing.xs) {
HStack {
Text("Cascade")
.font(CMFonts.body(size: 11, weight: .medium))
.foregroundStyle(CMColors.textMuted)
Spacer()
Text("\(fired)/\(total)")
.font(CMFonts.mono(size: 11))
.foregroundStyle(CMColors.textMuted)
}
GeometryReader { geo in
ZStack(alignment: .leading) {
RoundedRectangle(cornerRadius: 3)
.fill(CMColors.border)
.frame(height: 6)
RoundedRectangle(cornerRadius: 3)
.fill(CMColors.urgencyColor(urgency))
.frame(width: geo.size.width * progress, height: 6)
.animation(.easeInOut(duration: 0.3), value: progress)
}
}
.frame(height: 6)
}
}
}