Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default not-found and error pages for cuiloa #175

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions apps/web/src/app/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// NOTE: Must be client component. Them's the rules.
// https://nextjs.org/docs/app/building-your-application/routing/error-handling#using-error-boundaries
"use client";

import { Button } from "@/components/ui/button";
import Link from "next/link";
import { useEffect } from "react";

export default function Error({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
useEffect(() => {
console.error(error);
}, [error]);

return (
<div className="bg-primary/60 py-8 rounded-lg border">
<div className="flex flex-col gap-8 items-center">
<h1 className="text-lg font-medium sm:w-11/12 w-full">An error has occurred.</h1>
<p className="text-sm sm:w-11/12 w-full">Apologies, but something happened with Cuiloa and the client couldn&apos;t recover.</p>
<div className="flex sm:w-11/12 w-full gap-8">
<Button className="w-fit" asChild>
<Link href={"/"}>Home</Link>
</Button>
<Button className="w-fit" onClick={() => reset()}>
Try Reloading
</Button>
</div>
</div>
</div>
);
}
18 changes: 18 additions & 0 deletions apps/web/src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Button } from "@/components/ui/button";
import Link from "next/link";

export default function NotFound() {
return (
<div className="bg-primary/60 py-8 rounded-lg border">
<div className="flex flex-col gap-8 items-center">
<h1 className="text-lg font-medium sm:w-11/12 w-full">Page not found!</h1>
<p className="text-sm sm:w-11/12 w-full">Apologies, but Cuiloa could not find the page you requested.</p>
<div className="flex sm:w-11/12 w-full gap-8">
<Button className="w-fit" asChild>
<Link href={"/"}>Go Home</Link>
</Button>
</div>
</div>
</div>
);
}