import { useEffect, useState } from "react"; import { useVersion } from "./store/version"; import FileView from "./components/file-view"; import Directory from "./components/directory"; import { DirEntry, usePath } from "./store/path"; import { DynamicIcon } from "lucide-react/dynamic"; import { BrowserRouter, Route, Routes, useLocation } from "react-router"; import "./App.scss"; import kuma from "./assets/kuma.png"; import NotFound from "./components/notfound"; function App() { return ( } /> ); } function Dashboard() { const path = usePath(); const location = useLocation(); const [load, setLoad] = useState(false); useEffect(() => { if (!load) { path.update(location.pathname.substring(1, location.pathname.length)).then(() => { setLoad(true); }); return; } }, [load, path, location]); if (!load) { return <>; } return (
{typeof path.data !== "undefined" ? path.data.is_dir ? : : }
); } function Header() { return ( ); } function Footer() { const path = usePath(); let file = 0; let dir = 0; const version = useVersion(); const [load, setLoad] = useState(false); if (typeof path.data !== "undefined") { if (path.data.is_dir) { path.data.entries.forEach((entry: DirEntry) => { if (entry.is_dir) { dir += 1; } else { file += 1; } }); } } useEffect(() => { if (!load) { version.update().then(() => { setLoad(true); }); return; } }, [load, version]); return ( ); } export default App;