"use client" import { useState, useEffect, use } from "react" import { DashboardShell } from "@/components/dashboard-shell" import { DashboardHeader } from "@/components/dashboard-header" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { ArrowLeft, Edit, AlertTriangle, FileText, Plus, Download, Loader2 } from "lucide-react" import Link from "next/link" import { AddPrintBatchDialog } from "@/components/props/add-print-batch-dialog" import { ExportCardsDialog } from "@/components/props/export-cards-dialog" import { isSuperUser } from "@/lib/api/auth" import { getProp } from "@/lib/api/props" import type { Prop } from "@/lib/api/types" export default function PropDetailPage({ params }: { params: Promise<{ id: string }> }) { const { id } = use(params) const [prop, setProp] = useState(null) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) useEffect(() => { const fetchProp = async () => { try { setLoading(true) setError(null) const data = await getProp(id) setProp(data) } catch (err) { console.error("获取道具详情失败:", err) setError(`找不到ID为 ${id} 的道具`) } finally { setLoading(false) } } fetchProp() }, [id]) if (loading) { return (
加载中...
) } if (error || !prop) { return (

道具不存在

{error || `找不到ID为 ${id} 的道具`}

) } const isPublished = prop.status === "已发布" const printedCount = prop.batchesCount || 0 const activatedCount = prop.activeCardsCount || 0 const activationRate = printedCount > 0 ? Math.round((activatedCount / printedCount) * 100) : 0 return (
{(!isPublished || isSuperUser()) && ( )}
道具详情 批次管理 数据分析
道具预览
{prop.imageUrl && !prop.imageUrl.includes("placeholder") ? ( {prop.name} ) : (
暂无图片
)}
{prop.status || "未发布"}
道具详情

道具类型

{prop.category || "-"}

稀有度

{prop.rarity || "-"}

发布日期

{prop.publishedAt || "尚未发布"}

激活数量

{activatedCount}

创建日期

{prop.createdAt || "-"}

激活率

{activationRate}%

道具描述

{prop.description || "暂无描述"}

{isPublished && (

{isSuperUser() ? "该道具已发布,您以超级管理员身份仍可编辑和删除。请谨慎操作。" : "该道具已发布,基本属性不可修改。您仍可以增加印刷数量。"}

)}
印刷批次管理 管理道具卡牌的印刷批次和卡牌ID
批次ID 创建日期 数量 状态 操作
批次数据将从后端加载
批次操作 批量管理卡牌批次
激活数据分析 道具卡牌激活情况统计

激活数据图表将在此显示

地区分布

地区分布图表将在此显示

时间趋势

时间趋势图表将在此显示

) }