WIP
This commit is contained in:
@@ -18,6 +18,7 @@ struct WorkoutDetailView: View {
|
||||
}
|
||||
|
||||
@State var presentedSheet: Sheet?
|
||||
@State var workoutToPlan: Workout?
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
@@ -35,6 +36,8 @@ struct WorkoutDetailView: View {
|
||||
ActionsView(completedWorkout: {
|
||||
bridgeModule.workoutEndDate = Date()
|
||||
bridgeModule.sendWorkoutCompleteToWatch()
|
||||
}, planWorkout: { workout in
|
||||
workoutToPlan = workout
|
||||
}, workout: workout)
|
||||
.frame(height: 44)
|
||||
|
||||
@@ -49,6 +52,11 @@ struct WorkoutDetailView: View {
|
||||
})
|
||||
}
|
||||
}
|
||||
.sheet(item: $workoutToPlan) { workout in
|
||||
PlanWorkoutView(workout: workout, addedPlannedWorkout: {
|
||||
dismiss()
|
||||
})
|
||||
}
|
||||
.interactiveDismissDisabled()
|
||||
}
|
||||
}
|
||||
@@ -107,6 +115,7 @@ struct InfoView: View {
|
||||
struct ActionsView: View {
|
||||
@ObservedObject var bridgeModule = BridgeModule.shared
|
||||
var completedWorkout: (() -> Void)?
|
||||
var planWorkout: ((Workout) -> Void)?
|
||||
|
||||
var workout: Workout
|
||||
@Environment(\.dismiss) var dismiss
|
||||
@@ -126,6 +135,17 @@ struct ActionsView: View {
|
||||
.background(.red)
|
||||
.foregroundColor(.white)
|
||||
|
||||
Button(action: {
|
||||
planWorkout?(workout)
|
||||
}, label: {
|
||||
Image(systemName: "calendar.badge.plus")
|
||||
.font(.title)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
})
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(.blue)
|
||||
.foregroundColor(.white)
|
||||
|
||||
Button(action: {
|
||||
startWorkout()
|
||||
}, label: {
|
||||
@@ -162,8 +182,6 @@ struct ActionsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
func nextExercise() {
|
||||
bridgeModule.nextExercise()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user