From 27890825d4c1b872798c4fbb920bdd611430774a Mon Sep 17 00:00:00 2001 From: kutesir Date: Fri, 29 May 2026 11:26:02 +0300 Subject: [PATCH] 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. --- KisaniCal/Views/TodayView.swift | 2 +- KisaniCal/Views/WorkoutView.swift | 47 ++++++++++++++++++------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/KisaniCal/Views/TodayView.swift b/KisaniCal/Views/TodayView.swift index 20104b4..4370e1b 100644 --- a/KisaniCal/Views/TodayView.swift +++ b/KisaniCal/Views/TodayView.swift @@ -1124,7 +1124,7 @@ struct DotGridProgress: View { } } -private struct DotRow: View { +struct DotRow: View { let cols: Int let rowStart: Int let filled: Int diff --git a/KisaniCal/Views/WorkoutView.swift b/KisaniCal/Views/WorkoutView.swift index e842684..0cc0958 100644 --- a/KisaniCal/Views/WorkoutView.swift +++ b/KisaniCal/Views/WorkoutView.swift @@ -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() } }