fix(website): navigation and 404

This commit is contained in:
iCrawl
2023-04-11 19:19:33 +02:00
parent dcf8757d35
commit 78e02c4b63
8 changed files with 40 additions and 33 deletions

View File

@@ -1 +0,0 @@
export { default } from '~/app/loading';

View File

@@ -0,0 +1,22 @@
'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
export default function NotFound() {
const pathname = usePathname();
const href = pathname.split('/').slice(0, -1).join('/');
return (
<div className="mx-auto flex min-h-screen max-w-lg flex-col place-content-center place-items-center gap-8 px-8 py-16 lg:px-6 lg:py-0">
<h1 className="text-[9rem] font-black leading-none md:text-[12rem]">404</h1>
<h2 className="text-[2rem] md:text-[3rem]">Not found.</h2>
<Link
className="bg-blurple focus:ring-width-2 flex h-11 transform-gpu cursor-pointer select-none appearance-none flex-row place-items-center rounded border-0 px-6 text-base font-semibold leading-none text-white no-underline outline-0 focus:ring focus:ring-white active:translate-y-px"
href={href}
>
Take me back
</Link>
</div>
);
}

View File

@@ -140,5 +140,13 @@ function Member({ member }: { member?: ApiItem }) {
export default async function Page({ params }: { params: ItemRouteParams }) {
const member = await fetchMember(params);
return <div className="relative top-6">{member ? <Member member={member} /> : null}</div>;
if (!member) {
notFound();
}
return (
<div className="relative top-6">
<Member member={member} />
</div>
);
}

View File

@@ -1 +0,0 @@
export { default } from '~/app/loading';