// // CreateWorkoutSupersetView.swift // Werkout_ios // // Created by Trey Tartt on 12/19/24. // import SwiftUI struct CreateWorkoutSupersetView: View { @Binding var selectedCreateWorkoutSuperSet: CreateWorkoutSuperSet? @Binding var showAddExercise: Bool @ObservedObject var superset: CreateWorkoutSuperSet @ObservedObject var viewModel: WorkoutViewModel var body: some View { Section(content: { AddSupersetView( createWorkoutSuperSet: superset, viewModel: viewModel, selectedCreateWorkoutSuperSet: $selectedCreateWorkoutSuperSet) }, header: { VStack { HStack { TextField("Superset Title", text: $superset.title) .font(.title2) } VStack { HStack { Text("Exercises: \(superset.exercises.count)") .font(.subheadline) .bold() Spacer() Button(action: { selectedCreateWorkoutSuperSet = superset showAddExercise = true }, label: { Image(systemName: "dumbbell.fill") .font(.title2) }) .accessibilityLabel("Add exercise") .accessibilityHint("Adds an exercise to this superset") Divider() Button(action: { viewModel.delete(superset: superset) }, label: { Image(systemName: "trash") .font(.title2) }) .accessibilityLabel("Delete superset") .accessibilityHint("Removes this superset") } Divider() Stepper(label: { HStack { Text("Rounds: ") Text("\(superset.numberOfRounds)") .foregroundColor(superset.numberOfRounds > 0 ? Color(uiColor: .label) : .red) .bold() } }, onIncrement: { superset.increaseNumberOfRounds() }, onDecrement: { superset.decreaseNumberOfRounds() }) } } }) } }