Add three new frontend page sections: - Industrial parks (khu-cong-nghiep): listing, detail, filter bar - Transfer listings (chuyen-nhuong): search, category tabs, detail - AI reports dashboard: list, create, viewer with TOC Includes components, API clients, hooks, server helpers, i18n keys, navigation links in public and dashboard layouts, and lint fixes. Co-Authored-By: Paperclip <noreply@paperclip.ing>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import type { Metadata } from 'next';
|
|
import { notFound } from 'next/navigation';
|
|
import { KhuCongNghiepDetailClient } from '@/components/khu-cong-nghiep/khu-cong-nghiep-detail-client';
|
|
import { fetchIndustrialParkBySlug } from '@/lib/khu-cong-nghiep-server';
|
|
|
|
interface PageProps {
|
|
params: Promise<{ slug: string; locale: string }>;
|
|
}
|
|
|
|
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
|
|
const { slug } = await params;
|
|
const park = await fetchIndustrialParkBySlug(slug);
|
|
if (!park) return { title: 'Không tìm thấy khu công nghiệp' };
|
|
|
|
const description = park.description?.slice(0, 160) ??
|
|
`${park.name} — KCN tại ${park.province}, diện tích ${park.totalAreaHa} ha, tỷ lệ lấp đầy ${park.occupancyRate}%`;
|
|
|
|
return {
|
|
title: `${park.name} — Khu Công Nghiệp ${park.province}`,
|
|
description,
|
|
openGraph: {
|
|
title: park.name,
|
|
description,
|
|
images: park.media
|
|
?.filter((m) => m.type === 'image')
|
|
.slice(0, 1)
|
|
.map((m) => ({ url: m.url })) ?? [],
|
|
},
|
|
};
|
|
}
|
|
|
|
export default async function KhuCongNghiepDetailPage({ params }: PageProps) {
|
|
const { slug } = await params;
|
|
const park = await fetchIndustrialParkBySlug(slug);
|
|
|
|
if (!park) {
|
|
notFound();
|
|
}
|
|
|
|
return <KhuCongNghiepDetailClient park={park} />;
|
|
}
|