import { useEffect, useState } from "react"; 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 FileView from "./components/file-view"; 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)); setLoad(true); return; } const id = setInterval(() => { path.update(location.pathname.substring(1, location.pathname.length)); }, 5000); return () => clearInterval(id); }, [load, path, location]); if (!load) { return <>; } return (
{typeof path.data !== "undefined" ? path.data.is_dir ? : : ( <>

404 Not Found

)}
); } function Header() { // const [open, setOpen] = useState(false); return ( ); } // TODO: create menu modal // function MenuView({ open, setOpen }: { open: boolean; setOpen: (value: boolean) => void }) { // return ( //
// { // setOpen(false); // }} /> //
// ); // } // function MenuItem({ icon, name, block }: { icon: IconName, name: string, block?: () => void }) { // return ( // { // ev.preventDefault(); // if (typeof block === "undefined") // return; // block(); // }}> // // {name} // // ); // } function Footer() { const path = usePath(); let file = 0; let dir = 0; 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; } }); } } return ( ); } export default App;