initial migration

This commit is contained in:
2025-12-28 23:28:31 +01:00
parent 1f99781458
commit 292975299d
284 changed files with 119466 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
import { notFound } from 'next/navigation'
import { getAllCategories, getProductsByCategory } from '@/lib/data'
import { ProductList } from '@/components/ProductList'
import { Metadata } from 'next'
interface PageProps {
params: {
locale: string
slug: string
}
}
export async function generateStaticParams() {
const categories = getAllCategories()
return categories.map((category) => ({
locale: 'de', // Default locale
slug: category.slug
}))
}
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
const categories = getAllCategories()
const category = categories.find((cat) => cat.slug === params.slug)
if (!category) {
return {
title: 'Category Not Found'
}
}
return {
title: category.name,
description: category.description || `Products in ${category.name}`
}
}
export default async function ProductCategoryPage({ params }: PageProps) {
const categories = getAllCategories()
const category = categories.find((cat) => cat.slug === params.slug)
if (!category) {
notFound()
}
const products = getProductsByCategory(category.id, params.locale)
return (
<div className="container mx-auto px-4 py-8">
<h1 className="text-4xl font-bold mb-6">{category.name}</h1>
{category.description && (
<div
className="mb-8 prose max-w-none"
dangerouslySetInnerHTML={{ __html: category.description }}
/>
)}
{products.length > 0 ? (
<ProductList products={products} />
) : (
<p className="text-gray-500">No products found in this category.</p>
)}
</div>
)
}