UI changes

This commit is contained in:
Trey t
2024-12-19 21:57:59 -06:00
parent b268a271fd
commit 85ef3d58c6
19 changed files with 268 additions and 184 deletions

View File

@@ -0,0 +1,36 @@
//
// AddSupersetView.swift
// Werkout_ios
//
// Created by Trey Tartt on 12/18/24.
//
import SwiftUI
struct AddSupersetView: View {
@Binding var createWorkoutSuperSet: CreateWorkoutSuperSet
var viewModel: WorkoutViewModel
@Binding var selectedCreateWorkoutSuperSet: CreateWorkoutSuperSet?
var body: some View {
VStack {
ForEach(createWorkoutSuperSet.exercises, id: \.id) { createWorkoutExercise in
HStack {
VStack {
Text(createWorkoutExercise.exercise.name)
.font(.title2)
.frame(maxWidth: .infinity)
if createWorkoutExercise.exercise.side != nil && createWorkoutExercise.exercise.side!.count > 0 {
Text(createWorkoutExercise.exercise.side!)
.font(.title3)
.frame(maxWidth: .infinity, alignment: .center)
}
CreateExerciseActionsView(workoutExercise: createWorkoutExercise,
superset: createWorkoutSuperSet,
viewModel: viewModel)
}
}
}
}
}
}

View File

@@ -27,11 +27,12 @@ struct AllExerciseView: View {
var body: some View {
VStack {
TextField("Filter", text: $searchString)
.padding()
.padding(.horizontal)
.textFieldStyle(.roundedBorder)
List() {
ForEach(filteredExercises, id: \.self) { exercise in
if searchString.isEmpty || (exercise.name.lowercased().contains(searchString.lowercased()) || (exercise.muscleGroups ?? "").lowercased().contains(searchString.lowercased())) {
if searchString.isEmpty || exercise.name.lowercased().contains(searchString.lowercased()) {
HStack {
VStack {
Text(exercise.name)

View File

@@ -35,7 +35,7 @@ struct CompletedWorkoutsView: View {
.frame(height: 44)
.foregroundColor(.blue)
.background(.yellow)
.cornerRadius(8)
.cornerRadius(Constants.buttonRadius)
.padding()
.frame(maxWidth: .infinity)
}

View File

@@ -0,0 +1,79 @@
//
// 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
@Binding 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.wrappedValue
showAddExercise.toggle()
}, label: {
Image(systemName: "dumbbell.fill")
.font(.title2)
})
Divider()
Button(action: {
viewModel.delete(superset: $superset.wrappedValue)
//viewModel.increaseRandomNumberForUpdating()
viewModel.objectWillChange.send()
}, label: {
Image(systemName: "trash")
.font(.title2)
})
}
Divider()
Stepper(label: {
HStack {
Text("Rounds: ")
Text("\($superset.wrappedValue.numberOfRounds)")
.foregroundColor($superset.wrappedValue.numberOfRounds > 0 ? Color(uiColor: .label) : .red)
.bold()
}
}, onIncrement: {
$superset.wrappedValue.increaseNumberOfRounds()
//viewModel.increaseRandomNumberForUpdating()
viewModel.objectWillChange.send()
}, onDecrement: {
$superset.wrappedValue.decreaseNumberOfRounds()
//viewModel.increaseRandomNumberForUpdating()
viewModel.objectWillChange.send()
})
}
}
})
}
}

View File

@@ -19,7 +19,7 @@ struct Logoutview: View {
.frame(height: 44)
.foregroundColor(.white)
.background(.red)
.cornerRadius(8)
.cornerRadius(Constants.buttonRadius)
.padding()
.frame(maxWidth: .infinity)
@@ -31,7 +31,7 @@ struct Logoutview: View {
.frame(width: 44, height: 44)
.foregroundColor(.white)
.background(.green)
.cornerRadius(8)
.cornerRadius(Constants.buttonRadius)
.padding()
.frame(maxWidth: .infinity)
}