Skip to content

Commit 538dde9

Browse files
committed
Merge branch 'main' into fix/structured-data
2 parents 04606e5 + c9d58fc commit 538dde9

2 files changed

Lines changed: 67 additions & 49 deletions

File tree

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "@ethui/ui/components/shadcn/button";
12
import type { ErrorComponentProps } from "@tanstack/react-router";
23
import {
34
ErrorComponent,
@@ -13,42 +14,52 @@ export function DefaultCatchBoundary({ error }: ErrorComponentProps) {
1314
strict: false,
1415
select: (state) => state.id === rootRouteId,
1516
});
17+
const showErrorDetails = import.meta.env.DEV;
1618

1719
console.error("DefaultCatchBoundary Error:", error);
1820

1921
return (
20-
<div className="flex min-w-0 flex-1 flex-col items-center justify-center gap-6 p-4">
21-
<ErrorComponent error={error} />
22-
<div className="flex flex-wrap items-center gap-2">
23-
<button
24-
type="button"
25-
onClick={() => {
26-
router.invalidate();
27-
}}
28-
className="rounded bg-gray-600 px-2 py-1 font-extrabold text-white uppercase dark:bg-gray-700"
29-
>
30-
Try Again
31-
</button>
32-
{isRoot ? (
33-
<Link
34-
to="/"
35-
className="rounded bg-gray-600 px-2 py-1 font-extrabold text-white uppercase dark:bg-gray-700"
36-
>
37-
Home
38-
</Link>
39-
) : (
40-
<Link
41-
to="/"
42-
className="rounded bg-gray-600 px-2 py-1 font-extrabold text-white uppercase dark:bg-gray-700"
43-
onClick={(e) => {
44-
e.preventDefault();
45-
window.history.back();
22+
<div className="min-h-screen bg-white">
23+
<main className="container mx-auto flex min-h-[60vh] flex-col items-start justify-center gap-4 px-4 py-12 md:py-20">
24+
<p className="text-gray-500 text-sm uppercase tracking-wide">
25+
Something went wrong
26+
</p>
27+
<h1 className="font-bold text-3xl text-gray-900 sm:text-4xl">
28+
We hit an unexpected error
29+
</h1>
30+
<p className="max-w-2xl text-gray-600">
31+
Please try again. If the problem keeps happening, head back home and
32+
restart your flow.
33+
</p>
34+
{showErrorDetails && <ErrorComponent error={error} />}
35+
<div className="flex flex-wrap items-center gap-2">
36+
<Button
37+
type="button"
38+
onClick={() => {
39+
router.invalidate();
4640
}}
4741
>
48-
Go Back
49-
</Link>
50-
)}
51-
</div>
42+
Try again
43+
</Button>
44+
{isRoot ? (
45+
<Button asChild variant="secondary">
46+
<Link to="/">Home</Link>
47+
</Button>
48+
) : (
49+
<Button asChild variant="secondary">
50+
<Link
51+
to="/"
52+
onClick={(e) => {
53+
e.preventDefault();
54+
window.history.back();
55+
}}
56+
>
57+
Go back
58+
</Link>
59+
</Button>
60+
)}
61+
</div>
62+
</main>
5263
</div>
5364
);
5465
}

src/components/NotFound.tsx

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
1+
import { Button } from "@ethui/ui/components/shadcn/button";
12
import { Link } from "@tanstack/react-router";
23

34
export function NotFound({ children }: { children?: any }) {
45
return (
5-
<div className="space-y-2 p-2">
6-
<div className="text-gray-600 dark:text-gray-400">
7-
{children || <p>The page you are looking for does not exist.</p>}
8-
</div>
9-
<p className="flex flex-wrap items-center gap-2">
10-
<button
11-
type="button"
12-
onClick={() => window.history.back()}
13-
className="rounded bg-emerald-500 px-2 py-1 font-black text-sm text-white uppercase"
14-
>
15-
Go back
16-
</button>
17-
<Link
18-
to="/"
19-
className="rounded bg-cyan-600 px-2 py-1 font-black text-sm text-white uppercase"
20-
>
21-
Start Over
22-
</Link>
23-
</p>
6+
<div className="min-h-screen bg-white">
7+
<main className="container mx-auto flex min-h-[60vh] flex-col items-start justify-center gap-4 px-4 py-12 md:py-20">
8+
<p className="text-gray-500 text-sm uppercase tracking-wide">
9+
404 error
10+
</p>
11+
<h1 className="font-bold text-3xl text-gray-900 sm:text-4xl">
12+
Page not found
13+
</h1>
14+
<div className="max-w-2xl text-gray-600">
15+
{children || (
16+
<p>
17+
The page you are looking for does not exist, or it might have
18+
moved.
19+
</p>
20+
)}
21+
</div>
22+
<div className="flex flex-wrap items-center gap-2">
23+
<Button type="button" onClick={() => window.history.back()}>
24+
Go back
25+
</Button>
26+
<Button asChild variant="secondary">
27+
<Link to="/">Home</Link>
28+
</Button>
29+
</div>
30+
</main>
2431
</div>
2532
);
2633
}

0 commit comments

Comments
 (0)