//
//  ContentView.swift
//  Werkout_ios
//
//  Created by Trey Tartt on 6/13/23.
//

import SwiftUI
import CoreData

struct MainView: View {
    @State var workout: Workout?
    @StateObject var bridgeModule = BridgeModule.shared

    var body: some View {
        ZStack {
            if let workout = workout {
                let vm = WorkoutDetailViewModel(workout: workout, isPreview: true)
                WorkoutDetailView(viewModel: vm)
            } else {
                Text("no workout selected")
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        MainView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext)
    }
}
