-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { Metadata } from 'next'; | ||
import { notFound } from 'next/navigation'; | ||
import { Container } from 'components'; | ||
import { ReserveInfo } from 'components'; | ||
import { reserves } from 'config/reserves'; | ||
|
||
interface PageProps { | ||
params: { | ||
slug: string; | ||
}; | ||
} | ||
|
||
export async function generateMetadata(props: PageProps): Promise<Metadata> { | ||
const reserve = reserves.find(reserve => reserve.slug === props.params.slug); | ||
|
||
return { | ||
title: `${reserve?.name} - TackleBox`, | ||
}; | ||
} | ||
|
||
export async function generateStaticParams() { | ||
return reserves.map(reserve => ({ slug: reserve.slug })); | ||
} | ||
|
||
const ReserveDetailsPage = (props: PageProps) => { | ||
const { | ||
params: { slug }, | ||
} = props; | ||
|
||
// Ensure the reserve exists before continuing | ||
const reserve = reserves.find(r => r.slug === slug); | ||
if (!reserve) { | ||
return notFound(); | ||
} | ||
|
||
return ( | ||
<Container> | ||
<ReserveInfo reserve={reserve} /> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default ReserveDetailsPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters