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 { ChuyenNhuongDetailClient } from '@/components/chuyen-nhuong/chuyen-nhuong-detail-client';
|
|
import { fetchTransferListingById } from '@/lib/chuyen-nhuong-server';
|
|
|
|
interface PageProps {
|
|
params: Promise<{ id: string; locale: string }>;
|
|
}
|
|
|
|
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
|
|
const { id } = await params;
|
|
const listing = await fetchTransferListingById(id);
|
|
if (!listing) return { title: 'Không tìm thấy tin chuyển nhượng' };
|
|
|
|
const description = listing.description?.slice(0, 160) ??
|
|
`${listing.title} — Chuyển nhượng tại ${listing.district}, ${listing.city}`;
|
|
|
|
return {
|
|
title: `${listing.title} — Chuyển nhượng ${listing.district}`,
|
|
description,
|
|
openGraph: {
|
|
title: listing.title,
|
|
description,
|
|
images: listing.media
|
|
?.filter((m) => m.type === 'image')
|
|
.slice(0, 1)
|
|
.map((m) => ({ url: m.url })) ?? [],
|
|
},
|
|
};
|
|
}
|
|
|
|
export default async function ChuyenNhuongDetailPage({ params }: PageProps) {
|
|
const { id } = await params;
|
|
const listing = await fetchTransferListingById(id);
|
|
|
|
if (!listing) {
|
|
notFound();
|
|
}
|
|
|
|
return <ChuyenNhuongDetailClient listing={listing} />;
|
|
}
|