import React from "react" import { useState } from "react" import { useOpenDirQuery } from "../generated/graphql" import FileBrowserElement from "./FileBrowserElement" function parentDir(path:string): string { if(path.endsWith("/")){ path = path.substr(0,path.length - 1) } const paths = path.split("/") paths.pop() return paths.join("/") } const FileBrowser: React.FC = () => { const [path,setPath] = useState("/") const { data } = useOpenDirQuery({ variables:{ path } }) return (
{ setPath(parentDir(path)) }}> ..
{ data?.files.map(v => ())} { data?.directorys.map(v => ({ setPath(data.id) }} />))}
) } export default FileBrowser