"use client" import React from "react" import { ScrollArea } from "@/shared/components/ui/scroll-area" import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/shared/components/ui/dialog" import { Button } from "@/shared/components/ui/button" import { Eye, Printer } from "lucide-react" import type { ExamNode } from "./selected-question-list" type ChoiceOption = { id: string text: string } type QuestionContent = { text?: string options?: ChoiceOption[] } type ExamPaperPreviewProps = { title: string subject: string grade: string durationMin: number totalScore: number nodes: ExamNode[] } export function ExamPaperPreview({ title, subject, grade, durationMin, totalScore, nodes }: ExamPaperPreviewProps) { // Helper to flatten questions for continuous numbering let questionCounter = 0 const renderNode = (node: ExamNode, depth: number = 0) => { if (node.type === 'group') { return (