From 9586122bf910b8530cc206ad3f122caf83d38f3c Mon Sep 17 00:00:00 2001 From: Alan Daniel Date: Wed, 8 Apr 2026 14:20:37 -0400 Subject: [PATCH] Add custom error screen matching dashboard design system --- .../src/components/layouts/error-screen.tsx | 40 +++++++++++++++++++ apps/dashboard/src/routes/__root.tsx | 2 + apps/dashboard/src/routes/_protected.tsx | 2 + 3 files changed, 44 insertions(+) create mode 100644 apps/dashboard/src/components/layouts/error-screen.tsx diff --git a/apps/dashboard/src/components/layouts/error-screen.tsx b/apps/dashboard/src/components/layouts/error-screen.tsx new file mode 100644 index 0000000..3955d44 --- /dev/null +++ b/apps/dashboard/src/components/layouts/error-screen.tsx @@ -0,0 +1,40 @@ +import { Button } from "@quickhub/ui/components/button"; +import { type ErrorComponentProps, useRouter } from "@tanstack/react-router"; +import { AlertCircleIcon, RefreshCwIcon } from "lucide-react"; + +export function ErrorScreen({ reset }: ErrorComponentProps) { + const router = useRouter(); + + return ( +
+
+
+ +
+ +
+

+ Something went wrong +

+

+ An unexpected error occurred. Please try again or refresh the page. +

+
+ +
+ +
+
+
+ ); +} diff --git a/apps/dashboard/src/routes/__root.tsx b/apps/dashboard/src/routes/__root.tsx index bfa6dea..cced031 100644 --- a/apps/dashboard/src/routes/__root.tsx +++ b/apps/dashboard/src/routes/__root.tsx @@ -9,6 +9,7 @@ import { import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools"; import { Agentation } from "agentation"; import { ThemeProvider } from "next-themes"; +import { ErrorScreen } from "#/components/layouts/error-screen"; import appCss from "../styles.css?url"; @@ -24,6 +25,7 @@ export const Route = createRootRouteWithContext<{ links: [{ rel: "stylesheet", href: appCss }], }), component: RootComponent, + errorComponent: ErrorScreen, shellComponent: RootDocument, }); diff --git a/apps/dashboard/src/routes/_protected.tsx b/apps/dashboard/src/routes/_protected.tsx index c7b69ed..262ef60 100644 --- a/apps/dashboard/src/routes/_protected.tsx +++ b/apps/dashboard/src/routes/_protected.tsx @@ -1,5 +1,6 @@ import { createFileRoute, redirect } from "@tanstack/react-router"; import { DashboardLayout } from "#/components/layouts/dashboard-layout"; +import { ErrorScreen } from "#/components/layouts/error-screen"; import { getSession } from "#/lib/auth.functions"; export const Route = createFileRoute("/_protected")({ @@ -14,4 +15,5 @@ export const Route = createFileRoute("/_protected")({ return { user: session.user, session: session.session }; }, component: DashboardLayout, + errorComponent: ErrorScreen, });