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 cols: Int
let rowStart: Int let rowStart: Int
let filled: Int let filled: Int

View File

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