fix(shop): render backend template defaults

This commit is contained in:
zetaloop
2026-04-25 14:49:57 +08:00
parent c3843b3671
commit 65db255e20
+3 -4
View File
@@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator" import { Separator } from "@/components/ui/separator"
import { getShopById, listPlayersByShop, listReviews, listServices } from "@/lib/api" import { getShopById, listPlayersByShop, listReviews, listServices } from "@/lib/api"
import { getShopSections } from "@/lib/domain/shop-template"
import { Gamepad2, Megaphone, ShoppingBag, Star, Users } from "lucide-react" import { Gamepad2, Megaphone, ShoppingBag, Star, Users } from "lucide-react"
import Image from "next/image" import Image from "next/image"
import Link from "next/link" import Link from "next/link"
@@ -26,9 +27,7 @@ export default async function ShopPage({ params }: PageProps) {
const playerIds = shopPlayers.map((p) => p.id) const playerIds = shopPlayers.map((p) => p.id)
const shopServices = allServices.filter((s) => playerIds.includes(s.playerId)) const shopServices = allServices.filter((s) => playerIds.includes(s.playerId))
const shopReviews = await listReviews() const shopReviews = await listReviews()
const sortedSections = [...shop.templateConfig.sections] const sortedSections = getShopSections(shop).filter((s) => s.enabled)
.filter((s) => s.enabled)
.sort((a, b) => a.order - b.order)
return ( return (
<div className="container mx-auto py-6 space-y-8"> <div className="container mx-auto py-6 space-y-8">
@@ -84,7 +83,7 @@ export default async function ShopPage({ params }: PageProps) {
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
<Avatar className="w-16 h-16"> <Avatar className="w-16 h-16">
<AvatarImage src={shop.owner.avatar} /> <AvatarImage src={shop.owner.avatar} />
<AvatarFallback>{shop.owner.nickname[0]}</AvatarFallback> <AvatarFallback>{shop.owner.nickname[0] ?? "店"}</AvatarFallback>
</Avatar> </Avatar>
<div> <div>
<p className="font-medium">{shop.owner.nickname}</p> <p className="font-medium">{shop.owner.nickname}</p>