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:
@@ -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">© 2025 聚玩. All rights reserved.</div>
|
<div className="text-xs text-muted-foreground">© 2025 聚玩. All rights reserved.</div>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user