import { convert } from "../../util/unit"; import { DynamicIcon } from "lucide-react/dynamic"; import { DirEntry, usePath } from "../../store/path"; import "./directory.scss"; function Directory() { const path = usePath(); if (typeof path.data === "undefined") return <>; return (
Name Size Date
{path.data.path === "/" ? <> : ( )} {path.data.entries.map((entry, key) => { return ; })}
); } function DirItem({ data }: { data: DirEntry }) { return (
{data.is_dir ? ( ) : <>}
{data.name} {data.is_dir ? ( "-" ): convert(data.file_size)} {data.date === -1 ? "-" : new Date(data.date * 1000).toLocaleString("en-US", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", hour12: false }).replace(/,/g, "")}
); } export default Directory;