mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-28 10:26:33 +02:00
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
|
|
"use client";
|
||
|
|
|
||
|
|
import Link from "next/link";
|
||
|
|
import { useEffect } from "react";
|
||
|
|
|
||
|
|
export default function DashboardError({
|
||
|
|
error,
|
||
|
|
reset,
|
||
|
|
}: {
|
||
|
|
error: globalThis.Error & { digest?: string };
|
||
|
|
reset: () => void;
|
||
|
|
}) {
|
||
|
|
useEffect(() => {
|
||
|
|
import("posthog-js")
|
||
|
|
.then(({ default: posthog }) => {
|
||
|
|
posthog.captureException(error);
|
||
|
|
})
|
||
|
|
.catch(() => {});
|
||
|
|
}, [error]);
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="flex flex-1 flex-col items-center justify-center gap-4 p-8 text-center">
|
||
|
|
<h2 className="text-xl font-semibold">Something went wrong</h2>
|
||
|
|
<p className="text-muted-foreground max-w-md">
|
||
|
|
An error occurred in this section. Your dashboard is still available.
|
||
|
|
</p>
|
||
|
|
<div className="flex gap-2">
|
||
|
|
<button
|
||
|
|
type="button"
|
||
|
|
onClick={reset}
|
||
|
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors"
|
||
|
|
>
|
||
|
|
Try again
|
||
|
|
</button>
|
||
|
|
<Link
|
||
|
|
href="/dashboard"
|
||
|
|
className="rounded-md border border-input bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground transition-colors"
|
||
|
|
>
|
||
|
|
Go to dashboard home
|
||
|
|
</Link>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|