wip
This commit is contained in:
		@@ -2,8 +2,8 @@ import SwiftData
 | 
			
		||||
 | 
			
		||||
enum SchemaVersion {
 | 
			
		||||
    static var models: [any PersistentModel.Type] = [
 | 
			
		||||
        Split.self,
 | 
			
		||||
        Exercise.self,
 | 
			
		||||
//        Split.self,
 | 
			
		||||
//        Exercise.self,
 | 
			
		||||
        Workout.self,
 | 
			
		||||
        WorkoutLog.self
 | 
			
		||||
    ]
 | 
			
		||||
 
 | 
			
		||||
@@ -77,12 +77,21 @@ struct ExerciseProgressControlView: View {
 | 
			
		||||
                        .tag(index)
 | 
			
		||||
                } else {
 | 
			
		||||
                    ExerciseStateView(
 | 
			
		||||
                        state: state,
 | 
			
		||||
                        title: state.isRest ? "Resting..." : state.isDone ? "Done" : "Set \(currentStateIndex)",
 | 
			
		||||
                        isRest: state.isRest,
 | 
			
		||||
                        isDone: state.isDone,
 | 
			
		||||
                        elapsedSeconds: elapsedSeconds,
 | 
			
		||||
                        onComplete: {
 | 
			
		||||
                            moveToNextState()
 | 
			
		||||
                        }
 | 
			
		||||
                    )
 | 
			
		||||
                            //
 | 
			
		||||
                        })
 | 
			
		||||
//                    ExerciseStateView(
 | 
			
		||||
////                        state: state,
 | 
			
		||||
//                        
 | 
			
		||||
//                        elapsedSeconds: elapsedSeconds,
 | 
			
		||||
//                        onComplete: {
 | 
			
		||||
//                            moveToNextState()
 | 
			
		||||
//                        }
 | 
			
		||||
//                    )
 | 
			
		||||
                    .tag(index)
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -185,39 +194,30 @@ struct ExerciseProgressControlView: View {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct ExerciseStateView: View {
 | 
			
		||||
    let state: ExerciseState
 | 
			
		||||
//    let state: ExerciseState
 | 
			
		||||
    let title: String
 | 
			
		||||
    let isRest: Bool
 | 
			
		||||
    let isDone: Bool
 | 
			
		||||
    let elapsedSeconds: Int
 | 
			
		||||
    let onComplete: () -> Void
 | 
			
		||||
    
 | 
			
		||||
    var body: some View {
 | 
			
		||||
        VStack(spacing: 20) {
 | 
			
		||||
            // Title based on state
 | 
			
		||||
            Text(stateTitle)
 | 
			
		||||
                .font(.title3)
 | 
			
		||||
                .fontWeight(.bold)
 | 
			
		||||
            
 | 
			
		||||
            Text(title)
 | 
			
		||||
                .font(.title)
 | 
			
		||||
            
 | 
			
		||||
            // Timer display
 | 
			
		||||
            Text(timeFormatted)
 | 
			
		||||
                .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
 | 
			
		||||
            if state.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)
 | 
			
		||||
                }
 | 
			
		||||
                
 | 
			
		||||
            if isDone {
 | 
			
		||||
                // Done button
 | 
			
		||||
                Button(action: onComplete) {
 | 
			
		||||
                    Text("Done")
 | 
			
		||||
                    Text("Done in \(10 - elapsedSeconds)s")
 | 
			
		||||
                        .font(.headline)
 | 
			
		||||
                        .frame(maxWidth: .infinity)
 | 
			
		||||
                }
 | 
			
		||||
@@ -229,18 +229,18 @@ struct ExerciseStateView: View {
 | 
			
		||||
        .padding()
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    private var stateTitle: String {
 | 
			
		||||
        switch state {
 | 
			
		||||
        case .set(let number):
 | 
			
		||||
            return "Set \(number) in progress"
 | 
			
		||||
        case .rest:
 | 
			
		||||
            return "Resting"
 | 
			
		||||
        case .done:
 | 
			
		||||
            return "Exercise Complete"
 | 
			
		||||
        case .detail:
 | 
			
		||||
            return "Swipe to Start"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
//    private var stateTitle: String {
 | 
			
		||||
//        switch state {
 | 
			
		||||
//        case .set(let number):
 | 
			
		||||
//            return "Set \(number)"
 | 
			
		||||
//        case .rest:
 | 
			
		||||
//            return "Resting..."
 | 
			
		||||
//        case .done:
 | 
			
		||||
//            return "Exercise Complete"
 | 
			
		||||
//        case .detail:
 | 
			
		||||
//            return "Swipe to Start"
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
    
 | 
			
		||||
//    private var buttonTitle: String {
 | 
			
		||||
//        switch state {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user