feat: add cart and product pages, quantity controls, and first-visit development notice
Build & Deploy (develop) / build-and-deploy (push) Successful in 1m44s
Build & Deploy (develop) / build-and-deploy (push) Successful in 1m44s
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import type {Metadata} from 'next';
|
||||
import {notFound} from 'next/navigation';
|
||||
import {content} from '@/data/content';
|
||||
import ProductDetails from '@/components/ProductDetails';
|
||||
|
||||
type Props = {params: {id: string}};
|
||||
|
||||
export function generateStaticParams() {
|
||||
return content.fa.machines.map(machine => ({id: machine.id}));
|
||||
}
|
||||
|
||||
export function generateMetadata({params}: Props): Metadata {
|
||||
const machine = content.fa.machines.find(item => item.id === params.id);
|
||||
if (!machine) return {};
|
||||
return {title: `${machine.name} | روبات مارکت`, description: machine.description};
|
||||
}
|
||||
|
||||
export default function ProductPage({params}: Props) {
|
||||
if (!content.fa.machines.some(machine => machine.id === params.id)) notFound();
|
||||
return <ProductDetails id={params.id}/>;
|
||||
}
|
||||
Reference in New Issue
Block a user