import Link from "next/link"; import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { ApiError } from "@/services/api-client"; import { getDemoPage, getIndustryDemos } from "@/services/demo.service"; import { BlockRenderer } from "@/blocks/BlockRenderer"; type Props = { params: Promise<{ industry: string; path?: string[] }> }; async function load(params: Props["params"]) { const { industry, path } = await params; try { return await getDemoPage(industry, path); } catch (error) { if (error instanceof ApiError && error.status === 404) notFound(); throw error; } } export async function generateMetadata({ params }: Props): Promise { const page = await load(params); return { title: { absolute: `${page.title} | ${page.label}演示` }, robots: { index: false, follow: false } }; } export default async function IndustryDemoPage({ params }: Props) { const [page, demos, route] = await Promise.all([load(params), getIndustryDemos(), params]); const base = `/demo/${page.industry}`; const colors: Record = { software: "border-sky-500", manufacturing: "border-orange-500", consulting: "border-emerald-500", education: "border-violet-500", healthcare: "border-teal-500", dining: "border-rose-500", construction: "border-amber-500", "real-estate": "border-indigo-500", "home-renovation": "border-lime-500", "agri-food": "border-green-500", "energy-environment": "border-cyan-500", "auto-services": "border-red-500", "culture-media": "border-fuchsia-500", "sports-fitness": "border-blue-500", "pet-services": "border-yellow-500", "legal-services": "border-slate-700", "finance-tax": "border-purple-500", "human-resources": "border-pink-500", }; return (
{page.company}
{route.path?.length ?

{page.title}

{page.intro &&

{page.intro}

}
: null} {page.html &&
} {!!page.children.length &&
{page.children.map((child) => {child.title} →)}
}
); }