about page dymanic

This commit is contained in:
Samandar Turgunboyev
2026-02-26 12:24:18 +05:00
parent a2be8ef125
commit 18cfa5cdf9
7 changed files with 215 additions and 118 deletions

View File

@@ -1,3 +1,6 @@
// app/[locale]/about/page.tsx
import { partner_api } from '@/features/about/lib/api';
import { AboutData } from '@/features/about/lib/type';
import { AboutContent } from '@/features/about/ui/AboutContent';
import { AboutHero } from '@/features/about/ui/AboutHero';
import { PartnershipForm } from '@/features/about/ui/AboutPage';
@@ -7,55 +10,72 @@ interface Props {
params: { locale: 'uz' | 'ru' };
}
// Dynamic SEO uchun server-side API chaqiruvi
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { locale } = await params;
const { locale } = params;
const titles = {
uz: 'Biz haqimizda | GASTRO',
ru: 'О нас | Магазин товаров',
};
try {
const res = await partner_api.getAbout();
const data: AboutData = res.data;
const descriptions = {
uz: 'Bizning onlayn dokonimizda sifatli mahsulotlarni toping. Tez yetkazib berish va qulay tolov imkoniyatlari mavjud.',
ru: 'В нашем онлайн-магазине вы найдете качественные товары. Быстрая доставка и удобная оплата.',
};
const banner = data.banner;
const keywords = {
uz: 'mahsulot, onlayn dokon, xarid, yetkazib berish',
ru: 'товары, онлайн-магазин, покупка, доставка',
};
const title =
locale === 'uz'
? banner.title_uz
: locale === 'ru'
? banner.title_ru
: banner.title_en;
return {
title: titles[locale],
description: descriptions[locale],
keywords: keywords[locale],
openGraph: {
title: titles[locale],
description: descriptions[locale],
siteName: 'GASTRO',
images: [
{
url: '/logos/logo.png',
width: 1200,
height: 1200,
alt: titles[locale],
},
],
locale: locale === 'uz' ? 'uz_UZ' : 'ru_RU',
type: 'website',
},
twitter: {
card: 'summary_large_image',
title: titles[locale],
description: descriptions[locale],
images: ['/logos/logo.png'],
},
};
const description =
locale === 'uz'
? banner.description_uz
: locale === 'ru'
? banner.description_ru
: banner.description_en;
return {
title: title || 'Gastro Market',
description:
description || 'Gastro Market gastronomiya va kulinariya olami',
openGraph: {
title: title || 'Gastro Market',
description:
description || 'Gastro Market gastronomiya va kulinariya olami',
siteName: 'GASTRO',
images: [
{
url: banner.image ? '/' + banner.image : '/logos/logo.png',
width: 1200,
height: 1200,
alt: title || 'Gastro Market',
},
],
locale: locale === 'uz' ? 'uz_UZ' : 'ru_RU',
type: 'website',
},
twitter: {
card: 'summary_large_image',
title: title || 'Gastro Market',
description:
description || 'Gastro Market gastronomiya va kulinariya olami',
images: [banner.image ? '/' + banner.image : '/logos/logo.png'],
},
};
} catch (err) {
console.error('About metadata error:', err);
return {
title: 'Gastro Market',
description: 'Gastro Market gastronomiya va kulinariya olami',
};
}
}
const page = () => {
// Page component
const page = async () => {
return (
<div className="custom-container">
{/* Hero va Content ichida React Query ishlatilgan loading + dynamic data */}
<AboutHero />
<AboutContent />
<PartnershipForm />