Skip to content

Commit

Permalink
Added reserve details page
Browse files Browse the repository at this point in the history
  • Loading branch information
codeaid committed May 6, 2024
1 parent 6a417bc commit 3c1743b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
43 changes: 43 additions & 0 deletions src/app/reserves/[slug]/page.tsx
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;
12 changes: 11 additions & 1 deletion src/components/NavigationRail/NavigationRail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import clsx from 'clsx';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { FaHome } from 'react-icons/fa';
import { FaFishFins } from 'react-icons/fa6';
import { FaFishFins, FaRegMap } from 'react-icons/fa6';
import styles from './NavigationRail.module.css';

export const NavigationRail = () => {
Expand Down Expand Up @@ -33,6 +33,16 @@ export const NavigationRail = () => {
<div className={styles.NavigationRailMenuItemLabel}>Fishes</div>
</Link>
</li>
<li
className={clsx(styles.NavigationRailMenuItem, {
[styles.NavigationRailMenuItemActive]: pathname === '/reserves',
})}
>
<Link className={styles.NavigationRailMenuItemLink} href="/reserves">
<FaRegMap className={styles.NavigationRailMenuItemIcon} />
<div className={styles.NavigationRailMenuItemLabel}>Reserves</div>
</Link>
</li>
</ul>
</div>
);
Expand Down

0 comments on commit 3c1743b

Please sign in to comment.