@_private(sourceFile: "MainView.swift") import OnCue
import func SwiftUI.__designTimeBoolean
import func SwiftUI.__designTimeInteger
import protocol SwiftUI.PreviewProvider
import func SwiftUI.__designTimeString
import func SwiftUI.__designTimeFloat
import struct SwiftUI.EmptyView
import protocol SwiftUI.View
import SwiftData
import SwiftUI

extension MainView {
    @_dynamicReplacement(for: deleteItems(offsets:)) private func __preview__deleteItems(offsets: IndexSet) {
        #sourceLocation(file: "/Users/pradyun/Code/Apps/OnCue/OnCue/View/MainView.swift", line: 78)
        withAnimation {
            for index in offsets {
                modelContext.delete(items[index])
            }
        }
    
#sourceLocation()
    }
}

extension MainView {
    @_dynamicReplacement(for: addItem(name:color:)) private func __preview__addItem(name: String, color: String) {
        #sourceLocation(file: "/Users/pradyun/Code/Apps/OnCue/OnCue/View/MainView.swift", line: 71)
        withAnimation {
            let newProject = OCProject(name: name, color: color)
            modelContext.insert(newProject)
        }
    
#sourceLocation()
    }
}

extension MainView {
    @_dynamicReplacement(for: body) private var __preview__body: some View {
        #sourceLocation(file: "/Users/pradyun/Code/Apps/OnCue/OnCue/View/MainView.swift", line: 20)
        NavigationSplitView {
            List {
                ForEach(items) { project in
                    NavigationLink {
                        CardsView(project: project)
                    } label: {
                        VStack(alignment: .leading) {
                            Text("\(project.name)")
                                .bold()
                                .font(.title2)
                                .foregroundStyle(Color(hex: project.color) ?? .white)
                            Text("\(project.cards.count) \(project.cards.count == __designTimeInteger("#2184.[2].[5].property.[0].[0].arg[0].value.[0].arg[0].value.[0].arg[1].value.[0].arg[1].value.[0].arg[1].value.[1].arg[0].value.[3].value.arg[0].value.if.[0]", fallback: 1) ? __designTimeString("#2184.[2].[5].property.[0].[0].arg[0].value.[0].arg[0].value.[0].arg[1].value.[0].arg[1].value.[0].arg[1].value.[1].arg[0].value.[3].value.arg[0].value.then", fallback: "Card") : __designTimeString("#2184.[2].[5].property.[0].[0].arg[0].value.[0].arg[0].value.[0].arg[1].value.[0].arg[1].value.[0].arg[1].value.[1].arg[0].value.[3].value.arg[0].value.else", fallback: "Cards"))")
                        }
                    }
                    .padding(.vertical, __designTimeInteger("#2184.[2].[5].property.[0].[0].arg[0].value.[0].arg[0].value.[0].arg[1].value.[0].modifier[0].arg[1].value", fallback: 3))
                }
                .onDelete(perform: deleteItems)
                
            }
            .toolbar {
//                ToolbarItem(placement: .topBarTrailing) {
//                    Menu {
//                        Picker(selection: $filterColor) {
//                            ForEach(Constants.colors, id: \.self) { clr in
//                                Circle()
//                                    .foregroundStyle(clr)
//                            }
//                        } label: {
//                            Text("Color")
//                        }
//                        .pickerStyle(.menu)
//                    } label: {
//                        Image(systemName: "line.3.horizontal.decrease.circle")
//                    }
//                }
                ToolbarItem(placement: .topBarTrailing) {
                    Button(action: { addNewProject.toggle() }) {
                        Label(__designTimeString("#2184.[2].[5].property.[0].[0].arg[0].value.[0].modifier[0].arg[0].value.[0].arg[1].value.[0].arg[1].value.[0].arg[0].value", fallback: "Add Item"), systemImage: __designTimeString("#2184.[2].[5].property.[0].[0].arg[0].value.[0].modifier[0].arg[0].value.[0].arg[1].value.[0].arg[1].value.[0].arg[1].value", fallback: "plus"))
                    }
                }
            }
            .navigationTitle(__designTimeString("#2184.[2].[5].property.[0].[0].arg[0].value.[0].modifier[1].arg[0].value", fallback: "Projects"))
        } detail: {
            Text(__designTimeString("#2184.[2].[5].property.[0].[0].arg[1].value.[0].arg[0].value", fallback: "Select an item"))
        }
        .sheet(isPresented: $addNewProject) {
            NewProjectForm(completionHandler: addItem)
        }
    
#sourceLocation()
    }
}

import struct OnCue.MainView
#Preview {
    let config = ModelConfiguration(isStoredInMemoryOnly: true)
    let container = try! ModelContainer(for: OCProject.self, configurations: config)
    
    container.mainContext.insert(PreviewData.project)
    
    return MainView()
        .modelContainer(container)
}



