refactor: extract shared constants to lib/constants.ts

This commit is contained in:
zetaloop
2026-02-20 20:39:14 +08:00
parent ed3858cff3
commit 9267df9ea1
3 changed files with 23 additions and 32 deletions
+2 -1
View File
@@ -9,6 +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 { useAuthStore } from "@/store/auth"
const loginSchema = z.object({
@@ -29,7 +30,7 @@ export default function LoginPage() {
const onSubmit = async (_data: z.infer<typeof loginSchema>) => {
await new Promise((r) => setTimeout(r, 500))
login()
login(currentUser, ["consumer", "player", "owner"])
router.push("/")
}
+1 -11
View File
@@ -7,22 +7,12 @@ import { Badge } from "@/components/ui/badge"
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 type { OrderStatus } from "@/lib/types"
import { cn } from "@/lib/utils"
import { useAuthStore } from "@/store/auth"
const statusLabels: Record<OrderStatus, string> = {
pending_payment: "待支付",
pending_accept: "待接单",
in_progress: "进行中",
pending_close: "待结单",
pending_review: "待评价",
disputed: "争议中",
completed: "已完成",
cancelled: "已取消",
}
const statusColors: Record<OrderStatus, string> = {
pending_payment: "bg-yellow-100 text-yellow-800",
pending_accept: "bg-blue-100 text-blue-800",