import React from "react" import { useState } from "react" import { useOpenDirQuery } from "../generated/graphql" import Breadcrum from "./Breadcrum" import DragAndDrop from "./DragAndDrop" import FileBrowserElement from "./FileBrowserElement" import FileOpen from "./FileOpen" const FileBrowser: React.FC = () => { const [path,setPath] = useState("/") const [openFileId, setOpenFileId] = useState("") const [showFile, setShowFile] = useState(false) const { data, loading } = useOpenDirQuery({ variables:{ path } }) function handleDrop(files:FileList) { for (let i = 0; i < files.length; i++) { const file = files[i] console.debug(file) // TODO } } return (
{ setPath(newPath) }}/>
{loading &&
// TODO: center } { data?.directorys.map(v => ({ setPath(dir.id) }} />))} { data?.files.map(v => ({ setOpenFileId(file.id) setShowFile(true) }} />))}
Name Size
{{ setShowFile(false) }} />}
) } export default FileBrowser