fix(ui): unify layout wrappers and simplify player/shop detail pages
This commit is contained in:
@@ -8,13 +8,7 @@ import { Badge } from "@/components/ui/badge"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import {
|
||||
isFavorited as checkFavorited,
|
||||
getShopById,
|
||||
listPlayersByShop,
|
||||
listReviews,
|
||||
listServices,
|
||||
} from "@/lib/api"
|
||||
import { getShopById, listPlayersByShop, listReviews, listServices } from "@/lib/api"
|
||||
|
||||
interface PageProps {
|
||||
params: Promise<{ id: string }>
|
||||
@@ -32,8 +26,6 @@ export default async function ShopPage({ params }: PageProps) {
|
||||
const playerIds = shopPlayers.map((p) => p.id)
|
||||
const shopServices = listServices().filter((s) => playerIds.includes(s.playerId))
|
||||
const shopReviews = listReviews().filter((r) => playerIds.includes(r.toUserId))
|
||||
const isFavorited = checkFavorited("u1", "shop", shop.id)
|
||||
|
||||
const sortedSections = [...shop.templateConfig.sections]
|
||||
.filter((s) => s.enabled)
|
||||
.sort((a, b) => a.order - b.order)
|
||||
@@ -101,7 +93,7 @@ export default async function ShopPage({ params }: PageProps) {
|
||||
</p>
|
||||
</div>
|
||||
<FavoriteButton
|
||||
initialFavorited={isFavorited}
|
||||
initialFavorited={false}
|
||||
targetType="shop"
|
||||
targetId={shop.id}
|
||||
/>
|
||||
@@ -144,7 +136,7 @@ export default async function ShopPage({ params }: PageProps) {
|
||||
</h3>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{shopServices.map((service) => (
|
||||
<Card key={service.id}>
|
||||
<Card key={service.id} className="flex flex-col h-full">
|
||||
<CardHeader className="pb-2">
|
||||
<div className="flex justify-between items-start">
|
||||
<Badge variant="outline">{service.gameName}</Badge>
|
||||
@@ -155,18 +147,20 @@ export default async function ShopPage({ params }: PageProps) {
|
||||
</div>
|
||||
<CardTitle className="text-base mt-2">{service.title}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<CardContent className="flex-grow flex flex-col">
|
||||
<p className="text-sm text-muted-foreground line-clamp-2 mb-2">
|
||||
{service.description}
|
||||
</p>
|
||||
{service.rankRange && (
|
||||
<div className="text-xs bg-muted px-2 py-1 rounded inline-block">
|
||||
<div className="text-xs bg-muted px-2 py-1 rounded inline-block w-fit">
|
||||
段位:{service.rankRange}
|
||||
</div>
|
||||
)}
|
||||
<Button className="w-full mt-3" size="sm" asChild>
|
||||
<Link href={`/order/new?serviceId=${service.id}`}>立即下单</Link>
|
||||
</Button>
|
||||
<div className="mt-auto pt-3">
|
||||
<Button className="w-full" size="sm" asChild>
|
||||
<Link href={`/order/new?serviceId=${service.id}`}>立即下单</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user