feat: favorites — type, mock data, and buttons on player/shop detail pages
This commit is contained in:
@@ -2,11 +2,12 @@ import { Gamepad2, Megaphone, ShoppingBag, Star, Users } from "lucide-react"
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
import { notFound } from "next/navigation"
|
||||
import { FavoriteButton } from "@/components/favorite-button"
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { mockPlayers, mockReviews, mockServices, mockShops } from "@/lib/mock-data"
|
||||
import { mockFavorites, mockPlayers, mockReviews, mockServices, mockShops } from "@/lib/mock-data"
|
||||
|
||||
interface PageProps {
|
||||
params: Promise<{ id: string }>
|
||||
@@ -24,6 +25,9 @@ export default async function ShopPage({ params }: PageProps) {
|
||||
const playerIds = shopPlayers.map((p) => p.id)
|
||||
const shopServices = mockServices.filter((s) => playerIds.includes(s.playerId))
|
||||
const shopReviews = mockReviews.filter((r) => playerIds.includes(r.toUserId))
|
||||
const isFavorited = mockFavorites.some(
|
||||
(f) => f.userId === "u1" && f.targetType === "shop" && f.targetId === shop.id,
|
||||
)
|
||||
|
||||
const sortedSections = [...shop.templateConfig.sections]
|
||||
.filter((s) => s.enabled)
|
||||
@@ -98,6 +102,7 @@ export default async function ShopPage({ params }: PageProps) {
|
||||
{shop.owner.bio || "暂无介绍"}
|
||||
</p>
|
||||
</div>
|
||||
<FavoriteButton initialFavorited={isFavorited} />
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user