"use client" import { useState } from "react" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Users, Mail, Eye, Heart, Trophy, Star, MessageSquare, ImageIcon, Mic, TrendingUp, Brain, Zap, ExternalLink, } from "lucide-react" import { useAuth } from "@/contexts/auth-context" import { LikeButton } from "@/components/like-button" import { AppDetailDialog } from "@/components/app-detail-dialog" interface TeamDetailDialogProps { open: boolean onOpenChange: (open: boolean) => void team: any } // App data for team apps - empty for production const getAppDetails = (appId: string) => { return { id: appId, name: "", type: "", description: "", icon: null, fullDescription: "", features: [], author: "", category: "", tags: [], demoUrl: "", sourceUrl: "", } } const getTypeColor = (type: string) => { const colors = { 文字處理: "bg-blue-100 text-blue-800 border-blue-200", 圖像生成: "bg-purple-100 text-purple-800 border-purple-200", 語音辨識: "bg-green-100 text-green-800 border-green-200", 推薦系統: "bg-orange-100 text-orange-800 border-orange-200", } return colors[type as keyof typeof colors] || "bg-gray-100 text-gray-800 border-gray-200" } export function TeamDetailDialog({ open, onOpenChange, team }: TeamDetailDialogProps) { const { getLikeCount, getViewCount, getAppRating } = useAuth() const [selectedTab, setSelectedTab] = useState("overview") const [selectedApp, setSelectedApp] = useState(null) const [appDetailOpen, setAppDetailOpen] = useState(false) if (!team) return null const leader = team.members.find((m: any) => m.id === team.leader) const handleAppClick = (appId: string) => { const appDetails = getAppDetails(appId) // Create app object that matches AppDetailDialog interface const app = { id: Number.parseInt(appId), name: appDetails.name, type: appDetails.type, department: team.department, // Use team's department description: appDetails.description, icon: appDetails.icon, creator: appDetails.author, featured: false, judgeScore: 0, } setSelectedApp(app) setAppDetailOpen(true) } const totalLikes = team.apps.reduce((sum: number, appId: string) => sum + getLikeCount(appId), 0) const totalViews = team.apps.reduce((sum: number, appId: string) => sum + getViewCount(appId), 0) return ( <> {team.name} 團隊詳細資訊與成員介紹
{/* Team Overview */} 團隊概覽
{team.members.length}
團隊成員
{team.apps.length}
提交應用
{totalLikes}
總按讚數
{totalViews}
總瀏覽數
{/* Tab Navigation */}
{/* Tab Content */} {selectedTab === "overview" && (
基本資訊

{team.name}

{team.department}

{leader?.name}

{team.contactEmail}

競賽表現
{team.popularityScore}
人氣指數
{totalViews}
總瀏覽數
{totalLikes}
總按讚數
)} {selectedTab === "members" && ( 團隊成員 ({team.members.length}人)
{team.members.map((member: any, index: number) => (
{member.name[0]}

{member.name}

{member.id === team.leader && ( 隊長 )}

{member.role}

{member.department}

))}
)} {selectedTab === "apps" && ( 提交應用 ({team.apps.length}個)
{team.apps.map((appId: string) => { const app = getAppDetails(appId) const IconComponent = app.icon const likes = getLikeCount(appId) const views = getViewCount(appId) const rating = getAppRating(appId) return ( handleAppClick(appId)} >

{app.name}

{app.type}

{app.description}

{views}
{rating.toFixed(1)}
e.stopPropagation()}>
) })}
)}
{/* App Detail Dialog */} {selectedApp && } ) }