112 lines
3.5 KiB
Swift
112 lines
3.5 KiB
Swift
//
|
|
// CreateViewRepsWeightView.swift
|
|
// Werkout_ios
|
|
//
|
|
// Created by Trey Tartt on 6/18/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct CreateExerciseActionsView: View {
|
|
@ObservedObject var workoutExercise: CreateWorkoutExercise
|
|
var superset: CreateWorkoutSuperSet
|
|
var viewModel: WorkoutViewModel
|
|
|
|
var body: some View {
|
|
VStack {
|
|
HStack {
|
|
VStack {
|
|
VStack {
|
|
Text("Reps: ")
|
|
Text("\(workoutExercise.reps)")
|
|
.foregroundColor(workoutExercise.reps == 0 && workoutExercise.duration == 0 ? .red : Color(uiColor: .label))
|
|
.bold()
|
|
}
|
|
Stepper("", onIncrement: {
|
|
workoutExercise.increaseReps()
|
|
}, onDecrement: {
|
|
workoutExercise.decreaseReps()
|
|
})
|
|
.labelsHidden()
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
|
|
Divider()
|
|
|
|
VStack{
|
|
VStack {
|
|
Text("Weight: ")
|
|
Text("\(workoutExercise.weight)")
|
|
}
|
|
Stepper("", onIncrement: {
|
|
workoutExercise.increaseWeight()
|
|
}, onDecrement: {
|
|
workoutExercise.decreaseWeight()
|
|
})
|
|
.labelsHidden()
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
|
|
Divider()
|
|
|
|
VStack{
|
|
VStack {
|
|
Text("Duration: ")
|
|
Text("\(workoutExercise.duration)")
|
|
.foregroundColor(workoutExercise.reps == 0 && workoutExercise.duration == 0 ? .red : Color(uiColor: .label))
|
|
.bold()
|
|
}
|
|
Stepper("", onIncrement: {
|
|
workoutExercise.increaseDuration()
|
|
}, onDecrement: {
|
|
workoutExercise.decreaseDuration()
|
|
})
|
|
}
|
|
}
|
|
|
|
HStack {
|
|
Spacer()
|
|
Button(action: {
|
|
}) {
|
|
Image(systemName: "video.fill")
|
|
}
|
|
.frame(width: 88, height: 44)
|
|
.foregroundColor(.white)
|
|
.background(.blue)
|
|
.cornerRadius(10)
|
|
.buttonStyle(BorderlessButtonStyle())
|
|
|
|
Spacer()
|
|
|
|
Divider()
|
|
|
|
Spacer()
|
|
|
|
Button(action: {
|
|
superset.deleteExerciseForChosenSuperset(exercise: workoutExercise)
|
|
viewModel.increaseRandomNumberForUpdating()
|
|
viewModel.objectWillChange.send()
|
|
}) {
|
|
Image(systemName: "trash.fill")
|
|
}
|
|
.frame(width: 88, height: 44)
|
|
.foregroundColor(.white)
|
|
.background(.red)
|
|
.cornerRadius(10)
|
|
.buttonStyle(BorderlessButtonStyle())
|
|
|
|
Spacer()
|
|
}
|
|
|
|
Divider()
|
|
.background(.blue)
|
|
}
|
|
}
|
|
}
|
|
|
|
//struct CreateViewRepsWeightView_Previews: PreviewProvider {
|
|
// static var previews: some View {
|
|
// CreateViewRepsWeightView()
|
|
// }
|
|
//}
|