"use client" import { useTranslations } from "next-intl" import Link from "next/link" import { X, ExternalLink, Plus, Trash2 } from "lucide-react" import { Button } from "@/shared/components/ui/button" import { Badge } from "@/shared/components/ui/badge" import { ScrollArea } from "@/shared/components/ui/scroll-area" import { Separator } from "@/shared/components/ui/separator" import type { KpWithRelations, MasteryInfo } from "../types" interface GraphNodeDetailPanelProps { kp: KpWithRelations mastery: MasteryInfo | null prerequisites: { id: string; name: string; description: string | null }[] successors: { id: string; name: string; description: string | null }[] canEdit: boolean onClose: () => void onJumpToKp: (kpId: string) => void onAddPrerequisite: () => void onRemovePrerequisite: (prereqId: string) => void } export function GraphNodeDetailPanel({ kp, mastery, prerequisites, successors, canEdit, onClose, onJumpToKp, onAddPrerequisite, onRemovePrerequisite, }: GraphNodeDetailPanelProps) { const t = useTranslations("textbooks") const correctRate = mastery && mastery.totalQuestions > 0 ? Math.round((mastery.correctQuestions / mastery.totalQuestions) * 100) : null return (
{kp.chapterTitle}
)}{kp.description || t("graph.detail.noDescription")}
{t("graph.detail.noPrerequisites")}
) : ({t("graph.detail.noSuccessors")}
) : (