Reduced code duplication of ErrorBoundary, wrapped PageLayout with ErrorBoundary.
This commit is contained in:
+5
-25
@@ -17,31 +17,11 @@ export const PageRouter = () => {
|
|||||||
const { activePage } = useDevice();
|
const { activePage } = useDevice();
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary FallbackComponent={ErrorPage}>
|
<ErrorBoundary FallbackComponent={ErrorPage}>
|
||||||
{activePage === "messages" && (
|
{activePage === "messages" && <MessagesPage />}
|
||||||
<ErrorBoundary FallbackComponent={ErrorPage}>
|
{activePage === "map" && <MapPage />}
|
||||||
<MessagesPage />
|
{activePage === "config" && <ConfigPage />}
|
||||||
</ErrorBoundary>
|
{activePage === "channels" && <ChannelsPage />}
|
||||||
)}
|
{activePage === "nodes" && <NodesPage />}
|
||||||
{activePage === "map" && (
|
|
||||||
<ErrorBoundary FallbackComponent={ErrorPage}>
|
|
||||||
<MapPage />
|
|
||||||
</ErrorBoundary>
|
|
||||||
)}
|
|
||||||
{activePage === "config" && (
|
|
||||||
<ErrorBoundary FallbackComponent={ErrorPage}>
|
|
||||||
<ConfigPage />
|
|
||||||
</ErrorBoundary>
|
|
||||||
)}
|
|
||||||
{activePage === "channels" && (
|
|
||||||
<ErrorBoundary FallbackComponent={ErrorPage}>
|
|
||||||
<ChannelsPage />
|
|
||||||
</ErrorBoundary>
|
|
||||||
)}
|
|
||||||
{activePage === "nodes" && (
|
|
||||||
<ErrorBoundary FallbackComponent={ErrorPage}>
|
|
||||||
<NodesPage />
|
|
||||||
</ErrorBoundary>
|
|
||||||
)}
|
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { cn } from "@app/core/utils/cn.ts";
|
import { cn } from "@app/core/utils/cn.ts";
|
||||||
import { AlignLeftIcon, type LucideIcon } from "lucide-react";
|
import { AlignLeftIcon, type LucideIcon } from "lucide-react";
|
||||||
import Footer from "./UI/Footer.tsx";
|
import Footer from "@components/UI/Footer.tsx";
|
||||||
import { Spinner } from "./UI/Spinner.tsx";
|
import { Spinner } from "@components/UI/Spinner.tsx";
|
||||||
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
|
import { ErrorPage } from "@components/UI/ErrorPage.tsx";
|
||||||
|
|
||||||
export interface PageLayoutProps {
|
export interface PageLayoutProps {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -23,7 +25,7 @@ export const PageLayout = ({
|
|||||||
children,
|
children,
|
||||||
}: PageLayoutProps) => {
|
}: PageLayoutProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<ErrorBoundary FallbackComponent={ErrorPage}>
|
||||||
<div className="relative flex h-full w-full flex-col">
|
<div className="relative flex h-full w-full flex-col">
|
||||||
<div className="flex h-14 shrink-0 border-b-[0.5px] border-slate-300 dark:border-slate-700 md:h-16 md:px-4">
|
<div className="flex h-14 shrink-0 border-b-[0.5px] border-slate-300 dark:border-slate-700 md:h-16 md:px-4">
|
||||||
<button
|
<button
|
||||||
@@ -66,6 +68,6 @@ export const PageLayout = ({
|
|||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user