WIP
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
1C485C8A2A492BB400A6F896 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C485C892A492BB400A6F896 /* LoginView.swift */; };
|
||||
1C485C8C2A49D65600A6F896 /* WorkoutHistoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C485C8B2A49D65600A6F896 /* WorkoutHistoryView.swift */; };
|
||||
1C485C8D2A49D95700A6F896 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A822A42347D0042FFBD /* Extensions.swift */; };
|
||||
1C5190C22A57CA5F00885849 /* OvalTextFieldStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C5190C12A57CA5F00885849 /* OvalTextFieldStyle.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 */; };
|
||||
@@ -29,7 +30,7 @@
|
||||
1CF65A432A39FB410042FFBD /* Workout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A422A39FB410042FFBD /* Workout.swift */; };
|
||||
1CF65A452A39FB550042FFBD /* Exercise.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A442A39FB550042FFBD /* Exercise.swift */; };
|
||||
1CF65A472A39FB6C0042FFBD /* RegisteredUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A462A39FB6C0042FFBD /* RegisteredUser.swift */; };
|
||||
1CF65A4A2A39FBB10042FFBD /* WorkoutOne.json in Resources */ = {isa = PBXBuildFile; fileRef = 1CF65A492A39FBB10042FFBD /* WorkoutOne.json */; };
|
||||
1CF65A4A2A39FBB10042FFBD /* WorkoutDetail.json in Resources */ = {isa = PBXBuildFile; fileRef = 1CF65A492A39FBB10042FFBD /* WorkoutDetail.json */; };
|
||||
1CF65A4C2A39FDA20042FFBD /* WorkoutDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A4B2A39FDA20042FFBD /* WorkoutDetailView.swift */; };
|
||||
1CF65A4E2A39FF200042FFBD /* WorkoutDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A4D2A39FF200042FFBD /* WorkoutDetailViewModel.swift */; };
|
||||
1CF65A502A3A1EA90042FFBD /* BridgeModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A4F2A3A1EA90042FFBD /* BridgeModule.swift */; };
|
||||
@@ -67,7 +68,7 @@
|
||||
1CF65AA92A452D9C0042FFBD /* Workout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A422A39FB410042FFBD /* Workout.swift */; };
|
||||
1CF65AAA2A452D9C0042FFBD /* RegisteredUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A462A39FB6C0042FFBD /* RegisteredUser.swift */; };
|
||||
1CF65AAB2A452DAC0042FFBD /* PreviewData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF65A512A3A90A00042FFBD /* PreviewData.swift */; };
|
||||
1CF65AAC2A452DF50042FFBD /* WorkoutOne.json in Resources */ = {isa = PBXBuildFile; fileRef = 1CF65A492A39FBB10042FFBD /* WorkoutOne.json */; };
|
||||
1CF65AAC2A452DF50042FFBD /* WorkoutDetail.json in Resources */ = {isa = PBXBuildFile; fileRef = 1CF65A492A39FBB10042FFBD /* WorkoutDetail.json */; };
|
||||
1CF65AAD2A452DF50042FFBD /* Exercises.json in Resources */ = {isa = PBXBuildFile; fileRef = 1CF65A662A3BFF840042FFBD /* Exercises.json */; };
|
||||
1CF65AAE2A452DF50042FFBD /* AllWorkouts.json in Resources */ = {isa = PBXBuildFile; fileRef = 1CF65A642A3BF6BE0042FFBD /* AllWorkouts.json */; };
|
||||
1CF65AAF2A452DF50042FFBD /* AllMuscles.json in Resources */ = {isa = PBXBuildFile; fileRef = 1CF65A562A3BF3830042FFBD /* AllMuscles.json */; };
|
||||
@@ -112,6 +113,7 @@
|
||||
1C485C862A4915C400A6F896 /* CreateWorkoutItemPickerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateWorkoutItemPickerView.swift; sourceTree = "<group>"; };
|
||||
1C485C892A492BB400A6F896 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
|
||||
1C485C8B2A49D65600A6F896 /* WorkoutHistoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutHistoryView.swift; sourceTree = "<group>"; };
|
||||
1C5190C12A57CA5F00885849 /* OvalTextFieldStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OvalTextFieldStyle.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; };
|
||||
@@ -131,7 +133,7 @@
|
||||
1CF65A422A39FB410042FFBD /* Workout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Workout.swift; sourceTree = "<group>"; };
|
||||
1CF65A442A39FB550042FFBD /* Exercise.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Exercise.swift; sourceTree = "<group>"; };
|
||||
1CF65A462A39FB6C0042FFBD /* RegisteredUser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisteredUser.swift; sourceTree = "<group>"; };
|
||||
1CF65A492A39FBB10042FFBD /* WorkoutOne.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = WorkoutOne.json; sourceTree = "<group>"; };
|
||||
1CF65A492A39FBB10042FFBD /* WorkoutDetail.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = WorkoutDetail.json; sourceTree = "<group>"; };
|
||||
1CF65A4B2A39FDA20042FFBD /* WorkoutDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutDetailView.swift; sourceTree = "<group>"; };
|
||||
1CF65A4D2A39FF200042FFBD /* WorkoutDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkoutDetailViewModel.swift; sourceTree = "<group>"; };
|
||||
1CF65A4F2A3A1EA90042FFBD /* BridgeModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BridgeModule.swift; sourceTree = "<group>"; };
|
||||
@@ -301,6 +303,7 @@
|
||||
1CF65A6C2A3F60100042FFBD /* CreateWorkout */,
|
||||
1C485C882A492BAA00A6F896 /* Login */,
|
||||
1CF65A882A44B7290042FFBD /* WorkoutDetail */,
|
||||
1C5190C12A57CA5F00885849 /* OvalTextFieldStyle.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
@@ -309,7 +312,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1CF65A642A3BF6BE0042FFBD /* AllWorkouts.json */,
|
||||
1CF65A492A39FBB10042FFBD /* WorkoutOne.json */,
|
||||
1CF65A492A39FBB10042FFBD /* WorkoutDetail.json */,
|
||||
1CF65A562A3BF3830042FFBD /* AllMuscles.json */,
|
||||
1CF65A5E2A3BF5A60042FFBD /* Equipment.json */,
|
||||
1CF65A662A3BFF840042FFBD /* Exercises.json */,
|
||||
@@ -483,7 +486,7 @@
|
||||
1CF65A5F2A3BF5A60042FFBD /* Equipment.json in Resources */,
|
||||
1C485C832A489B9C00A6F896 /* CompletedWorkouts.json in Resources */,
|
||||
1C31C8852A53AE3E00350540 /* long_beep.m4a in Resources */,
|
||||
1CF65A4A2A39FBB10042FFBD /* WorkoutOne.json in Resources */,
|
||||
1CF65A4A2A39FBB10042FFBD /* WorkoutDetail.json in Resources */,
|
||||
1CF65A652A3BF6BE0042FFBD /* AllWorkouts.json in Resources */,
|
||||
1CF65A332A3972850042FFBD /* Preview Assets.xcassets in Resources */,
|
||||
1CF65ABC2A4897E20042FFBD /* RegisteredUser.json in Resources */,
|
||||
@@ -502,7 +505,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1CF65AAF2A452DF50042FFBD /* AllMuscles.json in Resources */,
|
||||
1CF65AAC2A452DF50042FFBD /* WorkoutOne.json in Resources */,
|
||||
1CF65AAC2A452DF50042FFBD /* WorkoutDetail.json in Resources */,
|
||||
1CF65AAD2A452DF50042FFBD /* Exercises.json in Resources */,
|
||||
1CF65AB02A452DF50042FFBD /* Equipment.json in Resources */,
|
||||
1CF65A9D2A452D290042FFBD /* Preview Assets.xcassets in Resources */,
|
||||
@@ -539,6 +542,7 @@
|
||||
1CF65A502A3A1EA90042FFBD /* BridgeModule.swift in Sources */,
|
||||
1CF65A592A3BF4B60042FFBD /* Muscle.swift in Sources */,
|
||||
1CAF4D8A2A5132F900B00E50 /* PlannedWorkout.swift in Sources */,
|
||||
1C5190C22A57CA5F00885849 /* OvalTextFieldStyle.swift in Sources */,
|
||||
1CF65A2B2A3972840042FFBD /* Werkout_ios.xcdatamodeld in Sources */,
|
||||
1C31C8872A55B2CC00350540 /* PlayerUIView.swift in Sources */,
|
||||
1CF65A2D2A3972840042FFBD /* MainView.swift in Sources */,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
|
||||
extension Dictionary {
|
||||
func percentEncoded() -> Data? {
|
||||
@@ -121,3 +122,20 @@ extension Double {
|
||||
return formatter.string(from: self) ?? ""
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View {
|
||||
clipShape( RoundedCorner(radius: radius, corners: corners) )
|
||||
}
|
||||
}
|
||||
|
||||
struct RoundedCorner: Shape {
|
||||
|
||||
var radius: CGFloat = .infinity
|
||||
var corners: UIRectCorner = .allCorners
|
||||
|
||||
func path(in rect: CGRect) -> Path {
|
||||
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
|
||||
return Path(path.cgPath)
|
||||
}
|
||||
}
|
||||
|
||||
2974
Werkout_ios/JSON/WorkoutDetail.json
Normal file
2974
Werkout_ios/JSON/WorkoutDetail.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,162 +0,0 @@
|
||||
{
|
||||
"id": 1,
|
||||
"name": "test workout",
|
||||
"description": null,
|
||||
"exercises": [
|
||||
{
|
||||
"workout": 1,
|
||||
"exercise": {
|
||||
"id": 1080,
|
||||
"muscles": [
|
||||
{
|
||||
"id": 7267,
|
||||
"created_at": "2023-06-28T04:04:39.263974Z",
|
||||
"updated_at": "2023-06-28T04:04:39.263986Z",
|
||||
"exercise": 1080,
|
||||
"muscle": 4
|
||||
},
|
||||
{
|
||||
"id": 7266,
|
||||
"created_at": "2023-06-28T04:04:39.268881Z",
|
||||
"updated_at": "2023-06-28T04:04:39.268893Z",
|
||||
"exercise": 1080,
|
||||
"muscle": 5
|
||||
}
|
||||
],
|
||||
"equipment": [
|
||||
{
|
||||
"id": 942,
|
||||
"created_at": "2023-06-28T14:18:59.650301Z",
|
||||
"updated_at": "2023-06-28T14:18:59.650313Z",
|
||||
"exercise": 1080,
|
||||
"equipment": 1091
|
||||
}
|
||||
],
|
||||
"audio_url": "/media/exercise_audio/2_Dumbbell_Lateral_Lunges.m4a",
|
||||
"video_url": "/media/exercise_videos/2_Dumbbell_Lateral_Lunges.mp4",
|
||||
"nsfw_video_url": "/media/nsfw_exercise_videos/2_Dumbbell_Lateral_Lunges.mp4",
|
||||
"created_at": "2023-06-26T20:52:33.576028Z",
|
||||
"updated_at": "2023-06-26T20:52:33.576040Z",
|
||||
"name": "2 Dumbbell Lateral Lunges",
|
||||
"description": "With dumbbells by your sides, step out to the side.. Reach your hips back like you're sitting in a chair.. Drive back up to the starting position, and repeat on the other side.",
|
||||
"side": "",
|
||||
"is_two_dumbbells": true,
|
||||
"is_trackable_distance": false,
|
||||
"is_alternating": true,
|
||||
"is_weight": true,
|
||||
"is_distance": false,
|
||||
"is_duration": true,
|
||||
"is_reps": true,
|
||||
"joints_used": "ankle,hip,knee,lumbar spine,wrist",
|
||||
"movement_patterns": "lower push,lower push - lunge",
|
||||
"equipment_required": "Dumbbell",
|
||||
"muscle_groups": "quads,glutes",
|
||||
"synonyms": ""
|
||||
},
|
||||
"weight": null,
|
||||
"reps": null,
|
||||
"duration": null,
|
||||
"duration_audio": null,
|
||||
"weight_audio": null,
|
||||
"created_at": "2023-06-27T12:18:54.998026Z"
|
||||
},
|
||||
{
|
||||
"workout": 1,
|
||||
"exercise": {
|
||||
"id": 798,
|
||||
"muscles": [],
|
||||
"equipment": [],
|
||||
"audio_url": "/media/exercise_audio/Recover.m4a",
|
||||
"video_url": "/media/exercise_videos/Recover.mp4",
|
||||
"nsfw_video_url": "/media/nsfw_exercise_videos/Recover_5.mp4",
|
||||
"created_at": "2023-06-26T20:52:36.446337Z",
|
||||
"updated_at": "2023-06-26T20:52:36.446348Z",
|
||||
"name": "Recover",
|
||||
"description": "Use this time to catch your breath. It will help you get more out of what's next",
|
||||
"side": "",
|
||||
"is_two_dumbbells": false,
|
||||
"is_trackable_distance": false,
|
||||
"is_alternating": false,
|
||||
"is_weight": false,
|
||||
"is_distance": false,
|
||||
"is_duration": true,
|
||||
"is_reps": false,
|
||||
"joints_used": "",
|
||||
"movement_patterns": "",
|
||||
"equipment_required": "",
|
||||
"muscle_groups": "",
|
||||
"synonyms": ""
|
||||
},
|
||||
"weight": null,
|
||||
"reps": null,
|
||||
"duration": null,
|
||||
"duration_audio": null,
|
||||
"weight_audio": null,
|
||||
"created_at": "2023-06-27T12:18:54.999424Z"
|
||||
},
|
||||
{
|
||||
"workout": 1,
|
||||
"exercise": {
|
||||
"id": 130,
|
||||
"muscles": [
|
||||
{
|
||||
"id": 7282,
|
||||
"created_at": "2023-06-28T04:04:39.194997Z",
|
||||
"updated_at": "2023-06-28T04:04:39.195009Z",
|
||||
"exercise": 130,
|
||||
"muscle": 5
|
||||
},
|
||||
{
|
||||
"id": 7281,
|
||||
"created_at": "2023-06-28T04:04:39.199685Z",
|
||||
"updated_at": "2023-06-28T04:04:39.199697Z",
|
||||
"exercise": 130,
|
||||
"muscle": 1
|
||||
}
|
||||
],
|
||||
"equipment": [
|
||||
{
|
||||
"id": 948,
|
||||
"created_at": "2023-06-28T14:18:59.622982Z",
|
||||
"updated_at": "2023-06-28T14:18:59.622994Z",
|
||||
"exercise": 130,
|
||||
"equipment": 1088
|
||||
}
|
||||
],
|
||||
"audio_url": "/media/exercise_audio/2_Kettlebell_Push_Press.m4a",
|
||||
"video_url": "/media/exercise_videos/2_Kettlebell_Push_Press.mp4",
|
||||
"nsfw_video_url": "/media/nsfw_exercise_videos/2_Kettlebell_Push_Press.mp4",
|
||||
"created_at": "2023-06-26T20:52:33.599643Z",
|
||||
"updated_at": "2023-06-26T20:52:33.599655Z",
|
||||
"name": "2 Kettlebell Push Press",
|
||||
"description": "Stand with feet in a shoulder width stance and kettlebells in the front rack position. \nDip quickly at the knees into a quarter squat and then explode straight up as you press the kettlebells overhead.\nLower the kettlebells under control back to the starting position",
|
||||
"side": "",
|
||||
"is_two_dumbbells": false,
|
||||
"is_trackable_distance": false,
|
||||
"is_alternating": false,
|
||||
"is_weight": true,
|
||||
"is_distance": false,
|
||||
"is_duration": true,
|
||||
"is_reps": true,
|
||||
"joints_used": "knee,hip,shoulder,wrist,elbow",
|
||||
"movement_patterns": "upper push - vertical,upper push",
|
||||
"equipment_required": "Kettlebell",
|
||||
"muscle_groups": "deltoids,quads",
|
||||
"synonyms": ""
|
||||
},
|
||||
"weight": null,
|
||||
"reps": null,
|
||||
"duration": null,
|
||||
"duration_audio": null,
|
||||
"weight_audio": null,
|
||||
"created_at": "2023-06-27T12:18:54.999935Z"
|
||||
}
|
||||
],
|
||||
"registered_user": {
|
||||
"id": 1,
|
||||
"first_name": "User1",
|
||||
"last_name": "user1",
|
||||
"image": "",
|
||||
"nick_name": "test user1"
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import Foundation
|
||||
|
||||
class PreviewData {
|
||||
class func workout() -> Workout {
|
||||
let filepath = Bundle.main.path(forResource: "WorkoutOne", ofType: "json")!
|
||||
let filepath = Bundle.main.path(forResource: "WorkoutDetail", ofType: "json")!
|
||||
let data = try! Data(NSData(contentsOfFile: filepath))
|
||||
let workout = try! JSONDecoder().decode(Workout.self, from: data)
|
||||
return workout
|
||||
|
||||
@@ -87,6 +87,7 @@ struct AllWorkoutsView: View {
|
||||
// UserStore.shared.logout()
|
||||
maybeUpdateShit()
|
||||
}
|
||||
.background(Color(uiColor: .systemGroupedBackground))
|
||||
.sheet(item: $selectedWorkout) { item in
|
||||
let viewModel = WorkoutDetailViewModel(workout: item)
|
||||
WorkoutDetailView(viewModel: viewModel)
|
||||
@@ -191,7 +192,7 @@ struct AllWorkoutPickerView: View {
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
.padding()
|
||||
.padding([.top, .leading, .trailing])
|
||||
|
||||
if bridgeModule.isInWorkout {
|
||||
Button(action: {
|
||||
@@ -274,12 +275,14 @@ struct AllWorkoutsListView: View {
|
||||
refresh()
|
||||
}
|
||||
|
||||
TextField("Filter", text: $searchString)
|
||||
.frame(height: 55)
|
||||
.textFieldStyle(PlainTextFieldStyle())
|
||||
.padding([.horizontal], 4)
|
||||
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color(uiColor: .clear))).background(Color(uiColor: .init(red: 200/255, green: 200/255, blue: 200/255, alpha: 0.2)))
|
||||
// .cornerRadius(8)
|
||||
TextField("Filter" ,text: $searchString)
|
||||
.padding()
|
||||
.textFieldStyle(OvalTextFieldStyle())
|
||||
// TextField("Filter", text: $searchString)
|
||||
// .padding()
|
||||
// .overlay(RoundedRectangle(cornerRadius: 10.0).strokeBorder(Color(uiColor: .darkGray), style: StrokeStyle(lineWidth: 1.0)))
|
||||
// .padding()
|
||||
// .background(Color(uiColor: .systemGroupedBackground))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,21 +14,16 @@ struct CreateWorkoutMainView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Divider()
|
||||
|
||||
TextField("Title", text: $viewModel.title)
|
||||
.padding()
|
||||
.frame(height: 55)
|
||||
.textFieldStyle(PlainTextFieldStyle())
|
||||
.padding([.horizontal], 4)
|
||||
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color(uiColor: .clear))).background(Color(uiColor: .init(red: 200/255, green: 200/255, blue: 200/255, alpha: 0.2)))
|
||||
// .cornerRadius(8)
|
||||
.textFieldStyle(OvalTextFieldStyle())
|
||||
|
||||
TextField("Description", text: $viewModel.description)
|
||||
.padding()
|
||||
.frame(height: 55)
|
||||
.textFieldStyle(PlainTextFieldStyle())
|
||||
.padding([.horizontal], 4)
|
||||
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color(uiColor: .clear))).background(Color(uiColor: .init(red: 200/255, green: 200/255, blue: 200/255, alpha: 0.2)))
|
||||
// .cornerRadius(8)
|
||||
.textFieldStyle(OvalTextFieldStyle())
|
||||
|
||||
List() {
|
||||
ForEach($viewModel.superSets, id: \.id) { superset in
|
||||
@@ -72,6 +67,16 @@ struct CreateWorkoutMainView: View {
|
||||
}
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
.overlay(Group {
|
||||
if($viewModel.superSets.isEmpty) {
|
||||
ZStack() {
|
||||
Color(uiColor: .secondarySystemBackground)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Divider()
|
||||
|
||||
HStack {
|
||||
Button("Add Superset", action: {
|
||||
@@ -101,7 +106,9 @@ 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)
|
||||
|
||||
18
Werkout_ios/Views/OvalTextFieldStyle.swift
Normal file
18
Werkout_ios/Views/OvalTextFieldStyle.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// OvalTextFieldStyle.swift
|
||||
// Werkout_ios
|
||||
//
|
||||
// Created by Trey Tartt on 7/6/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OvalTextFieldStyle: TextFieldStyle {
|
||||
func _body(configuration: TextField<Self._Label>) -> some View {
|
||||
configuration
|
||||
.padding(10)
|
||||
.background(LinearGradient(gradient: Gradient(colors: [Color(uiColor: .secondarySystemBackground), Color(uiColor: .secondarySystemBackground)]), startPoint: .topLeading, endPoint: .bottomTrailing))
|
||||
.cornerRadius(20)
|
||||
.shadow(color: Color(red: 120/255, green: 120/255, blue: 120/255, opacity: 1), radius: 5)
|
||||
}
|
||||
}
|
||||
@@ -31,13 +31,14 @@ struct WorkoutDetailView: View {
|
||||
case .loading:
|
||||
Text("Loading")
|
||||
case .showWorkout(let workout):
|
||||
VStack {
|
||||
VStack(spacing: 0) {
|
||||
if bridgeModule.isInWorkout {
|
||||
HStack {
|
||||
CurrentWorkoutElapsedTimeView()
|
||||
CountdownView()
|
||||
}
|
||||
.padding()
|
||||
.background(Color(uiColor: .systemBackground))
|
||||
|
||||
GeometryReader { metrics in
|
||||
PlayerView(player: $avPlayer)
|
||||
@@ -45,12 +46,16 @@ struct WorkoutDetailView: View {
|
||||
.onAppear{
|
||||
avPlayer.play()
|
||||
}
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
}
|
||||
}
|
||||
|
||||
InfoView(workout: workout)
|
||||
Divider()
|
||||
.padding([.leading, .trailing])
|
||||
.padding(.bottom)
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
|
||||
ExerciseListView(workout: workout)
|
||||
|
||||
ActionsView(completedWorkout: {
|
||||
bridgeModule.completeWorkout()
|
||||
}, planWorkout: { workout in
|
||||
@@ -59,6 +64,7 @@ struct WorkoutDetailView: View {
|
||||
.frame(height: 44)
|
||||
|
||||
}
|
||||
.background(Color(uiColor: .secondarySystemBackground))
|
||||
.sheet(item: $presentedSheet) { item in
|
||||
switch item {
|
||||
case .completedWorkout(let data):
|
||||
@@ -263,7 +269,7 @@ struct CurrentWorkoutElapsedTimeView: View {
|
||||
|
||||
var body: some View {
|
||||
if bridgeModule.currentWorkoutRunTimeInSeconds > -1 {
|
||||
Text("\(bridgeModule.currentWorkoutRunTimeInSeconds)")
|
||||
Text("\(Double(bridgeModule.currentWorkoutRunTimeInSeconds).asString(style: .positional))")
|
||||
.font(.title2)
|
||||
}
|
||||
}
|
||||
@@ -304,24 +310,41 @@ struct ExerciseListView: View {
|
||||
Text(obj.exercise.name)
|
||||
.id(i)
|
||||
|
||||
Spacer()
|
||||
|
||||
if let reps = obj.reps,
|
||||
reps > 0 {
|
||||
Text("Reps: \(reps)")
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
}
|
||||
if let weight = obj.weight,
|
||||
weight > 0 {
|
||||
Text(" - Weight: \(weight)")
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
HStack {
|
||||
Image(systemName: "number")
|
||||
.foregroundColor(.white)
|
||||
.frame(width: 20, alignment: .leading)
|
||||
Text("\(reps)")
|
||||
.foregroundColor(.white)
|
||||
.frame(width: 30, alignment: .trailing)
|
||||
|
||||
}
|
||||
.padding(5)
|
||||
.background(.blue)
|
||||
.cornerRadius(5, corners: [.topLeft, .bottomLeft])
|
||||
.frame(alignment: .trailing)
|
||||
}
|
||||
|
||||
if let duration = obj.duration,
|
||||
duration > 0 {
|
||||
Text("Duration: \(duration)")
|
||||
.frame(maxWidth: .infinity, alignment: .trailing)
|
||||
HStack {
|
||||
Image(systemName: "stopwatch")
|
||||
.foregroundColor(.white)
|
||||
.frame(width: 20, alignment: .leading)
|
||||
Text("\(duration)")
|
||||
.foregroundColor(.white)
|
||||
.frame(width: 30, alignment: .trailing)
|
||||
}
|
||||
.padding(5)
|
||||
.background(.green)
|
||||
.cornerRadius(5, corners: [.topLeft, .bottomLeft])
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.trailing, -20)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
if bridgeModule.isInWorkout {
|
||||
|
||||
Reference in New Issue
Block a user