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.name}

{store.domain} · {store.country} · {store.niche}

Visit Shop
Monthly Visits
{store.monthlyVisits?.toLocaleString()}
Est Revenue
€{store.estRevenue30dMin?.toLocaleString()}–€{store.estRevenue30dMax?.toLocaleString()}
Products
{store.productCount}
Active Ads
{ads.length}

Best-selling Products

{store.products.map((p) =>
{p.title}
{p.currency} {p.price}
)}

Pixels & Stack

{store.pixels.map((p) => {p.type})}
{store.apps.map((a) => {a.name})}

Top Meta Ads

{ads.map((ad) =>
{ad.headline}
Top %{ad.rankPercentile} · {ad.daysRunning} gün
)}

Similar Stores

{similar.map((s) =>
{s.name}
{s.monthlyVisits?.toLocaleString()} visits
)}
); }