mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
public commit
This commit is contained in:
52
app/src/ui/routes/root.tsx
Normal file
52
app/src/ui/routes/root.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
import { IconFingerprint, IconHome } from "@tabler/icons-react";
|
||||
import { isDebug } from "core";
|
||||
import { Suspense, lazy, useEffect } from "react";
|
||||
import { useAuth } from "ui";
|
||||
import { Empty } from "../components/display/Empty";
|
||||
import { useBrowserTitle } from "../hooks/use-browser-title";
|
||||
import * as AppShell from "../layouts/AppShell/AppShell";
|
||||
import { useNavigate } from "../lib/routes";
|
||||
|
||||
// @todo: package is still required somehow
|
||||
const ReactQueryDevtools = (p: any) => null; /*!isDebug()
|
||||
? () => null // Render nothing in production
|
||||
: lazy(() =>
|
||||
import("@tanstack/react-query-devtools").then((res) => ({
|
||||
default: res.ReactQueryDevtools,
|
||||
})),
|
||||
);*/
|
||||
|
||||
export const Root = ({ children }) => {
|
||||
const { verify } = useAuth();
|
||||
|
||||
useEffect(() => {
|
||||
verify();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<AppShell.Root>
|
||||
<AppShell.Header />
|
||||
<AppShell.Content>{children}</AppShell.Content>
|
||||
|
||||
<Suspense>
|
||||
<ReactQueryDevtools buttonPosition="bottom-left" />
|
||||
</Suspense>
|
||||
</AppShell.Root>
|
||||
);
|
||||
};
|
||||
|
||||
export function RootEmpty() {
|
||||
const [navigate] = useNavigate();
|
||||
useEffect(() => {
|
||||
navigate("/data");
|
||||
}, []);
|
||||
|
||||
useBrowserTitle();
|
||||
return (
|
||||
<Empty
|
||||
Icon={IconHome}
|
||||
title="Not implemented yet"
|
||||
description={`Go checkout "Data" or "Media" for some action.`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user