//
//  EmptyView.swift
//  Feels (iOS)
//
//  Created by Trey Tartt on 2/10/22.
//

import SwiftUI

struct EmptyHomeView: View {
    @AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
    
    let viewModel: ContentModeViewModel
    
    var body: some View {
        ZStack {
            Color(theme.currentTheme.secondaryBGColor)
            
            VStack {
                Text(String(localized: "content_view_empty_title"))
                    .font(.title)
                    .foregroundColor(Color(UIColor.label))
                    .padding()
                
                Text(String(localized: "content_view_empty_title"))
                    .font(.body)
                    .foregroundColor(Color(UIColor.label))
                    .padding()
                AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
                    withAnimation {
                        viewModel.add(mood: mood, forDate: date, entryType: .header)
                    }
                })
            }
        }
        .fixedSize(horizontal: false, vertical: true)
        .cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
    }
}

struct EmptyHomeView_Previews: PreviewProvider {
    static var previews: some View {
        EmptyHomeView(viewModel: ContentModeViewModel(addMonthStartWeekdayPadding: false))
    }
}
