refactor: rewrite and expand mock data into modular files

This commit is contained in:
zetaloop
2026-02-21 00:24:03 +08:00
parent 44669d5606
commit 7ed7bad975
47 changed files with 1891 additions and 767 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { mockNotifications } from "@/lib/mock-data"
import { mockNotifications } from "@/lib/mock"
import type { Notification } from "@/lib/types"
const typeIcons: Record<Notification["type"], typeof Bell> = {
+1 -1
View File
@@ -11,7 +11,7 @@ import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
import { Separator } from "@/components/ui/separator"
import { Switch } from "@/components/ui/switch"
import { Textarea } from "@/components/ui/textarea"
import { currentUser } from "@/lib/mock-data"
import { currentUser } from "@/lib/mock"
import type { UserRole } from "@/lib/types"
import { useAuthStore } from "@/store/auth"
+1 -1
View File
@@ -13,7 +13,7 @@ import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { Separator } from "@/components/ui/separator"
import { mockTransactions, walletBalance } from "@/lib/mock-data"
import { mockTransactions, walletBalance } from "@/lib/mock"
import { useAuthStore } from "@/store/auth"
const typeLabels: Record<string, string> = {
+1 -1
View File
@@ -9,7 +9,7 @@ import { z } from "zod"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { currentUser } from "@/lib/mock-data"
import { currentUser } from "@/lib/mock"
import { useAuthStore } from "@/store/auth"
const loginSchema = z.object({
+1 -1
View File
@@ -9,7 +9,7 @@ import { z } from "zod"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { currentUser } from "@/lib/mock-data"
import { currentUser } from "@/lib/mock"
import { useAuthStore } from "@/store/auth"
const registerSchema = z
+1 -1
View File
@@ -7,7 +7,7 @@ import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Progress } from "@/components/ui/progress"
import { statusLabels } from "@/lib/constants"
import { mockOrders, mockPlayers, mockServices, mockShops } from "@/lib/mock-data"
import { mockOrders, mockPlayers, mockServices, mockShops } from "@/lib/mock"
import { useAuthStore } from "@/store/auth"
export default function DashboardPage() {
@@ -19,7 +19,7 @@ import {
} from "@/components/ui/select"
import { Textarea } from "@/components/ui/textarea"
import { GameIcon } from "@/lib/game-icons"
import { mockGames } from "@/lib/mock-data"
import { mockGames } from "@/lib/mock"
const serviceSchema = z.object({
title: z.string().min(2, "标题至少2个字符"),
+1 -1
View File
@@ -11,7 +11,7 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table"
import { mockServices } from "@/lib/mock-data"
import { mockServices } from "@/lib/mock"
export default function ServicesPage() {
return (
@@ -18,7 +18,7 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table"
import { mockPlayers } from "@/lib/mock-data"
import { mockPlayers } from "@/lib/mock"
const shopPlayers = mockPlayers.filter((p) => p.shopId === "shop1")
@@ -9,7 +9,7 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table"
import { mockOrders, mockTransactions } from "@/lib/mock-data"
import { mockOrders, mockTransactions } from "@/lib/mock"
export default function ShopIncomePage() {
const completedOrders = mockOrders.filter((o) => o.status === "completed")
@@ -12,7 +12,7 @@ import {
TableRow,
} from "@/components/ui/table"
import { statusLabels } from "@/lib/constants"
import { mockOrders } from "@/lib/mock-data"
import { mockOrders } from "@/lib/mock"
export default function ShopOrdersPage() {
const totalOrders = mockOrders.length
+1 -1
View File
@@ -7,7 +7,7 @@ import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Separator } from "@/components/ui/separator"
import { Textarea } from "@/components/ui/textarea"
import { mockShops } from "@/lib/mock-data"
import { mockShops } from "@/lib/mock"
export default function ShopManagementPage() {
const shop = mockShops[0]
@@ -14,7 +14,7 @@ import {
SelectValue,
} from "@/components/ui/select"
import { Switch } from "@/components/ui/switch"
import { mockShops } from "@/lib/mock-data"
import { mockShops } from "@/lib/mock"
import type { Shop } from "@/lib/types"
export default function ShopRulesPage() {
@@ -6,7 +6,7 @@ import { type DragEvent, useEffect, useState } from "react"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Switch } from "@/components/ui/switch"
import { mockShops } from "@/lib/mock-data"
import { mockShops } from "@/lib/mock"
import type { ShopSection } from "@/lib/types"
const sectionLabels: Record<ShopSection["type"], string> = {
+1 -1
View File
@@ -8,7 +8,7 @@ import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card"
import { roleLabels } from "@/lib/constants"
import { mockGames, mockPosts } from "@/lib/mock-data"
import { mockGames, mockPosts } from "@/lib/mock"
export default function CommunityPage() {
const [sortMode, setSortMode] = useState<"latest" | "hot">("latest")
+1 -1
View File
@@ -5,7 +5,7 @@ import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { GameIcon } from "@/lib/game-icons"
import { mockGames, mockPlayers, mockShops } from "@/lib/mock-data"
import { mockGames, mockPlayers, mockShops } from "@/lib/mock"
export default function HomePage() {
return (
+1 -1
View File
@@ -15,7 +15,7 @@ import {
} from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { mockFavorites, mockPlayers, mockReviews, mockServices } from "@/lib/mock-data"
import { mockFavorites, mockPlayers, mockReviews, mockServices } from "@/lib/mock"
export default async function PlayerDetailPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params
+1 -1
View File
@@ -9,7 +9,7 @@ import { Card, CardContent, CardHeader } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { Textarea } from "@/components/ui/textarea"
import { roleLabels } from "@/lib/constants"
import { mockComments, mockOrders, mockPlayers, mockPosts } from "@/lib/mock-data"
import { mockComments, mockOrders, mockPlayers, mockPosts } from "@/lib/mock"
export default async function PostDetailPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params
+1 -1
View File
@@ -20,7 +20,7 @@ import {
SelectValue,
} from "@/components/ui/select"
import { Textarea } from "@/components/ui/textarea"
import { mockPosts } from "@/lib/mock-data"
import { mockPosts } from "@/lib/mock"
import { useRequireAuth } from "@/lib/use-require-auth"
const postSchema = z.object({
+1 -1
View File
@@ -42,7 +42,7 @@ import {
} from "@/components/ui/sheet"
import { Switch } from "@/components/ui/switch"
import { GameIcon } from "@/lib/game-icons"
import { mockGames, mockPlayers } from "@/lib/mock-data"
import { mockGames, mockPlayers } from "@/lib/mock"
import type { Player } from "@/lib/types"
import { cn } from "@/lib/utils"
+1 -1
View File
@@ -7,7 +7,7 @@ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { mockFavorites, mockPlayers, mockReviews, mockServices, mockShops } from "@/lib/mock-data"
import { mockFavorites, mockPlayers, mockReviews, mockServices, mockShops } from "@/lib/mock"
interface PageProps {
params: Promise<{ id: string }>
+1 -1
View File
@@ -5,7 +5,7 @@ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { mockFavorites, mockPlayers, mockPosts, mockShops, mockUsers } from "@/lib/mock-data"
import { mockFavorites, mockPlayers, mockPosts, mockShops, mockUsers } from "@/lib/mock"
export default async function UserProfilePage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params
+1 -1
View File
@@ -8,7 +8,7 @@ import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { ScrollArea } from "@/components/ui/scroll-area"
import { mockChatMessages, mockChatSessions } from "@/lib/mock-data"
import { mockChatMessages, mockChatSessions } from "@/lib/mock"
import { cn } from "@/lib/utils"
import { useAuthStore } from "@/store/auth"
+1 -1
View File
@@ -3,7 +3,7 @@ import Link from "next/link"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge"
import { Card, CardContent } from "@/components/ui/card"
import { mockChatSessions } from "@/lib/mock-data"
import { mockChatSessions } from "@/lib/mock"
export default function ChatListPage() {
return (
+1 -1
View File
@@ -11,7 +11,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Label } from "@/components/ui/label"
import { Separator } from "@/components/ui/separator"
import { Textarea } from "@/components/ui/textarea"
import { mockDisputes, mockOrders } from "@/lib/mock-data"
import { mockDisputes, mockOrders } from "@/lib/mock"
const disputeStatusLabels: Record<string, string> = {
open: "已提交",
+1 -1
View File
@@ -6,7 +6,7 @@ import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { statusLabels } from "@/lib/constants"
import { mockChatSessions, mockOrders, mockReviews } from "@/lib/mock-data"
import { mockChatSessions, mockOrders, mockReviews } from "@/lib/mock"
import type { OrderStatus } from "@/lib/types"
const statusSteps: OrderStatus[] = [
+1 -1
View File
@@ -11,7 +11,7 @@ import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Separator } from "@/components/ui/separator"
import { Textarea } from "@/components/ui/textarea"
import { mockOrders, mockPlayers, mockServices, walletBalance } from "@/lib/mock-data"
import { mockOrders, mockPlayers, mockServices, walletBalance } from "@/lib/mock"
import { useRequireAuth } from "@/lib/use-require-auth"
function showFeedback(message: string) {
+1 -1
View File
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { statusLabels } from "@/lib/constants"
import { mockChatSessions, mockOrders } from "@/lib/mock-data"
import { mockChatSessions, mockOrders } from "@/lib/mock"
import type { OrderStatus } from "@/lib/types"
import { cn } from "@/lib/utils"
import { useAuthStore } from "@/store/auth"
+1 -1
View File
@@ -7,7 +7,7 @@ import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"
import { mockOrders } from "@/lib/mock-data"
import { mockOrders } from "@/lib/mock"
export default function ReviewPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = use(params)