fixed some bugs

This commit is contained in:
Jelaletdin12
2025-12-23 13:32:57 +05:00
parent cdc9fa686f
commit 2b46d525f2
30 changed files with 857 additions and 260 deletions

View File

@@ -1,37 +1,64 @@
import type { Metadata } from "next"
import type { Metadata } from "next";
type Props = {
params: Promise<{ locale: string; slug: string }>
params: Promise<{ locale: string; slug: string }>;
};
export const revalidate = 600; // ISR: 10 minutes
const META = {
tm: {
titleSuffix: " | Post shop",
description: (name: string) => `${name} kolleksiýasyndaky harytlary gözläň`,
ogLocale: "tk_TM",
},
ru: {
titleSuffix: " | Post shop",
description: (name: string) => `Просмотр товаров из коллекции «${name}»`,
ogLocale: "ru_RU",
},
} as const;
function formatSlug(slug: string) {
return slug
.split("-")
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
.join(" ");
}
export const revalidate = 600 // ISR: Revalidate every 10 minutes
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { locale, slug } = await params
const { locale, slug } = await params;
const meta = META[locale as keyof typeof META] ?? META.ru;
const collectionName = formatSlug(slug);
const title = `${collectionName}${meta.titleSuffix}`;
const description = meta.description(collectionName);
return {
title: `${slug.charAt(0).toUpperCase() + slug.slice(1)} | E-Commerce`,
description: `Browse ${slug} collection products in our store`,
title,
description,
openGraph: {
locale,
type: "website",
title: `${slug.charAt(0).toUpperCase() + slug.slice(1)} | E-Commerce`,
description: `Browse ${slug} collection products in our store`,
locale: meta.ogLocale,
title,
description,
},
}
};
}
export async function generateStaticParams() {
const collections = ["new-arrivals", "best-sellers", "featured"]
return collections.map((slug) => ({ slug }))
const collections = ["new-arrivals", "best-sellers", "featured"];
return collections.map((slug) => ({ slug }));
}
export default async function CollectionPage(props: Props) {
const params = await props.params
const params = await props.params;
const CollectionPageClient = (
await import("../../../../features/collections/components/CollectionPageClient")
).default
return <CollectionPageClient params={params} />
}
await import(
"../../../../features/collections/components/CollectionPageClient"
)
).default;
return <CollectionPageClient params={params} />;
}