This commit is contained in:
Trey t
2023-06-25 22:00:59 -05:00
parent d055ed182d
commit f40c40c9bb
9 changed files with 220 additions and 87 deletions

View File

@@ -17,33 +17,6 @@ struct CreateWorkoutMainView: View {
TextField("Title", text: $viewModel.title)
.padding()
HStack {
Button("Add Superset", action: {
viewModel.addNewSuperset()
})
.frame(maxWidth: .infinity, alignment: .center)
.frame(height: 44)
.foregroundColor(.blue)
.background(.yellow)
.cornerRadius(8)
.padding()
.frame(maxWidth: .infinity)
Divider()
Button("Done", action: {
viewModel.uploadWorkout()
})
.frame(maxWidth: .infinity, alignment: .center)
.frame(height: 44)
.foregroundColor(.white)
.background(.blue)
.cornerRadius(8)
.padding()
.frame(maxWidth: .infinity)
}
.frame(height: 44)
List() {
ForEach($viewModel.superSets, id: \.id) { superset in
Section {
@@ -86,6 +59,35 @@ struct CreateWorkoutMainView: View {
}
.listRowSeparator(.hidden)
}
HStack {
Button("Add Superset", action: {
viewModel.addNewSuperset()
})
.frame(maxWidth: .infinity, alignment: .center)
.frame(height: 44)
.foregroundColor(.blue)
.background(.yellow)
.cornerRadius(8)
.padding()
.frame(maxWidth: .infinity)
Divider()
Button("Done", action: {
viewModel.uploadWorkout()
})
.frame(maxWidth: .infinity, alignment: .center)
.frame(height: 44)
.foregroundColor(.white)
.background(.blue)
.cornerRadius(8)
.padding()
.frame(maxWidth: .infinity)
.disabled(viewModel.title.isEmpty)
}
.frame(height: 44)
.padding(.bottom)
}
.sheet(isPresented: $showAddExercise) {
AddExerciseView(selectedWorkout: { exercise in

View File

@@ -22,26 +22,25 @@ struct CreateWorkoutSupersetActionsView: View {
Text("Add exercise")
.padding()
}
.frame(maxWidth: .infinity)
.foregroundColor(.white)
.background(.green)
.cornerRadius(10)
.frame(maxWidth: .infinity, alignment: .center)
.buttonStyle(BorderlessButtonStyle())
// Button(action: {
// if let selectedCreateWorkoutSuperSet = selectedCreateWorkoutSuperSet {
// viewModel.delete(superset: selectedCreateWorkoutSuperSet)
// viewModel.objectWillChange.send()
// }
// }) {
// Text("Delete superset")
// .padding()
// }
// .frame(maxWidth: .infinity)
// .foregroundColor(.white)
// .background(.red)
// .cornerRadius(10)
// .frame(maxWidth: .infinity, alignment: .center)
Button(action: {
viewModel.delete(superset: workoutSuperSet)
viewModel.objectWillChange.send()
}) {
Text("Delete superset")
.padding()
}
.foregroundColor(.white)
.background(.red)
.cornerRadius(10)
.frame(maxWidth: .infinity, alignment: .center)
.buttonStyle(BorderlessButtonStyle())
}
}
}