//
//  CountdownLiveView.swift
//  LeCountdown
//
//  Created by Laurent Morvillier on 01/02/2023.
//

import SwiftUI

struct CountdownDialView: View {

    @EnvironmentObject var conductor: Conductor
    
    @ObservedObject var countdown: Countdown
    
    @State var isEditing: Bool
    
    var body: some View {
        
        HStack {
            VStack(alignment: .leading) {
                Text(countdown.activity?.name?.uppercased() ?? "")
                    .foregroundColor(isEditing ? .white : .black)
                    .multilineTextAlignment(.leading)
                Text(countdown.duration.minuteSecond)
                    .fontWeight(.semibold)
                    .foregroundColor(.accentColor)
            }
            Spacer()
        }
    }
    
}

struct CountdownLiveView_Previews: PreviewProvider {
    static var previews: some View {
        CountdownDialView(countdown: Countdown.fake(context: PersistenceController.preview.container.viewContext), isEditing: false)
            .background(.cyan)
            .environmentObject(Conductor.maestro)
    }
}
