Unify workout progress: dot grid in WorkoutView + session sheet

Replace ProgressRingCard in WorkoutView with DotProgressCard using the
same dot grid as the workout session sheet. Remove private from DotRow
so it's accessible across view files.
This commit is contained in:
kutesir
2026-05-29 11:26:02 +03:00
parent 90d0a03eab
commit 27890825d4
2 changed files with 28 additions and 21 deletions

View File

@@ -1124,7 +1124,7 @@ struct DotGridProgress: View {
}
}
private struct DotRow: View {
struct DotRow: View {
let cols: Int
let rowStart: Int
let filled: Int

View File

@@ -38,8 +38,8 @@ struct WorkoutView: View {
.listRowInsets(EdgeInsets(top: 8, leading: 18, bottom: 4, trailing: 18))
.moveDisabled(true)
// Progress Ring
ProgressRingCard(progress: vm.progress, done: vm.doneSets, total: vm.totalSets)
// Dot Grid Progress
DotProgressCard(progress: vm.progress, done: vm.doneSets, total: vm.totalSets)
.listRowBackground(Color.clear)
.listRowSeparator(.hidden)
.listRowInsets(EdgeInsets(top: 0, leading: 14, bottom: 6, trailing: 14))
@@ -355,31 +355,38 @@ struct AddSectionSheet: View {
}
}
// MARK: - Progress Ring Card
struct ProgressRingCard: View {
// MARK: - Dot Progress Card
struct DotProgressCard: View {
@Environment(\.colorScheme) private var cs
let progress: Double; let done: Int; let total: Int
var pct: Int { Int(progress * 100) }
var body: some View {
HStack(spacing: 10) {
ZStack {
Circle().stroke(AppColors.borderHi(cs), lineWidth: 3.5).frame(width: 44, height: 44)
Circle().trim(from: 0, to: CGFloat(progress))
.stroke(AppColors.accent, style: StrokeStyle(lineWidth: 3.5, lineCap: .round))
.frame(width: 44, height: 44).rotationEffect(.degrees(-90))
.animation(KisaniSpring.entrance, value: progress)
Text("\(pct)%").font(AppFonts.mono(11, weight: .bold)).foregroundColor(AppColors.accent)
VStack(spacing: 10) {
HStack {
VStack(alignment: .leading, spacing: 2) {
Text("\(done) of \(total) sets done")
.font(AppFonts.sans(13, weight: .semibold))
.foregroundColor(AppColors.text(cs))
Text(total == 0 ? "Add exercises to get started"
: done == total && total > 0 ? "All sets done"
: "\(total - done) sets remaining")
.font(AppFonts.mono(9))
.foregroundColor(AppColors.text3(cs))
}
Spacer()
Text(total > 0 ? "\(Int(progress * 100))%" : "0%")
.font(AppFonts.mono(13, weight: .bold))
.foregroundColor(progress >= 1 ? AppColors.green : AppColors.text2(cs))
}
VStack(alignment: .leading, spacing: 2) {
Text("\(done) / \(total) sets done")
.font(AppFonts.sans(12.5, weight: .semibold)).foregroundColor(AppColors.text(cs))
Text(total == 0 ? "Add exercises to get started" : done == total && total > 0 ? "All sets done" : "\(total - done) sets remaining")
.font(AppFonts.sans(10)).foregroundColor(AppColors.text3(cs))
VStack(alignment: .leading, spacing: 6) {
Text("PROGRESS")
.font(AppFonts.mono(8, weight: .bold))
.foregroundColor(AppColors.text3(cs))
DotGridProgress(progress: total > 0 ? progress : 0, cs: cs)
}
Spacer()
}
.padding(10).cardStyle()
.padding(14)
.cardStyle()
}
}