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.
+
+
+
+
+ }
+ onClick={() => {
+ reset();
+ router.invalidate();
+ }}
+ >
+ Try again
+
+
+
+
+ );
+}
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,
});