UI changes
This commit is contained in:
@@ -46,10 +46,13 @@
|
||||
1C5190D02A589D5F00885849 /* AllWorkoutsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C5190CF2A589D5F00885849 /* AllWorkoutsListView.swift */; };
|
||||
1C5190D22A59ACA400885849 /* WatchControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C5190D12A59ACA400885849 /* WatchControlView.swift */; };
|
||||
1C5190D42A59AEDE00885849 /* MainWatchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C5190D32A59AEDE00885849 /* MainWatchView.swift */; };
|
||||
1C549F972CFB980500D2EBC4 /* FilterAllView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C549F962CFB980500D2EBC4 /* FilterAllView.swift */; };
|
||||
1C6BF28F2A56602B00450FD7 /* Keychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6BF28E2A56602B00450FD7 /* Keychain.swift */; };
|
||||
1CAF4D8A2A5132F900B00E50 /* PlannedWorkout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CAF4D892A5132F900B00E50 /* PlannedWorkout.swift */; };
|
||||
1CAF4D8C2A51339200B00E50 /* PlannedWorkouts.json in Resources */ = {isa = PBXBuildFile; fileRef = 1CAF4D8B2A51339200B00E50 /* PlannedWorkouts.json */; };
|
||||
1CAF4D952A52180600B00E50 /* PlanWorkoutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CAF4D942A52180600B00E50 /* PlanWorkoutView.swift */; };
|
||||
1CBACCB02D13469000052649 /* AddSupersetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CBACCAF2D13468600052649 /* AddSupersetView.swift */; };
|
||||
1CBACCB22D15172500052649 /* CreateWorkoutSupersetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CBACCB12D15172500052649 /* CreateWorkoutSupersetView.swift */; };
|
||||
1CC092ED2C1FAC730004E1E6 /* Logoutview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC092EC2C1FAC730004E1E6 /* Logoutview.swift */; };
|
||||
1CC092EF2C1FACFC0004E1E6 /* NameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC092EE2C1FACFC0004E1E6 /* NameView.swift */; };
|
||||
1CC092F12C1FAD1E0004E1E6 /* CompletedWorkoutsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC092F02C1FAD1E0004E1E6 /* CompletedWorkoutsView.swift */; };
|
||||
@@ -184,6 +187,7 @@
|
||||
1C5190CF2A589D5F00885849 /* AllWorkoutsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllWorkoutsListView.swift; sourceTree = "<group>"; };
|
||||
1C5190D12A59ACA400885849 /* WatchControlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchControlView.swift; sourceTree = "<group>"; };
|
||||
1C5190D32A59AEDE00885849 /* MainWatchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainWatchView.swift; sourceTree = "<group>"; };
|
||||
1C549F962CFB980500D2EBC4 /* FilterAllView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterAllView.swift; sourceTree = "<group>"; };
|
||||
1C6BF28E2A56602B00450FD7 /* Keychain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Keychain.swift; sourceTree = "<group>"; };
|
||||
1C6D0A3C2A4BEC9700D98B06 /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS9.4.sdk/System/Library/Frameworks/AVKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
1C6D0A3D2A4BEC9700D98B06 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS9.4.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };
|
||||
@@ -191,6 +195,8 @@
|
||||
1CAF4D892A5132F900B00E50 /* PlannedWorkout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlannedWorkout.swift; sourceTree = "<group>"; };
|
||||
1CAF4D8B2A51339200B00E50 /* PlannedWorkouts.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = PlannedWorkouts.json; sourceTree = "<group>"; };
|
||||
1CAF4D942A52180600B00E50 /* PlanWorkoutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlanWorkoutView.swift; sourceTree = "<group>"; };
|
||||
1CBACCAF2D13468600052649 /* AddSupersetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddSupersetView.swift; sourceTree = "<group>"; };
|
||||
1CBACCB12D15172500052649 /* CreateWorkoutSupersetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateWorkoutSupersetView.swift; sourceTree = "<group>"; };
|
||||
1CC092EC2C1FAC730004E1E6 /* Logoutview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logoutview.swift; sourceTree = "<group>"; };
|
||||
1CC092EE2C1FACFC0004E1E6 /* NameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NameView.swift; sourceTree = "<group>"; };
|
||||
1CC092F02C1FAD1E0004E1E6 /* CompletedWorkoutsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompletedWorkoutsView.swift; sourceTree = "<group>"; };
|
||||
@@ -302,6 +308,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1C5190C52A589CC100885849 /* ActionsView.swift */,
|
||||
1CBACCAF2D13468600052649 /* AddSupersetView.swift */,
|
||||
1CC092FA2C1FB3320004E1E6 /* AllEquipmentView.swift */,
|
||||
1CC092F82C1FB1420004E1E6 /* AllExerciseView.swift */,
|
||||
1CC092F62C1FAFD50004E1E6 /* AllMusclesView.swift */,
|
||||
@@ -309,8 +316,10 @@
|
||||
1CC7CBD42C221159001614B8 /* CaloriesBurnedView.swift */,
|
||||
1CC092F02C1FAD1E0004E1E6 /* CompletedWorkoutsView.swift */,
|
||||
1C5190CB2A589D0000885849 /* CountdownView.swift */,
|
||||
1CBACCB12D15172500052649 /* CreateWorkoutSupersetView.swift */,
|
||||
1CC092FC2C20B0A30004E1E6 /* ExtCountdownView.swift */,
|
||||
1CC092FE2C20B0C80004E1E6 /* ExtExerciseList.swift */,
|
||||
1C549F962CFB980500D2EBC4 /* FilterAllView.swift */,
|
||||
1C5190C32A589CAC00885849 /* InfoView.swift */,
|
||||
1CC092EC2C1FAC730004E1E6 /* Logoutview.swift */,
|
||||
1CC092EE2C1FACFC0004E1E6 /* NameView.swift */,
|
||||
@@ -670,6 +679,7 @@
|
||||
1C5190C42A589CAC00885849 /* InfoView.swift in Sources */,
|
||||
1CF65A3C2A3972CE0042FFBD /* ExternalWorkoutDetailView.swift in Sources */,
|
||||
1CF65A632A3BF6A30042FFBD /* AllWorkoutsView.swift in Sources */,
|
||||
1CBACCB22D15172500052649 /* CreateWorkoutSupersetView.swift in Sources */,
|
||||
1CF65A692A3C018F0042FFBD /* AccountView.swift in Sources */,
|
||||
1CC092EF2C1FACFC0004E1E6 /* NameView.swift in Sources */,
|
||||
1CF65A4E2A39FF200042FFBD /* WorkoutDetailViewModel.swift in Sources */,
|
||||
@@ -687,6 +697,7 @@
|
||||
1CC092F12C1FAD1E0004E1E6 /* CompletedWorkoutsView.swift in Sources */,
|
||||
1C4AFF182A65CD290027710B /* Superset.swift in Sources */,
|
||||
1CF65A8E2A44B78B0042FFBD /* CompletedWorkoutView.swift in Sources */,
|
||||
1CBACCB02D13469000052649 /* AddSupersetView.swift in Sources */,
|
||||
1CF65A432A39FB410042FFBD /* Workout.swift in Sources */,
|
||||
1CF65A502A3A1EA90042FFBD /* BridgeModule.swift in Sources */,
|
||||
1CF65A592A3BF4B60042FFBD /* Muscle.swift in Sources */,
|
||||
@@ -715,6 +726,7 @@
|
||||
1CF65A282A3972840042FFBD /* Persistence.swift in Sources */,
|
||||
1CF65ABA2A4894430042FFBD /* UserStore.swift in Sources */,
|
||||
1C485C8C2A49D65600A6F896 /* WorkoutHistoryView.swift in Sources */,
|
||||
1C549F972CFB980500D2EBC4 /* FilterAllView.swift in Sources */,
|
||||
1CAF4D952A52180600B00E50 /* PlanWorkoutView.swift in Sources */,
|
||||
1C5190C62A589CC100885849 /* ActionsView.swift in Sources */,
|
||||
1C0494932C25CEF0003D18BB /* BridgeModule+Timer.swift in Sources */,
|
||||
|
||||
@@ -12,6 +12,6 @@ enum BaseURLs: String {
|
||||
case dev = "https://dev.werkout.fitness"
|
||||
|
||||
static var currentBaseURL: String {
|
||||
return BaseURLs.dev.rawValue
|
||||
return BaseURLs.local.rawValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,17 +25,19 @@ struct AllWorkoutsListView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
if let filteredRegisterdUser = filteredRegisterdUser {
|
||||
Text((filteredRegisterdUser.firstName ?? "NA") + "'s Workouts")
|
||||
VStack {
|
||||
if let filteredRegisterdUser = filteredRegisterdUser {
|
||||
Text((filteredRegisterdUser.firstName ?? "NA") + "'s Workouts")
|
||||
}
|
||||
|
||||
FilterAllView(searchString: $searchString,
|
||||
uniqueWorkoutUsers: $uniqueWorkoutUsers,
|
||||
filteredRegisterdUser: $filteredRegisterdUser,
|
||||
filteredWorkouts: $filteredWorkouts,
|
||||
workouts: $workouts,
|
||||
currentSort: $currentSort)
|
||||
}
|
||||
|
||||
FilterAllView(searchString: $searchString,
|
||||
uniqueWorkoutUsers: $uniqueWorkoutUsers,
|
||||
filteredRegisterdUser: $filteredRegisterdUser,
|
||||
filteredWorkouts: $filteredWorkouts,
|
||||
workouts: $workouts,
|
||||
currentSort: $currentSort)
|
||||
|
||||
ScrollView {
|
||||
LazyVStack(spacing: 10) {
|
||||
ForEach(filteredWorkouts, id:\.id) { workout in
|
||||
@@ -48,6 +50,7 @@ struct AllWorkoutsListView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.background(Color(uiColor: .systemBackground))
|
||||
.refreshable {
|
||||
refresh()
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ struct AllWorkoutsView: View {
|
||||
selectedWorkout = bridgeModule.currentWorkoutInfo.workout
|
||||
})
|
||||
|
||||
|
||||
switch selectedSegment {
|
||||
case .AllWorkout:
|
||||
if isUpdating {
|
||||
@@ -79,6 +78,7 @@ struct AllWorkoutsView: View {
|
||||
self.needsUpdating = true
|
||||
maybeUpdateShit()
|
||||
})
|
||||
|
||||
Divider()
|
||||
case .MyWorkouts:
|
||||
PlannedWorkoutView(workouts: UserStore.shared.plannedWorkouts,
|
||||
@@ -88,7 +88,9 @@ struct AllWorkoutsView: View {
|
||||
} else {
|
||||
ProgressView("Updating")
|
||||
}
|
||||
}.onAppear{
|
||||
}
|
||||
.background(Color(uiColor: .systemGray5))
|
||||
.onAppear{
|
||||
// UserStore.shared.logout()
|
||||
authorizeHealthKit()
|
||||
maybeUpdateShit()
|
||||
|
||||
@@ -67,7 +67,7 @@ struct CompletedWorkoutView: View {
|
||||
.frame(height: 44)
|
||||
.foregroundColor(.blue)
|
||||
.background(.yellow)
|
||||
.cornerRadius(8)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
||||
@@ -14,54 +14,47 @@ struct CreateExerciseActionsView: View {
|
||||
|
||||
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()
|
||||
}
|
||||
VStack {
|
||||
HStack {
|
||||
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)
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Weight: ")
|
||||
Text("\(workoutExercise.weight)")
|
||||
|
||||
Divider()
|
||||
Stepper("", onIncrement: {
|
||||
workoutExercise.increaseWeight()
|
||||
}, onDecrement: {
|
||||
workoutExercise.decreaseWeight()
|
||||
})
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Duration: ")
|
||||
Text("\(workoutExercise.duration)")
|
||||
.foregroundColor(
|
||||
workoutExercise.reps == 0 && workoutExercise.duration == 0 ? .red : Color(
|
||||
uiColor: .label
|
||||
)
|
||||
)
|
||||
.bold()
|
||||
|
||||
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()
|
||||
})
|
||||
}
|
||||
Stepper("", onIncrement: {
|
||||
workoutExercise.increaseDuration()
|
||||
}, onDecrement: {
|
||||
workoutExercise.decreaseDuration()
|
||||
})
|
||||
}
|
||||
|
||||
HStack {
|
||||
@@ -73,17 +66,16 @@ struct CreateExerciseActionsView: View {
|
||||
.frame(width: 88, height: 44)
|
||||
.foregroundColor(.white)
|
||||
.background(.blue)
|
||||
.cornerRadius(10)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.buttonStyle(BorderlessButtonStyle())
|
||||
|
||||
Spacer()
|
||||
|
||||
Divider()
|
||||
|
||||
Spacer()
|
||||
|
||||
Button(action: {
|
||||
superset.deleteExerciseForChosenSuperset(exercise: workoutExercise)
|
||||
superset
|
||||
.deleteExerciseForChosenSuperset(exercise: workoutExercise)
|
||||
viewModel.increaseRandomNumberForUpdating()
|
||||
viewModel.objectWillChange.send()
|
||||
}) {
|
||||
@@ -92,14 +84,13 @@ struct CreateExerciseActionsView: View {
|
||||
.frame(width: 88, height: 44)
|
||||
.foregroundColor(.white)
|
||||
.background(.red)
|
||||
.cornerRadius(10)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.buttonStyle(BorderlessButtonStyle())
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Divider()
|
||||
.background(.blue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ class CreateWorkoutSuperSet: ObservableObject, Identifiable, Equatable {
|
||||
}
|
||||
|
||||
let id = UUID()
|
||||
@Published var title: String = ""
|
||||
@Published var exercises = [CreateWorkoutExercise]()
|
||||
@Published var numberOfRounds = 0
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ struct CreateWorkoutItemPickerView: View {
|
||||
.frame(height: 44)
|
||||
.foregroundColor(.green)
|
||||
.background(.white)
|
||||
.cornerRadius(8)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding()
|
||||
|
||||
Button(action: {
|
||||
@@ -92,7 +92,7 @@ struct CreateWorkoutItemPickerView: View {
|
||||
.frame(height: 44)
|
||||
.foregroundColor(.blue)
|
||||
.background(.yellow)
|
||||
.cornerRadius(8)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
||||
@@ -8,71 +8,39 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CreateWorkoutMainView: View {
|
||||
@ObservedObject var viewModel = WorkoutViewModel()
|
||||
@State private var showAddExercise = false
|
||||
@StateObject var viewModel = WorkoutViewModel()
|
||||
@State var selectedCreateWorkoutSuperSet: CreateWorkoutSuperSet?
|
||||
@State private var showAddExercise = false
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
VStack {
|
||||
TextField("Title", text: $viewModel.title)
|
||||
.padding(.horizontal)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
|
||||
TextField("Description", text: $viewModel.description)
|
||||
.padding(.horizontal)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
}
|
||||
.padding(.bottom)
|
||||
.background(Color(uiColor: .systemGray5))
|
||||
|
||||
TextField("Title", text: $viewModel.title)
|
||||
.padding()
|
||||
.frame(height: 55)
|
||||
.textFieldStyle(OvalTextFieldStyle())
|
||||
|
||||
TextField("Description", text: $viewModel.description)
|
||||
.padding()
|
||||
.frame(height: 55)
|
||||
.textFieldStyle(OvalTextFieldStyle())
|
||||
ScrollViewReader { proxy in
|
||||
List() {
|
||||
ForEach($viewModel.superSets, id: \.id) { superset in
|
||||
Section {
|
||||
ForEach(superset.exercises, id: \.id) { exercise in
|
||||
HStack {
|
||||
VStack {
|
||||
Text(exercise.wrappedValue.exercise.name)
|
||||
.font(.title2)
|
||||
.frame(maxWidth: .infinity)
|
||||
if exercise.wrappedValue.exercise.side != nil && exercise.wrappedValue.exercise.side!.count > 0 {
|
||||
Text(exercise.wrappedValue.exercise.side!)
|
||||
.font(.title3)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
}
|
||||
CreateExerciseActionsView(workoutExercise: exercise.wrappedValue,
|
||||
superset: superset.wrappedValue,
|
||||
viewModel: viewModel)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
Stepper("Number of rounds", onIncrement: {
|
||||
superset.wrappedValue.increaseNumberOfRounds()
|
||||
viewModel.increaseRandomNumberForUpdating()
|
||||
viewModel.objectWillChange.send()
|
||||
}, onDecrement: {
|
||||
superset.wrappedValue.decreaseNumberOfRounds()
|
||||
viewModel.increaseRandomNumberForUpdating()
|
||||
viewModel.objectWillChange.send()
|
||||
})
|
||||
|
||||
Text("\(superset.wrappedValue.numberOfRounds)")
|
||||
.foregroundColor(superset.numberOfRounds.wrappedValue > 0 ? .black : .red)
|
||||
.bold()
|
||||
}
|
||||
|
||||
CreateWorkoutSupersetActionsView(workoutSuperSet: superset.wrappedValue,
|
||||
showAddExercise: $showAddExercise,
|
||||
viewModel: viewModel,
|
||||
selectedCreateWorkoutSuperSet: $selectedCreateWorkoutSuperSet)
|
||||
}
|
||||
CreateWorkoutSupersetView(
|
||||
selectedCreateWorkoutSuperSet: $selectedCreateWorkoutSuperSet,
|
||||
showAddExercise: $showAddExercise,
|
||||
superset: superset,
|
||||
viewModel: viewModel)
|
||||
}
|
||||
// after adding new exercise we have to scroll to the bottom
|
||||
// where the new exercise is sooo keep this so we can scroll
|
||||
// to id 999
|
||||
Text("this is the bottom 🤷♂️")
|
||||
.id(999)
|
||||
|
||||
.listRowSeparator(.hidden)
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
.onChange(of: viewModel.randomValueForUpdatingValue, perform: { newValue in
|
||||
withAnimation {
|
||||
@@ -80,15 +48,41 @@ struct CreateWorkoutMainView: View {
|
||||
}
|
||||
})
|
||||
}
|
||||
// .overlay(Group {
|
||||
// if($viewModel.superSets.isEmpty) {
|
||||
// ZStack() {
|
||||
// Color(uiColor: .secondarySystemBackground)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
Divider()
|
||||
.sheet(isPresented: $showAddExercise) {
|
||||
AddExerciseView(selectedExercise: { exercise in
|
||||
let workoutExercise = CreateWorkoutExercise(exercise: exercise)
|
||||
selectedCreateWorkoutSuperSet?.exercises.append(workoutExercise)
|
||||
|
||||
|
||||
// if left or right auto add the other side
|
||||
// with a recover in between b/c its
|
||||
// eaiser to delete a recover than add one
|
||||
if exercise.side != nil && exercise.side!.count > 0 {
|
||||
let exercises = DataStore.shared.allExercise?.filter({
|
||||
$0.name == exercise.name
|
||||
})
|
||||
let recover = DataStore.shared.allExercise?.first(where: {
|
||||
$0.name.lowercased() == "recover"
|
||||
})
|
||||
if let exercises = exercises, let recover = recover {
|
||||
if exercises.count == 2 {
|
||||
let recoverWorkoutExercise = CreateWorkoutExercise(exercise: recover)
|
||||
selectedCreateWorkoutSuperSet?.exercises.append(recoverWorkoutExercise)
|
||||
for LRExercise in exercises {
|
||||
if LRExercise.id != exercise.id {
|
||||
let otherSideExercise = CreateWorkoutExercise(exercise: LRExercise)
|
||||
selectedCreateWorkoutSuperSet?.exercises.append(otherSideExercise)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.increaseRandomNumberForUpdating()
|
||||
viewModel.objectWillChange.send()
|
||||
selectedCreateWorkoutSuperSet = nil
|
||||
})
|
||||
}
|
||||
|
||||
HStack {
|
||||
Button("Add Superset", action: {
|
||||
@@ -96,9 +90,9 @@ struct CreateWorkoutMainView: View {
|
||||
})
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.frame(height: 44)
|
||||
.foregroundColor(.blue)
|
||||
.background(.yellow)
|
||||
.cornerRadius(8)
|
||||
.foregroundColor(.white)
|
||||
.background(.blue)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
@@ -110,50 +104,17 @@ struct CreateWorkoutMainView: View {
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.frame(height: 44)
|
||||
.foregroundColor(.white)
|
||||
.background(.blue)
|
||||
.cornerRadius(8)
|
||||
.background(.green)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.disabled(viewModel.title.isEmpty)
|
||||
}
|
||||
.frame(height: 44)
|
||||
.padding(.bottom)
|
||||
}
|
||||
.sheet(isPresented: $showAddExercise) {
|
||||
AddExerciseView(selectedExercise: { exercise in
|
||||
let workoutExercise = CreateWorkoutExercise(exercise: exercise)
|
||||
selectedCreateWorkoutSuperSet?.exercises.append(workoutExercise)
|
||||
|
||||
|
||||
// if left or right auto add the other side
|
||||
// with a recover in between b/c its
|
||||
// eaiser to delete a recover than add one
|
||||
if exercise.side != nil && exercise.side!.count > 0 {
|
||||
let exercises = DataStore.shared.allExercise?.filter({
|
||||
$0.name == exercise.name
|
||||
})
|
||||
let recover = DataStore.shared.allExercise?.first(where: {
|
||||
$0.name.lowercased() == "recover"
|
||||
})
|
||||
if let exercises = exercises, let recover = recover {
|
||||
if exercises.count == 2 {
|
||||
let recoverWorkoutExercise = CreateWorkoutExercise(exercise: recover)
|
||||
selectedCreateWorkoutSuperSet?.exercises.append(recoverWorkoutExercise)
|
||||
for LRExercise in exercises {
|
||||
if LRExercise.id != exercise.id {
|
||||
let otherSideExercise = CreateWorkoutExercise(exercise: LRExercise)
|
||||
selectedCreateWorkoutSuperSet?.exercises.append(otherSideExercise)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.increaseRandomNumberForUpdating()
|
||||
viewModel.objectWillChange.send()
|
||||
selectedCreateWorkoutSuperSet = nil
|
||||
})
|
||||
|
||||
Divider()
|
||||
}
|
||||
.background(Color(uiColor: .systemGray5))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,14 +24,12 @@ struct CreateWorkoutSupersetActionsView: View {
|
||||
}
|
||||
.foregroundColor(.white)
|
||||
.background(.green)
|
||||
.cornerRadius(10)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.buttonStyle(BorderlessButtonStyle())
|
||||
|
||||
Button(action: {
|
||||
viewModel.delete(superset: workoutSuperSet)
|
||||
viewModel.increaseRandomNumberForUpdating()
|
||||
viewModel.objectWillChange.send()
|
||||
// viewModel.delete(superset: workoutSuperSet)
|
||||
// viewModel.increaseRandomNumberForUpdating()
|
||||
// viewModel.objectWillChange.send()
|
||||
|
||||
}) {
|
||||
Text("Delete superset")
|
||||
@@ -39,9 +37,7 @@ struct CreateWorkoutSupersetActionsView: View {
|
||||
}
|
||||
.foregroundColor(.white)
|
||||
.background(.red)
|
||||
.cornerRadius(10)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.buttonStyle(BorderlessButtonStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ struct LoginView: View {
|
||||
.textFieldStyle(PlainTextFieldStyle())
|
||||
.padding([.horizontal], 4)
|
||||
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color(uiColor: .clear))).background(Color(uiColor: .init(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)))
|
||||
.cornerRadius(8)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding(.top, 25)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ struct LoginView: View {
|
||||
.textFieldStyle(PlainTextFieldStyle())
|
||||
.padding([.horizontal], 4)
|
||||
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color(uiColor: .clear))).background(Color(uiColor: .init(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)))
|
||||
.cornerRadius(8)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
|
||||
if doingNetworkShit {
|
||||
ProgressView("Logging In")
|
||||
@@ -55,7 +55,7 @@ struct LoginView: View {
|
||||
.frame(height: 44)
|
||||
.foregroundColor(.blue)
|
||||
.background(.yellow)
|
||||
.cornerRadius(8)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.disabled(password.isEmpty || email.isEmpty)
|
||||
|
||||
@@ -46,7 +46,7 @@ struct PlanWorkoutView: View {
|
||||
.frame(height: 44)
|
||||
.foregroundColor(.white)
|
||||
.background(.red)
|
||||
.cornerRadius(8)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding()
|
||||
|
||||
Button(action: {
|
||||
@@ -60,7 +60,7 @@ struct PlanWorkoutView: View {
|
||||
.frame(height: 44)
|
||||
.foregroundColor(.blue)
|
||||
.background(.yellow)
|
||||
.cornerRadius(8)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding()
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ struct WorkoutDetailView: View {
|
||||
.foregroundColor(Color("appColor"))
|
||||
})
|
||||
.foregroundColor(.blue)
|
||||
.cornerRadius(4)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.frame(width: 160, height: 120)
|
||||
.position(x: metrics.size.width - 22, y: metrics.size.height - 30)
|
||||
|
||||
@@ -79,7 +79,7 @@ struct WorkoutDetailView: View {
|
||||
.foregroundColor(Color("appColor"))
|
||||
})
|
||||
.foregroundColor(.blue)
|
||||
.cornerRadius(4)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.frame(width: 120, height: 120)
|
||||
.position(x: 22, y: metrics.size.height - 30)
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ struct Constants {
|
||||
static let extThotStyle = "extThotStyle"
|
||||
static let extShowNextVideo = "extShowNextVideo"
|
||||
static let thotGenderOption = "thotGenderOption"
|
||||
|
||||
static let buttonRadius: CGFloat = 4
|
||||
}
|
||||
|
||||
@main
|
||||
|
||||
36
iphone/Werkout_ios/subview/AddSupersetView.swift
Normal file
36
iphone/Werkout_ios/subview/AddSupersetView.swift
Normal 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)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -35,7 +35,7 @@ struct CompletedWorkoutsView: View {
|
||||
.frame(height: 44)
|
||||
.foregroundColor(.blue)
|
||||
.background(.yellow)
|
||||
.cornerRadius(8)
|
||||
.cornerRadius(Constants.buttonRadius)
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
||||
79
iphone/Werkout_ios/subview/CreateWorkoutSupersetView.swift
Normal file
79
iphone/Werkout_ios/subview/CreateWorkoutSupersetView.swift
Normal 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()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user