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

import SwiftUI

struct AllWorkoutPickerView: View {
    var mainViews: [MainViewTypes]
    @Binding var selectedSegment: MainViewTypes
    @StateObject var bridgeModule = BridgeModule.shared
    var showCurrentWorkout: (() -> Void)
    
    var body: some View {
        HStack {
            Picker("", selection: $selectedSegment) {
                ForEach(mainViews, id: \.self) { viewType in
                    Text(viewType.title)
                }
            }
            .pickerStyle(.segmented)
            .padding([.top, .leading, .trailing])
            
            if bridgeModule.isInWorkout {
                Button(action: {
                    showCurrentWorkout()
                }, label: {
                    Image(systemName: "figure.strengthtraining.traditional")
                        .padding(.trailing)
                })
                .tint(Color("appColor"))
            }
        }
    }
}
