WIP
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
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 */; };
|
||||
1CD0C6632A5AF62900970E52 /* WorkoutOverviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CD0C6622A5AF62900970E52 /* WorkoutOverviewView.swift */; };
|
||||
1CF65A262A3972840042FFBD /* Werkout_iosApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A252A3972840042FFBD /* Werkout_iosApp.swift */; };
|
||||
1CF65A282A3972840042FFBD /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A272A3972840042FFBD /* Persistence.swift */; };
|
||||
1CF65A2B2A3972840042FFBD /* Werkout_ios.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A292A3972840042FFBD /* Werkout_ios.xcdatamodeld */; };
|
||||
@@ -139,6 +140,7 @@
|
||||
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>"; };
|
||||
1CD0C6622A5AF62900970E52 /* WorkoutOverviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutOverviewView.swift; sourceTree = "<group>"; };
|
||||
1CF65A222A3972840042FFBD /* Werkout_ios.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Werkout_ios.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1CF65A252A3972840042FFBD /* Werkout_iosApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Werkout_iosApp.swift; sourceTree = "<group>"; };
|
||||
1CF65A272A3972840042FFBD /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = "<group>"; };
|
||||
@@ -373,6 +375,7 @@
|
||||
1CF65A622A3BF6A30042FFBD /* AllWorkoutsView.swift */,
|
||||
1C5190CD2A589D4100885849 /* AllWorkoutPickerView.swift */,
|
||||
1C5190CF2A589D5F00885849 /* AllWorkoutsListView.swift */,
|
||||
1CD0C6622A5AF62900970E52 /* WorkoutOverviewView.swift */,
|
||||
);
|
||||
path = AllWorkouts;
|
||||
sourceTree = "<group>";
|
||||
@@ -554,6 +557,7 @@
|
||||
1CF65A7B2A3F83440042FFBD /* CreateWorkoutSupersetActionsView.swift in Sources */,
|
||||
1CF65A262A3972840042FFBD /* Werkout_iosApp.swift in Sources */,
|
||||
1C6BF28F2A56602B00450FD7 /* Keychain.swift in Sources */,
|
||||
1CD0C6632A5AF62900970E52 /* WorkoutOverviewView.swift in Sources */,
|
||||
1C5190C42A589CAC00885849 /* InfoView.swift in Sources */,
|
||||
1CF65A3C2A3972CE0042FFBD /* ExternalWorkoutDetailView.swift in Sources */,
|
||||
1CF65A632A3BF6A30042FFBD /* AllWorkoutsView.swift in Sources */,
|
||||
|
||||
@@ -19,9 +19,10 @@ struct Workout: Codable, Identifiable, Equatable {
|
||||
let registeredUser: RegisteredUser?
|
||||
let muscles: [String]?
|
||||
let equipment: [String]?
|
||||
let exercise_count: Int?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case name, description, exercises, id, muscles, equipment
|
||||
case name, description, exercises, id, muscles, equipment, exercise_count
|
||||
case registeredUser = "registered_user"
|
||||
}
|
||||
|
||||
@@ -39,6 +40,7 @@ struct Workout: Codable, Identifiable, Equatable {
|
||||
self.id = try container.decode(Int.self, forKey: .id)
|
||||
self.muscles = try container.decodeIfPresent([String].self, forKey: .muscles)
|
||||
self.equipment = try container.decodeIfPresent([String].self, forKey: .equipment)
|
||||
self.exercise_count = try container.decodeIfPresent(Int.self, forKey: .exercise_count)
|
||||
}
|
||||
|
||||
var exercisesSortedByCreated_at: [ExerciseElement] {
|
||||
|
||||
@@ -1,36 +1,436 @@
|
||||
[
|
||||
{
|
||||
"id": 4,
|
||||
"created_at": "2023-06-12T02:11:42.917529Z",
|
||||
"updated_at": "2023-06-16T01:48:17.565038Z",
|
||||
"name": "Sample Workou 1",
|
||||
"description": "thot workout",
|
||||
"id": 3,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"created_at": "2023-06-11T22:09:52.419314Z",
|
||||
"updated_at": "2023-06-11T22:09:52.419342Z",
|
||||
"first_name": "test1_fist",
|
||||
"last_name": "test1_last",
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": null,
|
||||
"user": 2
|
||||
}
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"quads",
|
||||
"lats",
|
||||
"lower back",
|
||||
"upper back",
|
||||
"biceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Rower"
|
||||
],
|
||||
"exercise_count": 14,
|
||||
"created_at": "2023-07-03T17:00:01.350058Z",
|
||||
"updated_at": "2023-07-04T16:51:07.231366Z",
|
||||
"name": "Rowwwwwwer",
|
||||
"description": "row until you pass out"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"created_at": "2023-06-13T02:01:33.290254Z",
|
||||
"updated_at": "2023-06-16T01:48:08.680277Z",
|
||||
"name": "test",
|
||||
"description": "workout for upper body",
|
||||
"id": 4,
|
||||
"registered_user": {
|
||||
"id": 2,
|
||||
"created_at": "2023-06-13T02:00:52.161674Z",
|
||||
"updated_at": "2023-06-13T02:00:52.161733Z",
|
||||
"first_name": "test2_first",
|
||||
"last_name": "test2_last",
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": null,
|
||||
"user": 3
|
||||
}
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"quads",
|
||||
"lats",
|
||||
"lower back",
|
||||
"upper back",
|
||||
"biceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Rower"
|
||||
],
|
||||
"exercise_count": 30,
|
||||
"created_at": "2023-07-04T17:36:56.902038Z",
|
||||
"updated_at": "2023-07-04T18:02:18.798549Z",
|
||||
"name": "Row 2",
|
||||
"description": "Let’s pass out"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"calves",
|
||||
"quads",
|
||||
"core",
|
||||
"hip flexor",
|
||||
"lats",
|
||||
"lower back",
|
||||
"upper back",
|
||||
"biceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Rower",
|
||||
"Yoga Mat"
|
||||
],
|
||||
"exercise_count": 60,
|
||||
"created_at": "2023-07-05T16:16:57.374041Z",
|
||||
"updated_at": "2023-07-05T16:16:57.378248Z",
|
||||
"name": "Cardio Mix",
|
||||
"description": "Mix of cardio stuff"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"calves",
|
||||
"hamstrings",
|
||||
"glutes",
|
||||
"core",
|
||||
"quads",
|
||||
"hip flexor",
|
||||
"middle back",
|
||||
"lats",
|
||||
"lower back",
|
||||
"upper back",
|
||||
"biceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Rower",
|
||||
"Yoga Mat"
|
||||
],
|
||||
"exercise_count": 56,
|
||||
"created_at": "2023-07-05T17:15:16.596202Z",
|
||||
"updated_at": "2023-07-05T17:15:16.597621Z",
|
||||
"name": "Cardio mix #2",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"glutes",
|
||||
"quads",
|
||||
"core",
|
||||
"triceps",
|
||||
"deltoids",
|
||||
"hip flexor",
|
||||
"biceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Bike",
|
||||
"Battle Ropes"
|
||||
],
|
||||
"exercise_count": 24,
|
||||
"created_at": "2023-07-06T14:47:57.669190Z",
|
||||
"updated_at": "2023-07-06T14:47:57.673138Z",
|
||||
"name": "HiiT #1",
|
||||
"description": "Upper body tabata"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"glutes",
|
||||
"quads",
|
||||
"feet"
|
||||
],
|
||||
"equipment": [],
|
||||
"exercise_count": 24,
|
||||
"created_at": "2023-07-06T14:49:24.336730Z",
|
||||
"updated_at": "2023-07-06T14:49:24.338220Z",
|
||||
"name": "HiiT #2",
|
||||
"description": "Lower body tabata"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"rotator cuff",
|
||||
"chest",
|
||||
"core",
|
||||
"hamstrings",
|
||||
"glutes",
|
||||
"triceps",
|
||||
"quads",
|
||||
"abs",
|
||||
"middle back",
|
||||
"forearms",
|
||||
"lats",
|
||||
"hip abductors",
|
||||
"upper back",
|
||||
"biceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Pull-Up Bar",
|
||||
"Kettlebell"
|
||||
],
|
||||
"exercise_count": 20,
|
||||
"created_at": "2023-07-06T14:51:00.277200Z",
|
||||
"updated_at": "2023-07-06T14:51:00.278874Z",
|
||||
"name": "HiiT #3",
|
||||
"description": "Total body"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"chest",
|
||||
"biceps",
|
||||
"forearms",
|
||||
"triceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Dumbbell",
|
||||
"Barbell",
|
||||
"Plates",
|
||||
"Bench"
|
||||
],
|
||||
"exercise_count": 24,
|
||||
"created_at": "2023-07-06T14:56:03.908583Z",
|
||||
"updated_at": "2023-07-06T14:56:03.910350Z",
|
||||
"name": "Arms and HiiT",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"hamstrings",
|
||||
"traps",
|
||||
"core",
|
||||
"quads",
|
||||
"glutes",
|
||||
"middle back",
|
||||
"forearms",
|
||||
"lats",
|
||||
"lower back",
|
||||
"biceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Dumbbell",
|
||||
"Barbell",
|
||||
"Plates"
|
||||
],
|
||||
"exercise_count": 21,
|
||||
"created_at": "2023-07-06T15:00:42.677119Z",
|
||||
"updated_at": "2023-07-06T15:00:42.678641Z",
|
||||
"name": "Upper Pull",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"core",
|
||||
"middle back",
|
||||
"forearms",
|
||||
"lats",
|
||||
"upper back",
|
||||
"biceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Barbell",
|
||||
"Dumbbell",
|
||||
"Plates",
|
||||
"Chest Supported Row Machine",
|
||||
"Bench"
|
||||
],
|
||||
"exercise_count": 32,
|
||||
"created_at": "2023-07-06T15:06:57.002749Z",
|
||||
"updated_at": "2023-07-06T15:06:57.004148Z",
|
||||
"name": "Upper Pull",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"deltoids",
|
||||
"chest",
|
||||
"core",
|
||||
"triceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Dumbbell",
|
||||
"Barbell",
|
||||
"Box",
|
||||
"Bench"
|
||||
],
|
||||
"exercise_count": 29,
|
||||
"created_at": "2023-07-06T15:11:52.085325Z",
|
||||
"updated_at": "2023-07-06T15:11:52.086738Z",
|
||||
"name": "Upper push",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"rotator cuff",
|
||||
"chest",
|
||||
"core",
|
||||
"traps",
|
||||
"quads",
|
||||
"triceps",
|
||||
"deltoids",
|
||||
"abs",
|
||||
"hamstrings",
|
||||
"glutes",
|
||||
"upper back"
|
||||
],
|
||||
"equipment": [
|
||||
"Barbell",
|
||||
"Dumbbell",
|
||||
"Plates",
|
||||
"Bench",
|
||||
"Seated Chest Press Machine"
|
||||
],
|
||||
"exercise_count": 31,
|
||||
"created_at": "2023-07-06T15:23:51.228664Z",
|
||||
"updated_at": "2023-07-06T15:23:51.230103Z",
|
||||
"name": "Upper push",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"id": 17,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"glutes",
|
||||
"hamstrings",
|
||||
"quads",
|
||||
"feet",
|
||||
"hip flexor",
|
||||
"hip abductors"
|
||||
],
|
||||
"equipment": [
|
||||
"Barbell",
|
||||
"Dumbbell",
|
||||
"Box",
|
||||
"Bench",
|
||||
"Bike"
|
||||
],
|
||||
"exercise_count": 33,
|
||||
"created_at": "2023-07-06T15:39:08.326899Z",
|
||||
"updated_at": "2023-07-06T17:53:45.996684Z",
|
||||
"name": "Lower #1",
|
||||
"description": null
|
||||
},
|
||||
{
|
||||
"id": 20,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"glutes",
|
||||
"quads",
|
||||
"feet",
|
||||
"upper back"
|
||||
],
|
||||
"equipment": [
|
||||
"Dumbbell",
|
||||
"Barbell",
|
||||
"Bench"
|
||||
],
|
||||
"exercise_count": 33,
|
||||
"created_at": "2023-07-06T18:20:27.100936Z",
|
||||
"updated_at": "2023-07-06T18:20:27.102968Z",
|
||||
"name": "Lower 2",
|
||||
"description": "3"
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
},
|
||||
"muscles": [
|
||||
"rotator cuff",
|
||||
"chest",
|
||||
"core",
|
||||
"hamstrings",
|
||||
"glutes",
|
||||
"triceps",
|
||||
"quads",
|
||||
"abs",
|
||||
"deltoids",
|
||||
"biceps"
|
||||
],
|
||||
"equipment": [
|
||||
"Bench",
|
||||
"Kettlebell",
|
||||
"Battle Ropes"
|
||||
],
|
||||
"exercise_count": 50,
|
||||
"created_at": "2023-07-07T17:18:47.385158Z",
|
||||
"updated_at": "2023-07-07T17:18:47.387277Z",
|
||||
"name": "Cardio",
|
||||
"description": "Ropes, bw squat, kb swings, push up"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -43,7 +43,6 @@ struct AddExerciseView: View {
|
||||
|
||||
TextField("Filter", text: $searchString)
|
||||
.padding()
|
||||
.background(Color(uiColor: .systemBackground))
|
||||
|
||||
HStack {
|
||||
muscleView()
|
||||
@@ -57,7 +56,6 @@ struct AddExerciseView: View {
|
||||
.padding(.top)
|
||||
.frame(height: 44)
|
||||
}
|
||||
.background(Color(uiColor: UIColor.secondarySystemBackground))
|
||||
.onAppear{
|
||||
if #function.hasPrefix("__preview") {
|
||||
DataStore.shared.setupFakeData()
|
||||
@@ -109,7 +107,6 @@ struct AddExerciseView: View {
|
||||
filterExercises()
|
||||
})
|
||||
}
|
||||
.background(Color(uiColor: .tertiarySystemBackground))
|
||||
}
|
||||
|
||||
func filterExercises() {
|
||||
|
||||
@@ -38,41 +38,20 @@ struct AllWorkoutsListView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
List {
|
||||
ForEach(filteredWorkouts, id:\.name) { workout in
|
||||
Section {
|
||||
VStack {
|
||||
Text(workout.name)
|
||||
.font(.title2)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Text(workout.description ?? "")
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
if let muscles = workout.muscles,
|
||||
muscles.joined(separator: ", ").count > 0{
|
||||
Divider()
|
||||
Text(muscles.joined(separator: ", "))
|
||||
.font(.footnote)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
ScrollView {
|
||||
LazyVStack(spacing: 20) {
|
||||
ForEach(filteredWorkouts, id:\.id) { workout in
|
||||
WorkoutOverviewView(workout: workout)
|
||||
.padding([.leading, .trailing])
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
selectedWorkout(workout)
|
||||
}
|
||||
|
||||
if let equipment = workout.equipment,
|
||||
equipment.joined(separator: ", ").count > 0 {
|
||||
Divider()
|
||||
Text(equipment.joined(separator: ", "))
|
||||
.font(.footnote)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
selectedWorkout(workout)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.refreshable {
|
||||
refresh()
|
||||
refresh()
|
||||
}
|
||||
|
||||
TextField("Filter" ,text: $searchString)
|
||||
@@ -81,3 +60,15 @@ struct AllWorkoutsListView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct AllWorkoutsListView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
AllWorkoutsListView(workouts: PreviewData.allWorkouts(),
|
||||
selectedWorkout: { workout in
|
||||
|
||||
},
|
||||
refresh: {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,14 +80,12 @@ struct AllWorkoutsView: View {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ProgressView()
|
||||
.progressViewStyle(.circular)
|
||||
ProgressView("Updating")
|
||||
}
|
||||
}.onAppear{
|
||||
// UserStore.shared.logout()
|
||||
maybeUpdateShit()
|
||||
}
|
||||
.background(Color(uiColor: .systemGroupedBackground))
|
||||
.sheet(item: $selectedWorkout) { item in
|
||||
let viewModel = WorkoutDetailViewModel(workout: item)
|
||||
WorkoutDetailView(viewModel: viewModel)
|
||||
@@ -96,12 +94,12 @@ struct AllWorkoutsView: View {
|
||||
let viewModel = WorkoutDetailViewModel(workout: item)
|
||||
WorkoutDetailView(viewModel: viewModel, showAddToCalendar: false)
|
||||
}
|
||||
.sheet(isPresented: $showLoginView) {
|
||||
LoginView(completion: {
|
||||
self.needsUpdating = true
|
||||
maybeUpdateShit()
|
||||
})
|
||||
}
|
||||
// .sheet(isPresented: $showLoginView) {
|
||||
// LoginView(completion: {
|
||||
// self.needsUpdating = true
|
||||
// maybeUpdateShit()
|
||||
// })
|
||||
// }
|
||||
.onReceive(pub) { (output) in
|
||||
self.needsUpdating = true
|
||||
maybeUpdateShit()
|
||||
|
||||
59
Werkout_ios/Views/AllWorkouts/WorkoutOverviewView.swift
Normal file
59
Werkout_ios/Views/AllWorkouts/WorkoutOverviewView.swift
Normal file
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// WorkoutOverviewView.swift
|
||||
// Werkout_ios
|
||||
//
|
||||
// Created by Trey Tartt on 7/9/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct WorkoutOverviewView: View {
|
||||
let workout: Workout
|
||||
var body: some View {
|
||||
VStack {
|
||||
HStack {
|
||||
VStack {
|
||||
Text(workout.name)
|
||||
.font(.title2)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Text(workout.description ?? "")
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
if let exerciseCount = workout.exercise_count {
|
||||
VStack {
|
||||
Text("\(exerciseCount)")
|
||||
.font(.body.bold())
|
||||
Text("exercises")
|
||||
.font(.footnote)
|
||||
.foregroundColor(Color(uiColor: .systemGray2))
|
||||
}
|
||||
}
|
||||
}
|
||||
if let muscles = workout.muscles,
|
||||
muscles.joined(separator: ", ").count > 0{
|
||||
Divider()
|
||||
Text(muscles.joined(separator: ", "))
|
||||
.font(.footnote)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
if let equipment = workout.equipment,
|
||||
equipment.joined(separator: ", ").count > 0 {
|
||||
Divider()
|
||||
Text(equipment.joined(separator: ", "))
|
||||
.font(.footnote)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
.cornerRadius(15)
|
||||
}
|
||||
}
|
||||
|
||||
struct WorkoutOverviewView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
WorkoutOverviewView(workout: PreviewData.allWorkouts()[0])
|
||||
}
|
||||
}
|
||||
@@ -67,14 +67,13 @@ struct CreateWorkoutMainView: View {
|
||||
}
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
.overlay(Group {
|
||||
if($viewModel.superSets.isEmpty) {
|
||||
ZStack() {
|
||||
Color(uiColor: .secondarySystemBackground)
|
||||
}
|
||||
}
|
||||
})
|
||||
// .overlay(Group {
|
||||
// if($viewModel.superSets.isEmpty) {
|
||||
// ZStack() {
|
||||
// Color(uiColor: .secondarySystemBackground)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
Divider()
|
||||
|
||||
@@ -106,9 +105,7 @@ struct CreateWorkoutMainView: View {
|
||||
}
|
||||
.frame(height: 44)
|
||||
.padding(.bottom)
|
||||
.background(Color(uiColor: .systemGroupedBackground))
|
||||
}
|
||||
.background(Color(uiColor: .systemGroupedBackground))
|
||||
.sheet(isPresented: $showAddExercise) {
|
||||
AddExerciseView(selectedExercise: { exercise in
|
||||
let workoutExercise = CreateWorkoutExercise(exercise: exercise)
|
||||
|
||||
@@ -44,7 +44,6 @@ struct ExternalWorkoutDetailView: View {
|
||||
ExtCountdownView()
|
||||
.frame(width: metrics.size.width-50, height: metrics.size.height * 0.2)
|
||||
.padding([.leading, .trailing], 50)
|
||||
.background(Color(uiColor: UIColor.secondarySystemBackground))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -39,7 +39,6 @@ struct WorkoutDetailView: View {
|
||||
}
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color(uiColor: .systemBackground))
|
||||
|
||||
GeometryReader { metrics in
|
||||
PlayerView(player: $avPlayer)
|
||||
@@ -47,13 +46,11 @@ struct WorkoutDetailView: View {
|
||||
.onAppear{
|
||||
avPlayer.play()
|
||||
}
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
}
|
||||
}
|
||||
|
||||
InfoView(workout: workout)
|
||||
.padding(.bottom)
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
|
||||
ExerciseListView(workout: workout)
|
||||
|
||||
@@ -65,7 +62,6 @@ struct WorkoutDetailView: View {
|
||||
.frame(height: 44)
|
||||
|
||||
}
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
.sheet(item: $presentedSheet) { item in
|
||||
switch item {
|
||||
case .completedWorkout(let data):
|
||||
|
||||
Reference in New Issue
Block a user