refactor: remove hardcoded display values and unused lib/id.ts

Delete hardcoded marketing stats in auth layout and ¥12,800
placeholder in owner dashboard. Remove lib/id.ts which is no
longer referenced by any module.
This commit is contained in:
zetaloop
2026-05-01 04:22:33 +08:00
parent cd469d3d54
commit b6002f5691
5 changed files with 7 additions and 30 deletions
-15
View File
@@ -1,12 +1,6 @@
import { ArrowLeft, Gamepad2 } from "lucide-react" import { ArrowLeft, Gamepad2 } from "lucide-react"
import Link from "next/link" import Link from "next/link"
const stats = [
{ value: "12,000+", label: "认证打手" },
{ value: "98.6%", label: "好评率" },
{ value: "50,000+", label: "完成订单" },
]
export default function AuthLayout({ children }: { children: React.ReactNode }) { export default function AuthLayout({ children }: { children: React.ReactNode }) {
return ( return (
<div className="flex min-h-screen bg-background"> <div className="flex min-h-screen bg-background">
@@ -28,15 +22,6 @@ export default function AuthLayout({ children }: { children: React.ReactNode })
<p className="mt-4 text-base leading-relaxed text-muted-foreground"> <p className="mt-4 text-base leading-relaxed text-muted-foreground">
</p> </p>
<div className="mt-10 grid grid-cols-3 gap-6">
{stats.map((stat) => (
<div key={stat.label}>
<div className="text-2xl font-bold">{stat.value}</div>
<div className="mt-1 text-xs text-muted-foreground">{stat.label}</div>
</div>
))}
</div>
</div> </div>
<div className="text-xs text-muted-foreground">&copy; 2025 . All rights reserved.</div> <div className="text-xs text-muted-foreground">&copy; 2025 . All rights reserved.</div>
+4 -2
View File
@@ -92,7 +92,9 @@ export default function DashboardPage() {
const rating = isOwner ? (shop?.rating ?? 0) : (player?.rating ?? 0) const rating = isOwner ? (shop?.rating ?? 0) : (player?.rating ?? 0)
const playerCount = shop?.playerCount ?? 0 const playerCount = shop?.playerCount ?? 0
const completionRate = player?.completionRate ?? 0 const completionRate = player?.completionRate ?? 0
const serviceCount = player ? services.filter((s) => s.playerId === player.id).length : 0 const serviceCount = player
? services.filter((service) => String(service.playerId) === String(player.id)).length
: 0
return ( return (
<div className="container mx-auto max-w-6xl px-4 py-8 space-y-8"> <div className="container mx-auto max-w-6xl px-4 py-8 space-y-8">
@@ -147,7 +149,7 @@ export default function DashboardPage() {
)} )}
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<div className="text-2xl font-bold">{isOwner ? "¥12,800" : serviceCount}</div> <div className="text-2xl font-bold">{isOwner ? "——" : serviceCount}</div>
</CardContent> </CardContent>
</Card> </Card>
</div> </div>
+2 -2
View File
@@ -25,8 +25,8 @@ export default async function ShopPage({ params }: PageProps) {
} }
const [shopPlayers, allServices] = await Promise.all([listPlayersByShop(shop.id), listServices()]) const [shopPlayers, allServices] = await Promise.all([listPlayersByShop(shop.id), listServices()])
const playerIds = shopPlayers.map((p) => p.id) const playerIds = new Set(shopPlayers.map((player) => String(player.id)))
const shopServices = allServices.filter((s) => playerIds.includes(s.playerId)) const shopServices = allServices.filter((service) => playerIds.has(String(service.playerId)))
const shopReviews = await listReviews() const shopReviews = await listReviews()
const sortedSections = getShopSections(shop).filter((s) => s.enabled) const sortedSections = getShopSections(shop).filter((s) => s.enabled)
+1 -1
View File
@@ -37,5 +37,5 @@ export async function getPlayerById(playerId: string): Promise<Player | undefine
export async function listPlayersByShop(shopId: string): Promise<Player[]> { export async function listPlayersByShop(shopId: string): Promise<Player[]> {
const players = await listPlayers() const players = await listPlayers()
return players.filter((player) => player.shopId === shopId) return players.filter((player) => String(player.shopId) === shopId)
} }
-10
View File
@@ -1,10 +0,0 @@
let counter = 0
export function generateId(prefix: string) {
void prefix
counter += 1
const now = Date.now().toString()
const suffix = counter.toString().padStart(3, "0")
return `${now}${suffix}`
}