"use client" import { useState } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { Badge } from "@/components/ui/badge" import { Copy, Link } from "lucide-react" import { useToast } from "@/hooks/use-toast" interface ScoringLinkDialogProps { open: boolean onOpenChange: (open: boolean) => void currentCompetition?: any } export function ScoringLinkDialog({ open, onOpenChange, currentCompetition }: ScoringLinkDialogProps) { const { toast } = useToast() // 生成評分連結URL const scoringUrl = typeof window !== 'undefined' ? `${window.location.origin}/judge-scoring` : "https://preview-fork-of-ai-app-design-ieqe9ld0z64vdugqt.vusercontent.net/judge-scoring" const accessCode = "judge2024" const competitionName = currentCompetition?.name || "2024年第四季綜合AI競賽" const handleCopyUrl = async () => { try { await navigator.clipboard.writeText(scoringUrl) toast({ title: "連結已複製", description: "評分系統連結已複製到剪貼簿", }) } catch (err) { toast({ title: "複製失敗", description: "無法複製連結,請手動複製", variant: "destructive", }) } } const handleCopyAccessCode = async () => { try { await navigator.clipboard.writeText(accessCode) toast({ title: "存取碼已複製", description: "評審存取碼已複製到剪貼簿", }) } catch (err) { toast({ title: "複製失敗", description: "無法複製存取碼,請手動複製", variant: "destructive", }) } } return ( 評審連結管理 管理評審評分系統的存取連結和資訊
{/* 評審評分系統連結 */} 評審評分系統連結 評審可以通過此連結進入評分系統
{/* 存取資訊 */} 存取資訊 評審登入所需的資訊 {/* 存取碼 */}
{/* 當前競賽 */}
{competitionName}
) }