This commit is contained in:
Trey t
2023-07-02 16:37:45 -05:00
parent 939ea16716
commit fbc1ada8c9
14 changed files with 535 additions and 24 deletions

View File

@@ -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()
}