2026-03-17 13:17:02 +08:00

489 lines
23 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client"
import { useState } from "react"
import { DashboardShell } from "@/components/dashboard-shell"
import { DashboardHeader } from "@/components/dashboard-header"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
import { Badge } from "@/components/ui/badge"
import { Search, Edit, Eye, Sparkles, Plus } from "lucide-react"
import Link from "next/link"
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog"
import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
export default function OutfitsPage() {
// 直接在页面中实现对话框
const [open, setOpen] = useState(false)
const [step, setStep] = useState(1)
const [outfitType, setOutfitType] = useState("")
const [rarity, setRarity] = useState("")
const [printQuantity, setPrintQuantity] = useState(1000)
const [isSubmitting, setIsSubmitting] = useState(false)
const handleSubmit = async () => {
setIsSubmitting(true)
// 模拟API请求
await new Promise((resolve) => setTimeout(resolve, 1500))
setIsSubmitting(false)
setOpen(false)
// 重置表单
setStep(1)
}
const handleNext = () => {
setStep(step + 1)
}
const handleBack = () => {
setStep(step - 1)
}
return (
<DashboardShell>
<DashboardHeader heading="服装管理" text="管理洛天依的服装卡牌">
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button className="bg-gradient-to-r from-pink-500 to-purple-600 hover:from-pink-600 hover:to-purple-700 transition-all duration-300 shadow-md hover:shadow-lg">
<Plus className="mr-2 h-4 w-4" />
</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[600px]">
<DialogHeader>
<DialogTitle className="text-xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-purple-600 to-pink-600">
</DialogTitle>
<DialogDescription>ID</DialogDescription>
</DialogHeader>
<div className="grid gap-4 py-4">
<div className="grid grid-cols-2 gap-4">
<div className="space-y-2">
<Label htmlFor="name" className="text-right">
<span className="text-red-500">*</span>
</Label>
<Input
id="name"
placeholder="输入服装名称"
className="border-gray-300 focus-visible:ring-pink-500"
required
/>
</div>
<div className="space-y-2">
<Label htmlFor="type" className="text-right">
<span className="text-red-500">*</span>
</Label>
<Select value={outfitType} onValueChange={setOutfitType} required>
<SelectTrigger className="border-gray-300 focus:ring-pink-500">
<SelectValue placeholder="选择服装类型" />
</SelectTrigger>
<SelectContent>
<SelectItem value="regular"></SelectItem>
<SelectItem value="seasonal"></SelectItem>
<SelectItem value="festival"></SelectItem>
<SelectItem value="special"></SelectItem>
</SelectContent>
</Select>
</div>
</div>
<div className="grid grid-cols-2 gap-4">
<div className="space-y-2">
<Label htmlFor="rarity" className="text-right">
<span className="text-red-500">*</span>
</Label>
<Select value={rarity} onValueChange={setRarity} required>
<SelectTrigger className="border-gray-300 focus:ring-pink-500">
<SelectValue placeholder="选择稀有度" />
</SelectTrigger>
<SelectContent>
<SelectItem value="common"></SelectItem>
<SelectItem value="rare"></SelectItem>
<SelectItem value="epic"></SelectItem>
<SelectItem value="legendary"></SelectItem>
</SelectContent>
</Select>
</div>
<div className="space-y-2">
<Label htmlFor="print-quantity" className="text-right">
<span className="text-red-500">*</span>
</Label>
<Input
id="print-quantity"
type="number"
min={1}
value={printQuantity}
onChange={(e) => setPrintQuantity(Number.parseInt(e.target.value))}
placeholder="输入印刷数量"
className="border-gray-300 focus-visible:ring-pink-500"
required
/>
</div>
</div>
<div className="space-y-2">
<Label htmlFor="description" className="text-right">
<span className="text-red-500">*</span>
</Label>
<Textarea
id="description"
placeholder="输入服装描述"
className="min-h-[100px] border-gray-300 focus-visible:ring-pink-500"
required
/>
</div>
</div>
<DialogFooter className="flex items-center justify-between mt-2">
<Button variant="outline" onClick={() => setOpen(false)} disabled={isSubmitting}>
</Button>
<Button
className="bg-gradient-to-r from-pink-500 to-purple-600 hover:from-pink-600 hover:to-purple-700"
onClick={handleSubmit}
disabled={isSubmitting}
>
{isSubmitting ? "创建中..." : "创建服装"}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</DashboardHeader>
<div className="flex items-center justify-between space-y-2 mb-6">
<div className="flex items-center space-x-2">
<div className="relative">
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
<Input
type="search"
placeholder="搜索服装..."
className="w-[300px] pl-8 border-none bg-white shadow-md focus-visible:ring-pink-500"
/>
</div>
</div>
</div>
<Tabs defaultValue="all" className="space-y-4">
<TabsList className="bg-white p-1 shadow-md rounded-lg border">
<TabsTrigger
value="all"
className="data-[state=active]:bg-gradient-to-r data-[state=active]:from-pink-500 data-[state=active]:to-purple-600 data-[state=active]:text-white rounded-md transition-all duration-300"
>
</TabsTrigger>
<TabsTrigger
value="published"
className="data-[state=active]:bg-gradient-to-r data-[state=active]:from-pink-500 data-[state=active]:to-purple-600 data-[state=active]:text-white rounded-md transition-all duration-300"
>
</TabsTrigger>
<TabsTrigger
value="unpublished"
className="data-[state=active]:bg-gradient-to-r data-[state=active]:from-pink-500 data-[state=active]:to-purple-600 data-[state=active]:text-white rounded-md transition-all duration-300"
>
</TabsTrigger>
<TabsTrigger
value="limited"
className="data-[state=active]:bg-gradient-to-r data-[state=active]:from-pink-500 data-[state=active]:to-purple-600 data-[state=active]:text-white rounded-md transition-all duration-300"
>
</TabsTrigger>
</TabsList>
<TabsContent value="all" className="space-y-4">
<Card className="border-none shadow-lg bg-gradient-to-br from-white to-purple-50">
<CardHeader>
<CardTitle className="text-xl font-bold flex items-center">
<span className="bg-clip-text text-transparent bg-gradient-to-r from-purple-600 to-pink-600">
</span>
<div className="ml-2 h-1 w-10 bg-gradient-to-r from-purple-600 to-pink-600 rounded-full"></div>
</CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent>
<Table>
<TableHeader className="bg-gray-50">
<TableRow>
<TableHead className="w-[100px]">ID</TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead className="text-right"></TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow className="hover:bg-gray-50 transition-colors">
<TableCell className="font-medium">OFT001</TableCell>
<TableCell className="font-medium text-pink-600"></TableCell>
<TableCell></TableCell>
<TableCell>2023-10-15</TableCell>
<TableCell>
<Badge className="bg-green-500 hover:bg-green-600"></Badge>
</TableCell>
<TableCell className="font-medium">1,245</TableCell>
<TableCell className="font-medium">2,000</TableCell>
<TableCell className="text-right">
<Button variant="ghost" size="icon" className="hover:bg-blue-50 hover:text-blue-600" asChild>
<Link href="/outfits/OFT001">
<Eye className="h-4 w-4" />
</Link>
</Button>
</TableCell>
</TableRow>
<TableRow className="hover:bg-gray-50 transition-colors">
<TableCell className="font-medium">OFT002</TableCell>
<TableCell className="font-medium text-blue-600"></TableCell>
<TableCell></TableCell>
<TableCell>2023-06-01</TableCell>
<TableCell>
<Badge className="bg-green-500 hover:bg-green-600"></Badge>
</TableCell>
<TableCell className="font-medium">876</TableCell>
<TableCell className="font-medium">1,500</TableCell>
<TableCell className="text-right">
<Button variant="ghost" size="icon" className="hover:bg-blue-50 hover:text-blue-600" asChild>
<Link href="/outfits/OFT002">
<Eye className="h-4 w-4" />
</Link>
</Button>
</TableCell>
</TableRow>
<TableRow className="hover:bg-gray-50 transition-colors">
<TableCell className="font-medium">OFT003</TableCell>
<TableCell className="font-medium text-red-600"></TableCell>
<TableCell></TableCell>
<TableCell>2023-12-01</TableCell>
<TableCell>
<Badge className="bg-green-500 hover:bg-green-600"></Badge>
</TableCell>
<TableCell className="font-medium">1,032</TableCell>
<TableCell className="font-medium">2,000</TableCell>
<TableCell className="text-right">
<Button variant="ghost" size="icon" className="hover:bg-blue-50 hover:text-blue-600" asChild>
<Link href="/outfits/OFT003">
<Eye className="h-4 w-4" />
</Link>
</Button>
</TableCell>
</TableRow>
<TableRow className="hover:bg-gray-50 transition-colors">
<TableCell className="font-medium">OFT004</TableCell>
<TableCell className="font-medium text-purple-600"></TableCell>
<TableCell></TableCell>
<TableCell>2024-01-15</TableCell>
<TableCell>
<Badge className="bg-green-500 hover:bg-green-600"></Badge>
</TableCell>
<TableCell className="font-medium">1,567</TableCell>
<TableCell className="font-medium">3,000</TableCell>
<TableCell className="text-right">
<Button variant="ghost" size="icon" className="hover:bg-blue-50 hover:text-blue-600" asChild>
<Link href="/outfits/OFT004">
<Eye className="h-4 w-4" />
</Link>
</Button>
</TableCell>
</TableRow>
<TableRow className="hover:bg-gray-50 transition-colors">
<TableCell className="font-medium">OFT005</TableCell>
<TableCell className="font-medium text-teal-600"></TableCell>
<TableCell></TableCell>
<TableCell>-</TableCell>
<TableCell>
<Badge variant="outline" className="text-gray-500 border-gray-300">
</Badge>
</TableCell>
<TableCell className="font-medium">0</TableCell>
<TableCell className="font-medium">1,000</TableCell>
<TableCell className="text-right">
<Button variant="ghost" size="icon" className="hover:bg-blue-50 hover:text-blue-600" asChild>
<Link href="/outfits/OFT005">
<Eye className="h-4 w-4" />
</Link>
</Button>
<Button variant="ghost" size="icon" className="hover:bg-pink-50 hover:text-pink-600" asChild>
<Link href="/outfits/edit/OFT005">
<Edit className="h-4 w-4" />
</Link>
</Button>
</TableCell>
</TableRow>
</TableBody>
</Table>
</CardContent>
<CardFooter className="flex justify-between">
<div className="text-sm text-muted-foreground"> 1-5 24 </div>
<div className="flex items-center space-x-2">
<Button
variant="outline"
size="sm"
className="hover:bg-pink-50 hover:text-pink-700 transition-all duration-200"
>
</Button>
<Button
variant="outline"
size="sm"
className="hover:bg-pink-50 hover:text-pink-700 transition-all duration-200"
>
</Button>
</div>
</CardFooter>
</Card>
</TabsContent>
<TabsContent value="published" className="space-y-4">
<Card className="border-none shadow-lg bg-gradient-to-br from-white to-purple-50">
<CardHeader>
<CardTitle className="text-xl font-bold flex items-center">
<span className="bg-clip-text text-transparent bg-gradient-to-r from-purple-600 to-pink-600">
</span>
<div className="ml-2 h-1 w-10 bg-gradient-to-r from-purple-600 to-pink-600 rounded-full"></div>
</CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent>
<Table>
<TableHeader className="bg-gray-50">
<TableRow>
<TableHead className="w-[100px]">ID</TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead className="text-right"></TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow className="hover:bg-gray-50 transition-colors">
<TableCell className="font-medium">OFT001</TableCell>
<TableCell className="font-medium text-pink-600"></TableCell>
<TableCell></TableCell>
<TableCell>2023-10-15</TableCell>
<TableCell className="font-medium">1,245</TableCell>
<TableCell className="font-medium">2,000</TableCell>
<TableCell className="text-right">
<Button variant="ghost" size="icon" className="hover:bg-blue-50 hover:text-blue-600" asChild>
<Link href="/outfits/OFT001">
<Eye className="h-4 w-4" />
</Link>
</Button>
</TableCell>
</TableRow>
<TableRow className="hover:bg-gray-50 transition-colors">
<TableCell className="font-medium">OFT002</TableCell>
<TableCell className="font-medium text-blue-600"></TableCell>
<TableCell></TableCell>
<TableCell>2023-06-01</TableCell>
<TableCell className="font-medium">876</TableCell>
<TableCell className="font-medium">1,500</TableCell>
<TableCell className="text-right">
<Button variant="ghost" size="icon" className="hover:bg-blue-50 hover:text-blue-600" asChild>
<Link href="/outfits/OFT002">
<Eye className="h-4 w-4" />
</Link>
</Button>
</TableCell>
</TableRow>
</TableBody>
</Table>
</CardContent>
</Card>
</TabsContent>
<TabsContent value="unpublished" className="space-y-4">
<Card className="border-none shadow-lg bg-gradient-to-br from-white to-purple-50">
<CardHeader>
<CardTitle className="text-xl font-bold flex items-center">
<span className="bg-clip-text text-transparent bg-gradient-to-r from-purple-600 to-pink-600">
</span>
<div className="ml-2 h-1 w-10 bg-gradient-to-r from-purple-600 to-pink-600 rounded-full"></div>
</CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent>
<Table>
<TableHeader className="bg-gray-50">
<TableRow>
<TableHead className="w-[100px]">ID</TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead className="text-right"></TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow className="hover:bg-gray-50 transition-colors">
<TableCell className="font-medium">OFT005</TableCell>
<TableCell className="font-medium text-teal-600"></TableCell>
<TableCell></TableCell>
<TableCell className="font-medium">1,000</TableCell>
<TableCell className="text-right">
<Button variant="ghost" size="icon" className="hover:bg-blue-50 hover:text-blue-600" asChild>
<Link href="/outfits/OFT005">
<Eye className="h-4 w-4" />
</Link>
</Button>
<Button variant="ghost" size="icon" className="hover:bg-pink-50 hover:text-pink-600" asChild>
<Link href="/outfits/edit/OFT005">
<Edit className="h-4 w-4" />
</Link>
</Button>
</TableCell>
</TableRow>
</TableBody>
</Table>
</CardContent>
</Card>
</TabsContent>
<TabsContent value="limited" className="space-y-4">
<Card className="border-none shadow-lg bg-gradient-to-br from-white to-purple-50">
<CardHeader>
<CardTitle className="text-xl font-bold flex items-center">
<span className="bg-clip-text text-transparent bg-gradient-to-r from-purple-600 to-pink-600">
</span>
<div className="ml-2 h-1 w-10 bg-gradient-to-r from-purple-600 to-pink-600 rounded-full"></div>
</CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent>
<div className="flex items-center justify-center p-8">
<div className="flex flex-col items-center text-center">
<Sparkles className="h-12 w-12 text-blue-500 mb-4" />
<p className="text-lg font-medium text-gray-700"></p>
<p className="text-sm text-gray-500 mt-2"></p>
</div>
</div>
</CardContent>
</Card>
</TabsContent>
</Tabs>
</DashboardShell>
)
}