@_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: 66)
        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: 59)
        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: 19)
        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) Cards")
                        }
                    }
                    .padding(.horizontal, __designTimeInteger("#17913.[2].[4].property.[0].[0].arg[0].value.[0].arg[0].value.[0].arg[1].value.[0].modifier[0].arg[1].value", fallback: 8))
                    .padding(.vertical, __designTimeInteger("#17913.[2].[4].property.[0].[0].arg[0].value.[0].arg[0].value.[0].arg[1].value.[0].modifier[1].arg[1].value", fallback: 3))
                }
                .onDelete(perform: deleteItems)
                
            }
            .toolbar {
//                ToolbarItem(placement: .navigationBarTrailing) {
//                    EditButton()
//                }
                ToolbarItem {
                    Button(action: { addNewProject.toggle() }) {
                        Label(__designTimeString("#17913.[2].[4].property.[0].[0].arg[0].value.[0].modifier[0].arg[0].value.[0].arg[0].value.[0].arg[1].value.[0].arg[0].value", fallback: "Add Item"), systemImage: __designTimeString("#17913.[2].[4].property.[0].[0].arg[0].value.[0].modifier[0].arg[0].value.[0].arg[0].value.[0].arg[1].value.[0].arg[1].value", fallback: "plus"))
                    }
                }
            }
            .navigationTitle(__designTimeString("#17913.[2].[4].property.[0].[0].arg[0].value.[0].modifier[1].arg[0].value", fallback: "Projects"))
        } detail: {
            Text(__designTimeString("#17913.[2].[4].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)
    
    let p = OCProject(name: "test project", color: "ffffff")
    container.mainContext.insert(PreviewData.project)
    
    return MainView()
            .modelContainer(container)
}



