change folders to the "feature" mindset
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// ActiveWorkoutSessionControls.swift
|
||||
// WorkoutsPlus
|
||||
//
|
||||
// Created by Felix Förtsch on 16.09.24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ActiveWorkoutSessionControls: View {
|
||||
@Binding var session: WorkoutSession
|
||||
|
||||
var body: some View {
|
||||
|
||||
VStack {
|
||||
HStack {
|
||||
Text(session.getCurrentTodo())
|
||||
.font(.system(size: 24, weight: .bold, design: .rounded))
|
||||
}
|
||||
ProgressView("",
|
||||
value: session.getCurrentExerciseIndex(),
|
||||
total: session.getTotalExerciseCount() - 1
|
||||
)
|
||||
HStack {
|
||||
Button(action: {
|
||||
session.prevExercise()
|
||||
}) {
|
||||
HStack {
|
||||
Image(systemName: "backward.end.fill")
|
||||
Text("Prev")
|
||||
}
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.bold()
|
||||
.tint(.primary)
|
||||
Button(action: {
|
||||
// TODO: Implement proper Pausing
|
||||
session.pause()
|
||||
}) {
|
||||
HStack {
|
||||
Image(systemName: "pause.fill")
|
||||
Text("Pause")
|
||||
}
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.bold()
|
||||
.tint(.gray)
|
||||
.disabled(true)
|
||||
Button(action: {
|
||||
session.nextExercise()
|
||||
}) {
|
||||
HStack {
|
||||
Text("Next")
|
||||
Image(systemName: "forward.end.fill")
|
||||
}
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.bold()
|
||||
.tint(.primary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview("isWorkingOut = true") {
|
||||
@Previewable @State var activeWorkoutSession = WorkoutSession(start: Workout.sampleData.first!)
|
||||
|
||||
// For some reason the return keyword is required here to avoid the error "Type of expression is ambiguous without a type annotation"
|
||||
return ActiveWorkoutSessionControls(session: $activeWorkoutSession)
|
||||
.onAppear() {
|
||||
Defaults.shared.isWorkingOut = true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user