added collection page
This commit is contained in:
@@ -25,6 +25,7 @@ export default function CartPage() {
|
||||
const [note, setNote] = useState<string>("");
|
||||
const [phone, setPhone] = useState<string>("");
|
||||
const [name, setName] = useState<string>("");
|
||||
const [lastName, setLastName] = useState<string>("");
|
||||
const router = useRouter();
|
||||
const t = useTranslations();
|
||||
|
||||
@@ -42,6 +43,7 @@ export default function CartPage() {
|
||||
const orderData = userStore.getOrderData();
|
||||
if (orderData) {
|
||||
if (orderData.customer_name) setName(orderData.customer_name);
|
||||
if (orderData.customer_last_name) setLastName(orderData.customer_last_name);
|
||||
if (orderData.customer_phone) setPhone(orderData.customer_phone);
|
||||
}
|
||||
}, []);
|
||||
@@ -227,8 +229,10 @@ export default function CartPage() {
|
||||
paymentTypes={paymentTypes}
|
||||
phone={phone}
|
||||
name={name}
|
||||
lastName={lastName}
|
||||
onPhoneChange={setPhone}
|
||||
onNameChange={setName}
|
||||
onLastNameChange={setLastName}
|
||||
onPaymentTypeChange={setPaymentType}
|
||||
onDeliveryTypeChange={handleDeliveryTypeChange}
|
||||
onRegionChange={setSelectedRegion}
|
||||
|
||||
38
app/[locale]/collections/[slug]/page.tsx
Normal file
38
app/[locale]/collections/[slug]/page.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import type { Metadata } from "next"
|
||||
|
||||
type Props = {
|
||||
params: Promise<{ locale: string; slug: string }>
|
||||
}
|
||||
|
||||
export const revalidate = 600 // ISR: Revalidate every 10 minutes
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { locale, slug } = await params
|
||||
|
||||
return {
|
||||
title: `${slug.charAt(0).toUpperCase() + slug.slice(1)} | E-Commerce`,
|
||||
description: `Browse ${slug} collection products in our store`,
|
||||
openGraph: {
|
||||
locale,
|
||||
type: "website",
|
||||
title: `${slug.charAt(0).toUpperCase() + slug.slice(1)} | E-Commerce`,
|
||||
description: `Browse ${slug} collection products in our store`,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
// Generate static params for popular collections
|
||||
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 CollectionPageClient = (
|
||||
await import("../../../../features/collections/components/CollectionPageClient")
|
||||
).default
|
||||
|
||||
return <CollectionPageClient params={params} />
|
||||
}
|
||||
@@ -13,23 +13,22 @@ const metadataContent = {
|
||||
} as const;
|
||||
|
||||
interface PageProps {
|
||||
params: {
|
||||
params: Promise<{
|
||||
locale: string;
|
||||
};
|
||||
}>;
|
||||
}
|
||||
|
||||
export async function generateMetadata(
|
||||
{ params }: PageProps,
|
||||
parent: ResolvingMetadata
|
||||
): Promise<Metadata> {
|
||||
const locale = params.locale as keyof typeof metadataContent;
|
||||
|
||||
const content = metadataContent[locale] || metadataContent.ru;
|
||||
const { locale } = await params;
|
||||
const localeKey = locale as keyof typeof metadataContent;
|
||||
const content = metadataContent[localeKey] || metadataContent.ru;
|
||||
|
||||
return {
|
||||
title: content.title,
|
||||
description: content.description,
|
||||
|
||||
robots: {
|
||||
index: false,
|
||||
follow: false,
|
||||
@@ -39,5 +38,6 @@ export async function generateMetadata(
|
||||
}
|
||||
|
||||
export default async function OrdersPage({ params }: PageProps) {
|
||||
return <OrdersPageClient locale={params.locale} />;
|
||||
}
|
||||
const { locale } = await params;
|
||||
return <OrdersPageClient locale={locale} />;
|
||||
}
|
||||
Reference in New Issue
Block a user