(fix): remove unused dependencies
(fix): remove dead code (fix): remove unused exports
This commit is contained in:
parent
2a8fade420
commit
be56080ba1
29 changed files with 168 additions and 338 deletions
|
|
@ -2,17 +2,12 @@ import { type ReactNode } from "react";
|
|||
|
||||
import Sidebar from "@/components/sidebar";
|
||||
import Navbar, { MobileNavbar } from "@/components/navbar";
|
||||
import { useShowMobileNavbar } from "./useShowMobileNavbar";
|
||||
|
||||
import { useIsMobile, cn, SidebarProvider } from "@tensamin/ui";
|
||||
|
||||
import { isTauri } from "@tauri-apps/api/core";
|
||||
import { useLocation, useMatches } from "@tanstack/react-router";
|
||||
|
||||
/**
|
||||
* Executes Layout.
|
||||
* @param props Parameter props.
|
||||
* @returns unknown.
|
||||
*/
|
||||
export default function Layout({ children }: { children: ReactNode }) {
|
||||
const isMobile = useIsMobile();
|
||||
const showMobileNavbar = useShowMobileNavbar();
|
||||
|
|
@ -47,17 +42,3 @@ export default function Layout({ children }: { children: ReactNode }) {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function useShowMobileNavbar(): boolean {
|
||||
const matches = useMatches();
|
||||
const location = useLocation();
|
||||
|
||||
const value = matches.some(
|
||||
(match) =>
|
||||
match.pathname === location.pathname &&
|
||||
// @ts-expect-error Stuff
|
||||
match.staticData?.showMobileNavbar === true,
|
||||
);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
|
|||
14
apps/web/src/routes/app/useShowMobileNavbar.ts
Normal file
14
apps/web/src/routes/app/useShowMobileNavbar.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { useLocation, useMatches } from "@tanstack/react-router";
|
||||
|
||||
export function useShowMobileNavbar(): boolean {
|
||||
const matches = useMatches();
|
||||
const location = useLocation();
|
||||
|
||||
return matches.some(
|
||||
(match) =>
|
||||
match.pathname === location.pathname &&
|
||||
// Router staticData is app-defined and not typed by the route matcher here.
|
||||
// @ts-expect-error App route metadata
|
||||
match.staticData?.showMobileNavbar === true,
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue