//
//  CountdownView.swift
//  Werkout_ios
//
//  Created by Trey Tartt on 7/7/23.
//

import SwiftUI

struct CountdownView: View {
    @StateObject var bridgeModule = BridgeModule.shared
    
    var body: some View {
        if let duration = bridgeModule.currentExerciseInfo.currentExercise?.duration,
           duration > 0 {
            HStack {
                if bridgeModule.currentExerciseTimeLeft >= 0 && duration > bridgeModule.currentExerciseTimeLeft {
                    ProgressView(value: Float(bridgeModule.currentExerciseTimeLeft), total: Float(duration))
                        .tint(Color("appColor"))
                }
            }
        }
    }
}

struct CountdownView_Previews: PreviewProvider {
    static var previews: some View {
        CountdownView()
    }
}
