WIP
This commit is contained in:
@@ -19,37 +19,18 @@ struct CompletedWorkoutView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text(workout.name)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.font(.title3)
|
||||
.padding(.top
|
||||
)
|
||||
if let desc = workout.description {
|
||||
Text(desc)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.font(.body)
|
||||
.padding(.top)
|
||||
|
||||
}
|
||||
topViews()
|
||||
|
||||
Divider()
|
||||
calsBurned()
|
||||
|
||||
Text("how hard was this shit")
|
||||
|
||||
HStack {
|
||||
Text("easy")
|
||||
Spacer()
|
||||
Text("Death")
|
||||
}
|
||||
|
||||
Slider(value: $difficulty, in: 0...5, step: 1)
|
||||
heartRates()
|
||||
|
||||
rateWorkout()
|
||||
|
||||
Divider()
|
||||
|
||||
TextField("Notes", text: $notes)
|
||||
|
||||
// Divider()
|
||||
|
||||
|
||||
Spacer()
|
||||
|
||||
Button("Upload", action: {
|
||||
@@ -66,6 +47,57 @@ struct CompletedWorkoutView: View {
|
||||
.padding([.leading, .trailing])
|
||||
}
|
||||
|
||||
func topViews() -> some View {
|
||||
VStack {
|
||||
Text(workout.name)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.font(.title3)
|
||||
.padding(.top
|
||||
)
|
||||
if let desc = workout.description {
|
||||
Text(desc)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.font(.body)
|
||||
.padding(.top)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func calsBurned() -> some View {
|
||||
VStack {
|
||||
Divider()
|
||||
Text("calroies burned")
|
||||
Text("\(postData["total_calories"] as! Float)")
|
||||
}
|
||||
}
|
||||
|
||||
func rateWorkout() -> some View {
|
||||
VStack {
|
||||
Divider()
|
||||
|
||||
Text("how hard was this shit")
|
||||
|
||||
HStack {
|
||||
Text("easy")
|
||||
Spacer()
|
||||
Text("Death")
|
||||
}
|
||||
|
||||
Slider(value: $difficulty, in: 0...5, step: 1)
|
||||
}
|
||||
}
|
||||
|
||||
func heartRates() -> some View {
|
||||
VStack {
|
||||
Divider()
|
||||
if let heartRates = postData["heart_rates"] as? [Int] {
|
||||
let avg = heartRates.reduce(0, +)/heartRates.count
|
||||
Text("Avg heart rate: \(avg)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func upload(postBody: [String: Any]) {
|
||||
var _postBody = postBody
|
||||
_postBody["difficulty"] = difficulty
|
||||
|
||||
Reference in New Issue
Block a user