"use client" import { useState } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Avatar, AvatarFallback } from "@/components/ui/avatar" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { Badge } from "@/components/ui/badge" import { Copy, Users } from "lucide-react" import { useToast } from "@/hooks/use-toast" interface Judge { id: string name: string specialty: string expertise?: string[] title?: string department?: string email?: string phone?: string organization?: string totalScores?: number completedScores?: number } interface JudgeListDialogProps { open: boolean onOpenChange: (open: boolean) => void judges: Judge[] } export function JudgeListDialog({ open, onOpenChange, judges }: JudgeListDialogProps) { const { toast } = useToast() const handleCopyJudgeId = async (judgeId: string, judgeName: string) => { try { await navigator.clipboard.writeText(judgeId) toast({ title: "ID已複製", description: `${judgeName}的ID已複製到剪貼簿`, }) } catch (err) { toast({ title: "複製失敗", description: "無法複製ID,請手動複製", variant: "destructive", }) } } return ( 評審清單 當前競賽的評審ID和基本資訊
{judges.length === 0 ? (

暫無評審數據

) : ( judges.map((judge) => (
{/* 左側:頭像和基本資訊 */}
{judge.name.charAt(0)}

{judge.name}

{judge.specialty}

{/* 職位和部門 */} {(judge.title && judge.title !== judge.name) || judge.department ? (
{judge.title && judge.title !== judge.name && ( {judge.title} )} {judge.department && ( {judge.department} )}
) : null} {/* 評審能力 */} {judge.expertise && judge.expertise.length > 0 && (

專業能力

{judge.expertise.map((skill, index) => ( {skill} ))}
)} {/* 額外資訊 */}
{judge.organization && (

🏢 {judge.organization}

)} {judge.email && (

📧 {judge.email}

)} {judge.phone && (

📞 {judge.phone}

)}
{/* 評分進度 */} {judge.totalScores !== undefined && judge.completedScores !== undefined && (
評分進度 {judge.completedScores}/{judge.totalScores}
0 ? (judge.completedScores / judge.totalScores) * 100 : 0}%` }} />
)}
{/* 右側:ID和操作按鈕 */}
ID: {judge.id}
)) )}
) }