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