feat(watch): add rest duration display in workout views

This commit is contained in:
2026-08-09 18:42:21 +02:00
parent a17ae0dea5
commit 098db881bb
3 changed files with 104 additions and 19 deletions
+25 -12
View File
@@ -165,18 +165,31 @@ struct WorkoutOverviewPage: View {
if let workout = workoutManager.selectedWorkout {
ForEach(Array(workout.sets.enumerated()), id: \.offset) { i, set in
HStack {
Circle()
.fill(i < workoutManager.currentSetIndex ? .green :
i == workoutManager.currentSetIndex ? .cyan : .gray.opacity(0.4))
.frame(width: 8, height: 8)
Text("\(i + 1). \(set.stroke)")
.font(.caption)
.foregroundColor(i <= workoutManager.currentSetIndex ? .primary : .secondary)
Spacer()
Text("\(set.repCount)x\(set.distancePerRep)m")
.font(.caption2)
.foregroundColor(.secondary)
VStack(alignment: .leading, spacing: 2) {
HStack {
Circle()
.fill(i < workoutManager.currentSetIndex ? .green :
i == workoutManager.currentSetIndex ? .cyan : .gray.opacity(0.4))
.frame(width: 8, height: 8)
Text("\(i + 1). \(set.stroke)")
.font(.caption)
.foregroundColor(i <= workoutManager.currentSetIndex ? .primary : .secondary)
Spacer()
Text("\(set.repCount)x\(set.distancePerRep)m")
.font(.caption2)
.foregroundColor(.secondary)
}
if set.restType != "none", set.restDuration > 0 {
HStack(spacing: 2) {
Spacer().frame(width: 14)
Image(systemName: "clock")
.font(.caption2)
.foregroundColor(.orange)
Text(String(format: "%ds rest", Int(set.restDuration)))
.font(.caption2)
.foregroundColor(.orange)
}
}
}
}
}
+20 -7
View File
@@ -26,13 +26,26 @@ struct WorkoutDetailView: View {
Section("Sets") {
ForEach(Array(workout.sets.enumerated()), id: \.offset) { i, set in
HStack {
Text("\(i + 1). \(set.stroke)")
.font(.body)
Spacer()
Text("\(set.repCount)x\(set.distancePerRep)m")
.font(.caption)
.foregroundColor(.secondary)
VStack(alignment: .leading, spacing: 2) {
HStack {
Text("\(i + 1). \(set.stroke)")
.font(.body)
Spacer()
Text("\(set.repCount)x\(set.distancePerRep)m")
.font(.caption)
.foregroundColor(.secondary)
}
if set.restType != "none", set.restDuration > 0 {
HStack(spacing: 2) {
Spacer().frame(width: 14)
Image(systemName: "clock")
.font(.caption2)
.foregroundColor(.orange)
Text(String(format: "%ds rest", Int(set.restDuration)))
.font(.caption2)
.foregroundColor(.orange)
}
}
}
}
}