import { notFound } from "next/navigation";

import { SkillsPage } from "@/components/skills/SkillsPage";
import { fetchProject, fetchSkills } from "@/lib/api/server";

interface PageProps {
  params: Promise<{ id: string }>;
}

// 技能库页（UX §7）。Server Component 取项目 + 技能注册表（只读）。
export default async function SkillsRoutePage({ params }: PageProps) {
  const { id } = await params;
  try {
    const project = await fetchProject(id);
    const skills = await fetchSkills();
    return <SkillsPage project={project} skills={skills.skills ?? []} />;
  } catch {
    notFound();
  }
}
