83 lines
1.9 KiB
TypeScript
83 lines
1.9 KiB
TypeScript
// app/[locale]/about/page.tsx
|
|
export const revalidate = 0;
|
|
import { partner_api } from '@/features/about/lib/api';
|
|
import { AboutContent } from '@/features/about/ui/AboutContent';
|
|
import { AboutHero } from '@/features/about/ui/AboutHero';
|
|
import { PartnershipForm } from '@/features/about/ui/AboutPage';
|
|
import { BASE_URL } from '@/shared/config/api/URLs';
|
|
import { Metadata } from 'next';
|
|
|
|
function getImageUrl(image?: string | null): string {
|
|
if (!image) return '/placeholder.svg';
|
|
return image.includes(BASE_URL) ? image : BASE_URL + image;
|
|
}
|
|
|
|
interface Props {
|
|
params: { locale: 'uz' | 'ru' };
|
|
}
|
|
|
|
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
const { locale } = params;
|
|
|
|
try {
|
|
const res = await partner_api.getAbout();
|
|
const banner = res.data.banner;
|
|
|
|
const title =
|
|
locale === 'uz'
|
|
? banner.title_uz
|
|
: locale === 'ru'
|
|
? banner.title_ru
|
|
: banner.title_en;
|
|
|
|
const description =
|
|
locale === 'uz'
|
|
? banner.description_uz
|
|
: locale === 'ru'
|
|
? banner.description_ru
|
|
: banner.description_en;
|
|
|
|
return {
|
|
title: title,
|
|
description: description,
|
|
openGraph: {
|
|
title,
|
|
description,
|
|
type: 'website',
|
|
images: [
|
|
{
|
|
url: getImageUrl(banner.image),
|
|
width: 1200,
|
|
height: 630,
|
|
alt: title,
|
|
},
|
|
],
|
|
},
|
|
twitter: {
|
|
card: 'summary_large_image',
|
|
title,
|
|
description,
|
|
images: [getImageUrl(banner.image)],
|
|
},
|
|
};
|
|
} catch (err) {
|
|
console.error('About metadata error:', err);
|
|
return {
|
|
title: 'Gastro Market',
|
|
description: 'Gastro Market mahsulotlarini kashf eting',
|
|
};
|
|
}
|
|
}
|
|
|
|
const AboutPage = async () => {
|
|
return (
|
|
<div className="custom-container">
|
|
<AboutHero />
|
|
<AboutContent />
|
|
<PartnershipForm />
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default AboutPage;
|