Skip to content

Commit 48fccd8

Browse files
authored
Merge pull request #175 from penumbra-zone/default-NotFound-Error-pages
default not-found and error pages for cuiloa
2 parents c285f23 + bb170f9 commit 48fccd8

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

apps/web/src/app/error.tsx

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// NOTE: Must be client component. Them's the rules.
2+
// https://nextjs.org/docs/app/building-your-application/routing/error-handling#using-error-boundaries
3+
"use client";
4+
5+
import { Button } from "@/components/ui/button";
6+
import Link from "next/link";
7+
import { useEffect } from "react";
8+
9+
export default function Error({
10+
error,
11+
reset,
12+
}: {
13+
error: Error & { digest?: string }
14+
reset: () => void
15+
}) {
16+
useEffect(() => {
17+
console.error(error);
18+
}, [error]);
19+
20+
return (
21+
<div className="bg-primary/60 py-8 rounded-lg border">
22+
<div className="flex flex-col gap-8 items-center">
23+
<h1 className="text-lg font-medium sm:w-11/12 w-full">An error has occurred.</h1>
24+
<p className="text-sm sm:w-11/12 w-full">Apologies, but something happened with Cuiloa and the client couldn&apos;t recover.</p>
25+
<div className="flex sm:w-11/12 w-full gap-8">
26+
<Button className="w-fit" asChild>
27+
<Link href={"/"}>Home</Link>
28+
</Button>
29+
<Button className="w-fit" onClick={() => reset()}>
30+
Try Reloading
31+
</Button>
32+
</div>
33+
</div>
34+
</div>
35+
);
36+
}

apps/web/src/app/not-found.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Button } from "@/components/ui/button";
2+
import Link from "next/link";
3+
4+
export default function NotFound() {
5+
return (
6+
<div className="bg-primary/60 py-8 rounded-lg border">
7+
<div className="flex flex-col gap-8 items-center">
8+
<h1 className="text-lg font-medium sm:w-11/12 w-full">Page not found!</h1>
9+
<p className="text-sm sm:w-11/12 w-full">Apologies, but Cuiloa could not find the page you requested.</p>
10+
<div className="flex sm:w-11/12 w-full gap-8">
11+
<Button className="w-fit" asChild>
12+
<Link href={"/"}>Go Home</Link>
13+
</Button>
14+
</div>
15+
</div>
16+
</div>
17+
);
18+
}

0 commit comments

Comments
 (0)