Something went wrong. Try again.
A self-hosted web platform for applications & services with design based on Google's Material 3 Expressive. (Work In Progress)
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130import DELETE_ICON from "@material-symbols/svg-700/outlined/delete.svg";import FOLDER_ICON from "@material-symbols/svg-700/outlined/folder.svg";import HARD_DRIVE_ICON from "@material-symbols/svg-700/outlined/hard_drive.svg";import HOUSE_ICON from "@material-symbols/svg-700/outlined/house.svg";import PERSON_ICON from "@material-symbols/svg-700/outlined/person.svg";import UKSideBar from "@ewsgit/uikit-solid/src/components/sideBar/UKSideBar.tsx";import { useNavigate } from "@solidjs/router";import browserPath from "path-browserify";import { type Component, type ParentProps, Show, Suspense, useContext } from "solid-js";import { AppContext } from "../appContext.ts";import type { UniformResourceLocator } from "../lib/filesystemInterface.ts";import PreviewDialog from "./components/PreviewDialog/PreviewDialog.tsx";import PreviewPane from "./components/PreviewPane/PreviewPane.tsx";import Quota from "./components/Quota/Quota.tsx";import styles from "./Layout.module.scss";
const Layout: Component<ParentProps> = (props) => { const navigate = useNavigate(); const appContext = useContext(AppContext);
return ( <> <UKSideBar className={styles.sidebar} darwinAdditionalTopMargin={localStorage.getItem("onlineworkspace_workspace_desktop_platform") === "darwin"} items={[ { type: "label", label: "Files", }, { type: "button", icon: { type: "icon", value: HOUSE_ICON }, label: "Home", onClick() { navigate(`/app/uk.ewsgit.files/dir?path=${appContext?.userPreferences.homePath}`); }, }, { type: "button", icon: { type: "icon", value: PERSON_ICON }, label: "Shared With Me", onClick() { navigate("/app/uk.ewsgit.files/shared"); }, }, { type: "divider", }, { type: "label", label: "Pinned", }, ...((appContext?.userPreferences.pinnedDirectories || []).map((dir) => { return { type: "button", icon: { type: "icon", value: FOLDER_ICON }, label: browserPath.basename(dir), onClick() { let transformedPath = dir;
if (dir.startsWith("~")) transformedPath = dir.replace("~", appContext?.userPreferences.homePath || "~");
navigate(`/app/uk.ewsgit.files/dir?path=${transformedPath}`); }, }; }) as { type: "button"; icon: { type: "icon"; value: string }; label: string; onClick(): void; }[]), ...((appContext?.isDesktopApp ? [ { type: "divider" }, { type: "label", label: "Local" }, { type: "button", icon: { type: "icon", value: HARD_DRIVE_ICON }, label: "Root (Local)", onClick() { navigate(`/app/uk.ewsgit.files/dir?path=local:/`); }, }, ] : []) as { type: "button"; icon: { type: "icon"; value: string }; label: string; onClick(): void; }[]), { type: "margin" }, { type: "button", icon: { type: "icon", value: DELETE_ICON }, label: "Bin", badgeLabel: appContext?.globalState.deletedItemCount || undefined, onClick() { navigate("/app/uk.ewsgit.files/bin"); }, }, { type: "divider", }, { type: "label", label: "Quota", }, { type: "component", component: Quota, }, ]} > <div class={styles.root}> {props.children} <PreviewPane /> </div> </UKSideBar> <Suspense> <Show when={appContext?.globalState.showPreview === true && appContext.isDesktopApp === false}> <PreviewDialog pathUrl={appContext!.viewState[appContext!.globalState.activeViewId].lastSelectedItem! as UniformResourceLocator} /> </Show> </Suspense> </> );};
export default Layout;