WIP
This commit is contained in:
@@ -78,12 +78,18 @@ class BridgeModule: ObservableObject {
|
||||
timer?.invalidate()
|
||||
timer = nil
|
||||
|
||||
currentExerciseIdx += 1
|
||||
if let currentWorkout = currentWorkout {
|
||||
if currentExerciseIdx < currentWorkout.exercises.count {
|
||||
let nextExercise = currentWorkout.exercises[currentExerciseIdx]
|
||||
updateCurrent(exercise: nextExercise)
|
||||
}
|
||||
nextExercise()
|
||||
}
|
||||
}
|
||||
|
||||
func nextExercise() {
|
||||
currentExerciseIdx += 1
|
||||
if let currentWorkout = currentWorkout {
|
||||
if currentExerciseIdx < currentWorkout.exercises.count {
|
||||
let nextExercise = currentWorkout.exercises[currentExerciseIdx]
|
||||
updateCurrent(exercise: nextExercise)
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,17 +19,18 @@ struct WorkoutDetailView: View {
|
||||
Text("Loading")
|
||||
case .showWorkout(let workout):
|
||||
VStack {
|
||||
TopButtonsView(workout: workout)
|
||||
.frame(height: 88)
|
||||
|
||||
|
||||
Text(workout.name)
|
||||
.font(.title3)
|
||||
.padding()
|
||||
if let desc = workout.description {
|
||||
Text(desc)
|
||||
.font(.body)
|
||||
}
|
||||
CurrentWorkoutElapsedTimeView()
|
||||
ExerciseListView(workout: workout)
|
||||
ActionsView(workout: workout)
|
||||
.frame(height: 44)
|
||||
CountdownView()
|
||||
}
|
||||
.interactiveDismissDisabled()
|
||||
@@ -38,7 +39,7 @@ struct WorkoutDetailView: View {
|
||||
}
|
||||
}
|
||||
|
||||
struct TopButtonsView: View {
|
||||
struct ActionsView: View {
|
||||
@ObservedObject var bridgeModule = BridgeModule.shared
|
||||
var workout: Workout
|
||||
@Environment(\.dismiss) var dismiss
|
||||
@@ -69,6 +70,17 @@ struct TopButtonsView: View {
|
||||
.background(.green)
|
||||
.foregroundColor(.white)
|
||||
} else {
|
||||
Button(action: {
|
||||
bridgeModule.nextExercise()
|
||||
}, label: {
|
||||
Image(systemName: "arrow.forward")
|
||||
.font(.title)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
})
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(.yellow)
|
||||
.foregroundColor(.white)
|
||||
|
||||
Button(action: {
|
||||
bridgeModule.completeWorkout()
|
||||
dismiss()
|
||||
|
||||
Reference in New Issue
Block a user