import UKNavigationRail from "@ewsgit/uikit-solid/src/components/navigationRail/UKNavigationRail.tsx"; import UKText from "@ewsgit/uikit-solid/src/components/text/UKText.tsx"; import useIsMobile from "@ewsgit/uikit-solid/src/core/useIsMobile.js"; import { useLocation, useNavigate } from "@solidjs/router"; import { type Component, createResource, createSignal, type ParentProps, Show, } from "solid-js"; import trpc from "../../lib/trpc"; import NavigationRailApplications from "./components/NavigationRail/components/navigationRailApplications/NavigationRailApplications"; import NavigationRailAvatar from "./components/NavigationRail/components/navigationRailAvatar/NavigationRailAvatar"; import NavigationRailClock from "./components/NavigationRail/components/navigationRailClock/NavigationRailClock"; import NavigationRailNotifications from "./components/NavigationRail/components/navigationRailNotifications/NavigationRailNotifications"; import styles from "./Navigation.module.scss"; const AppNavigation: Component = (props) => { const location = useLocation(); const navigate = useNavigate(); const isMobile = useIsMobile(); const [quickShortcuts] = createResource( () => trpc.app.navigation.getQuickShortcuts.query(), { initialValue: [] }, ); const [expanded, setExpanded] = createSignal(false); const [toggledDrawer, setToggledDrawer] = createSignal< "applications" | "notifications" | false >(false); return ( { return { icon: sc.icon || { type: "icon", value: "indeterminate_question_box", }, label: sc.label, active: location.pathname.startsWith(sc.location.value), onClick() { if (sc.location.type === "local") { navigate(sc.location.value); } else if (sc.location.type === "remote") { window.location.href = sc.location.value; } }, onMiddleClick() { if (sc.location.type === "local") { window.open(sc.location.value, "_blank"); } else if (sc.location.type === "remote") { window.open(sc.location.value, "_blank"); } }, }; }) .slice(0, isMobile() ? 3 : undefined)} setExpanded={isMobile() ? undefined : (expandedState) => setExpanded(expandedState)} anchorPoints={{ topMost: ( <> ), top: ( <> ), bottom: ( <> { if (toggledDrawer() === "applications") { setToggledDrawer(false); } else { setToggledDrawer(str); } }} expanded={expanded()} /> Dev Build { if (toggledDrawer() === "notifications") { setToggledDrawer(false); } else { setToggledDrawer(drawerState); } }} expanded={expanded()} /> ), }} >
{props.children}
); }; export default AppNavigation;