This commit is contained in:
2025-07-22 20:55:04 -04:00
parent d2b8625f2e
commit 310c120ca3
2 changed files with 37 additions and 37 deletions

View File

@ -2,8 +2,8 @@ import SwiftData
enum SchemaVersion { enum SchemaVersion {
static var models: [any PersistentModel.Type] = [ static var models: [any PersistentModel.Type] = [
Split.self, // Split.self,
Exercise.self, // Exercise.self,
Workout.self, Workout.self,
WorkoutLog.self WorkoutLog.self
] ]

View File

@ -77,12 +77,21 @@ struct ExerciseProgressControlView: View {
.tag(index) .tag(index)
} else { } else {
ExerciseStateView( ExerciseStateView(
state: state, title: state.isRest ? "Resting..." : state.isDone ? "Done" : "Set \(currentStateIndex)",
isRest: state.isRest,
isDone: state.isDone,
elapsedSeconds: elapsedSeconds, elapsedSeconds: elapsedSeconds,
onComplete: { onComplete: {
moveToNextState() //
} })
) // ExerciseStateView(
//// state: state,
//
// elapsedSeconds: elapsedSeconds,
// onComplete: {
// moveToNextState()
// }
// )
.tag(index) .tag(index)
} }
} }
@ -185,39 +194,30 @@ struct ExerciseProgressControlView: View {
} }
struct ExerciseStateView: View { struct ExerciseStateView: View {
let state: ExerciseState // let state: ExerciseState
let title: String
let isRest: Bool
let isDone: Bool
let elapsedSeconds: Int let elapsedSeconds: Int
let onComplete: () -> Void let onComplete: () -> Void
var body: some View { var body: some View {
VStack(spacing: 20) { VStack(spacing: 20) {
// Title based on state // Title based on state
Text(stateTitle)
.font(.title3) Text(title)
.fontWeight(.bold) .font(.title)
// Timer display // Timer display
Text(timeFormatted) Text(timeFormatted)
.font(.system(size: 48, weight: .semibold, design: .monospaced)) .font(.system(size: 48, weight: .semibold, design: .monospaced))
.foregroundStyle(state.isRest ? .orange : .accentColor) .foregroundStyle(isRest ? .orange : .accentColor)
// Only show Done button and countdown for the final state // Only show Done button and countdown for the final state
if state.isDone { if isDone {
// Countdown message
if elapsedSeconds < 10 {
Text("Completing automatically in \(10 - elapsedSeconds) seconds")
.font(.caption)
.multilineTextAlignment(.center)
.foregroundStyle(.secondary)
} else {
Text("Auto-completing...")
.font(.caption)
.foregroundStyle(.secondary)
}
// Done button // Done button
Button(action: onComplete) { Button(action: onComplete) {
Text("Done") Text("Done in \(10 - elapsedSeconds)s")
.font(.headline) .font(.headline)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
} }
@ -229,18 +229,18 @@ struct ExerciseStateView: View {
.padding() .padding()
} }
private var stateTitle: String { // private var stateTitle: String {
switch state { // switch state {
case .set(let number): // case .set(let number):
return "Set \(number) in progress" // return "Set \(number)"
case .rest: // case .rest:
return "Resting" // return "Resting..."
case .done: // case .done:
return "Exercise Complete" // return "Exercise Complete"
case .detail: // case .detail:
return "Swipe to Start" // return "Swipe to Start"
} // }
} // }
// private var buttonTitle: String { // private var buttonTitle: String {
// switch state { // switch state {