WIP
This commit is contained in:
@@ -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