"use client" import { useState } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { Progress } from "@/components/ui/progress" import { CategoryEvaluation } from "@/components/category-evaluation" import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs" import type { CategoryScore } from "@/components/ai-evaluation-dashboard" import { CheckCircle, Circle, ArrowRight, ArrowLeft } from "lucide-react" interface Category { id: string name: string type: "capability" | "risk" description: string detailedGuidance?: string } interface EvaluationFormProps { categories: Category[] selectedCategories: string[] categoryScores: Record onScoreUpdate: (categoryId: string, score: CategoryScore) => void onSaveDetailed?: (categoryId: string, data: any) => void onComplete: () => void } export function EvaluationForm({ categories, selectedCategories, categoryScores, onScoreUpdate, onSaveDetailed, onComplete, }: EvaluationFormProps) { const [currentCategoryIndex, setCurrentCategoryIndex] = useState(0) const selectedCategoryObjects = categories.filter((c) => selectedCategories.includes(c.id)) const currentCategory = selectedCategoryObjects[currentCategoryIndex] const completedCount = Object.keys(categoryScores).length const totalCount = selectedCategories.length const progress = totalCount > 0 ? (completedCount / totalCount) * 100 : 0 const handleNext = () => { if (currentCategoryIndex < selectedCategoryObjects.length - 1) { setCurrentCategoryIndex((prev) => prev + 1) } } const handlePrevious = () => { if (currentCategoryIndex > 0) { setCurrentCategoryIndex((prev) => prev - 1) } } const handleCategorySelect = (categoryId: string) => { const index = selectedCategoryObjects.findIndex((c) => c.id === categoryId) if (index !== -1) { setCurrentCategoryIndex(index) } } const isCurrentCategoryCompleted = currentCategory && categoryScores[currentCategory.id] const allCompleted = completedCount === totalCount return (
{/* Progress Header */}
Detailed Evaluation Complete the evaluation for each selected category
Progress: {completedCount}/{totalCount}
{/* Category Navigation Sidebar as Tabs */} Categories handleCategorySelect(val)}> {selectedCategoryObjects.map((category, index) => { const isCompleted = categoryScores[category.id] return (
{isCompleted ? : }
{category.name} {category.type}
{isCompleted && (
{categoryScores[category.id].totalScore}/{categoryScores[category.id].totalApplicable || categoryScores[category.id].totalQuestions || 0}
)}
) })}
{/* Current Category Evaluation */}
{currentCategory && ( onScoreUpdate(currentCategory.id, score)} onSaveDetailed={(catId, data) => onSaveDetailed?.(catId, data)} /> )} {/* Navigation Controls */}

Category {currentCategoryIndex + 1} of {totalCount}

{currentCategory &&

{currentCategory.name}

}
{currentCategoryIndex < selectedCategoryObjects.length - 1 ? ( ) : ( )}
) }