feat(ui): refine dashboard configuration pages

This commit is contained in:
zetaloop
2026-04-25 21:48:57 +08:00
parent 14f6f5509a
commit ac382960dd
4 changed files with 95 additions and 34 deletions
@@ -2,6 +2,7 @@
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { EmptyState } from "@/components/ui/empty-state"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import {
@@ -27,7 +28,7 @@ import { notifyInfo, notifySuccess } from "@/lib/toast"
import type { Game, PlayerService } from "@/lib/types"
import { useAuthStore } from "@/store/auth"
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema"
import { ArrowLeft } from "lucide-react"
import { AlertCircle, ArrowLeft } from "lucide-react"
import Link from "next/link"
import { useRouter, useSearchParams } from "next/navigation"
import { useEffect, useState } from "react"
@@ -159,19 +160,35 @@ export default function NewServicePage() {
}, [])
if (loadingService || (currentRole === "owner" && shopLoading)) {
return <div className="text-sm text-muted-foreground">...</div>
return (
<div className="container mx-auto max-w-2xl px-4 py-8">
<EmptyState title="服务信息加载中" />
</div>
)
}
if (currentRole === "owner" && shopError) {
return <div className="text-sm text-muted-foreground">{shopError}</div>
return (
<div className="container mx-auto max-w-2xl px-4 py-8">
<EmptyState title="店铺信息加载失败" description={shopError} icon={AlertCircle} />
</div>
)
}
if (serviceId && (!editingService || !scopedPlayerIdSet.has(editingService.playerId))) {
return <div className="text-sm text-muted-foreground"></div>
return (
<div className="container mx-auto max-w-2xl px-4 py-8">
<EmptyState title="服务不可编辑" description="服务不存在或当前身份不可编辑。" />
</div>
)
}
if (!targetPlayerId) {
return <div className="text-sm text-muted-foreground"></div>
return (
<div className="container mx-auto max-w-2xl px-4 py-8">
<EmptyState title="当前身份下没有可管理的服务范围" />
</div>
)
}
const onSubmit = async (data: z.infer<typeof serviceSchema>) => {
@@ -214,8 +231,8 @@ export default function NewServicePage() {
</Link>
<Card className="hover:shadow-card-hover">
<CardHeader>
<Card className="border-border/80 shadow-sm">
<CardHeader className="border-b border-border/60">
<CardTitle></CardTitle>
</CardHeader>
<CardContent>
@@ -303,7 +320,7 @@ export default function NewServicePage() {
<Button type="submit" className="flex-1" disabled={isSubmitting}>
{isSubmitting ? "发布中..." : "发布服务"}
</Button>
<Button type="button" variant="outline" asChild>
<Button type="button" variant="outline" className="border-border/60" asChild>
<Link href="/dashboard/services"></Link>
</Button>
</div>