//
//  FileNode.swift
//  FastCoster
//
//  Created by Michael Pivato on 3/5/2024.
//

import SwiftUI

struct FileNodeView: View {
    @State private var showPicker = false
    @State private var selectedFileUrl: URL?
    var body: some View {
        // Should basically show a file selector.
        Button {
            showPicker.toggle()
        } label: {
            Text("Select File")
        }.fileImporter(isPresented: $showPicker, allowedContentTypes: [.commaSeparatedText]) { result in
            
            switch result {
            case .success(let fileUrl):
                selectedFileUrl = fileUrl
            case .failure(let error):
                print(error)
            }
        }.padding()
    }
}

#Preview {
    FileNodeView()
}
