import { notFound } from "next/navigation"; import { prisma } from "@/lib/db"; import { requireUser } from "@/lib/auth/current-user"; import { Card } from "@/components/ui/card"; import { AdCreativeMedia } from "@/components/ad-creative-media"; export default async function StoreDetailPage({ params }: { params: Promise<{ id: string }> }) { const resolvedParams = await params; await requireUser(); const store = await prisma.store.findUnique({ where: { id: resolvedParams.id }, include: { products: true, snapshots: { orderBy: { date: "asc" } }, pixels: true, apps: true, brandPages: { include: { ads: { include: { creatives: { take: 1 } }, take: 12 } } } } }); if (!store) notFound(); const similar = await prisma.store.findMany({ where: { id: { not: store.id }, niche: store.niche }, take: 8, orderBy: { monthlyVisits: "desc" } }); const ads = store.brandPages.flatMap((p) => p.ads); return (
{store.domain} · {store.country} · {store.niche}