import Link from "next/link"; import type { Metadata } from "next"; import { api } from "@community/lib/api"; import { notFound } from "next/navigation"; import FavoriteButton from "@community/components/FavoriteButton"; import DestinationDetailClient from "@community/components/DestinationDetailClient"; import SiteShell from "@community/components/SiteShell"; export async function generateMetadata( { params }: { params: Promise<{ slug: string }> } ): Promise { const { slug } = await params; try { const dest = await api.getDestination(slug); const title = `${dest.emoji} ${dest.name}, ${dest.country} · nomadro`; const description = `${dest.description.slice(0, 120)}… 月费约 ¥${dest.cost.toLocaleString()} · 网速 ${dest.speed}Mbps`; return { title, description, openGraph: { title, description, url: `/destinations/${slug}` }, twitter: { card: "summary_large_image", title, description }, }; } catch { return { title: "目的地 · nomadro" }; } } export default async function DestinationPage({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; let dest; let allDestinations; try { [dest, allDestinations] = await Promise.all([ api.getDestination(slug), api.getDestinations(), ]); } catch { notFound(); } return (
{dest.emoji}
{dest.tag}

{dest.name}, {dest.country}

{dest.description}

💰¥{dest.cost.toLocaleString()}月生活费
📶{dest.speed}Mbps网速
🌡️{dest.temperature}°C均温
⭐{dest.rating}评分

✨ 亮点特色

    {dest.highlights.map((h) =>
  • {h}
  • )}
); }