feat(dashboards): add error and not-found pages for admin and tracker dashboards
This commit is contained in:
parent
33160a5daa
commit
c3885059cf
33
dashboards/admin-web/src/app/error.tsx
Normal file
33
dashboards/admin-web/src/app/error.tsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
|
export default function GlobalError({
|
||||||
|
error,
|
||||||
|
reset,
|
||||||
|
}: {
|
||||||
|
error: Error & { digest?: string };
|
||||||
|
reset: () => void;
|
||||||
|
}) {
|
||||||
|
useEffect(() => {
|
||||||
|
// TODO: send to telemetry once wired
|
||||||
|
}, [error]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex min-h-screen items-center justify-center p-4">
|
||||||
|
<div className="mx-auto max-w-md text-center">
|
||||||
|
<div className="mb-4 text-5xl">⚠</div>
|
||||||
|
<h2 className="mb-2 text-xl font-semibold">Something went wrong</h2>
|
||||||
|
<p className="mb-6 text-sm text-muted-foreground">
|
||||||
|
{error.message || 'An unexpected error occurred.'}
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
onClick={reset}
|
||||||
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90"
|
||||||
|
>
|
||||||
|
Try again
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
21
dashboards/admin-web/src/app/not-found.tsx
Normal file
21
dashboards/admin-web/src/app/not-found.tsx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
|
export default function NotFound() {
|
||||||
|
return (
|
||||||
|
<div className="flex min-h-screen items-center justify-center p-4">
|
||||||
|
<div className="mx-auto max-w-md text-center">
|
||||||
|
<div className="mb-4 text-6xl font-bold text-muted-foreground">404</div>
|
||||||
|
<h2 className="mb-2 text-xl font-semibold">Page not found</h2>
|
||||||
|
<p className="mb-6 text-sm text-muted-foreground">
|
||||||
|
The page you're looking for doesn't exist or has been moved.
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
href="/"
|
||||||
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90"
|
||||||
|
>
|
||||||
|
Go to Dashboard
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
33
dashboards/tracker-web/src/app/error.tsx
Normal file
33
dashboards/tracker-web/src/app/error.tsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
|
export default function GlobalError({
|
||||||
|
error,
|
||||||
|
reset,
|
||||||
|
}: {
|
||||||
|
error: Error & { digest?: string };
|
||||||
|
reset: () => void;
|
||||||
|
}) {
|
||||||
|
useEffect(() => {
|
||||||
|
// TODO: send to telemetry once wired
|
||||||
|
}, [error]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex min-h-screen items-center justify-center p-4">
|
||||||
|
<div className="mx-auto max-w-md text-center">
|
||||||
|
<div className="mb-4 text-5xl">⚠</div>
|
||||||
|
<h2 className="mb-2 text-xl font-semibold">Something went wrong</h2>
|
||||||
|
<p className="mb-6 text-sm text-muted-foreground">
|
||||||
|
{error.message || 'An unexpected error occurred.'}
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
onClick={reset}
|
||||||
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90"
|
||||||
|
>
|
||||||
|
Try again
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
21
dashboards/tracker-web/src/app/not-found.tsx
Normal file
21
dashboards/tracker-web/src/app/not-found.tsx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
|
export default function NotFound() {
|
||||||
|
return (
|
||||||
|
<div className="flex min-h-screen items-center justify-center p-4">
|
||||||
|
<div className="mx-auto max-w-md text-center">
|
||||||
|
<div className="mb-4 text-6xl font-bold text-muted-foreground">404</div>
|
||||||
|
<h2 className="mb-2 text-xl font-semibold">Page not found</h2>
|
||||||
|
<p className="mb-6 text-sm text-muted-foreground">
|
||||||
|
The page you're looking for doesn't exist or has been moved.
|
||||||
|
</p>
|
||||||
|
<Link
|
||||||
|
href="/"
|
||||||
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90"
|
||||||
|
>
|
||||||
|
Go Home
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user