"use client"; import Image from "next/image"; import Link from "next/link"; import { useMemo, useState } from "react"; import { useSearchParams } from "next/navigation"; import { ProductSocialBlock } from "@/components/shop/ProductSocialBlock"; import { useCart } from "@/contexts/CartContext"; import { SHOP_PRODUCT_COUNT, SHOP_PRODUCTS, resolveProductImage, shopCategoryCounts, type ShopCurrency, type ShopProduct, } from "@/lib/shopCatalog"; import { getProductSocialMetrics } from "@/lib/shopProductSocial"; import { SHOP_SELLER_COUNT, getSellerById } from "@/lib/shopSellers"; function formatPrice(price: number, currency: ShopCurrency): string { if (currency === "BTC") return price.toFixed(6); if (currency === "ETH") return price.toFixed(4); if (currency === "XMR") return price.toFixed(3); return price.toFixed(2); } const SYM: Record = { BTC: "₿", ETH: "Ξ", USD: "$", XMR: "⏣", }; export default function MarketPage() { const sp = useSearchParams(); const initialCat = sp.get("category") ?? ""; const [q, setQ] = useState(""); const [category, setCategory] = useState(initialCat); const facet = useMemo(() => shopCategoryCounts(), []); const filtered = useMemo(() => { const ql = q.trim().toLowerCase(); const tokens = ql.split(/\s+/).filter(Boolean); return SHOP_PRODUCTS.filter((p) => { if (category && p.category !== category) return false; if (tokens.length === 0) return true; const seller = getSellerById(p.sellerId); const sellerHay = seller ? `${seller.handle} ${seller.bio} ${seller.specialty}` : ""; const hay = `${p.name} ${p.description} ${p.category} ${p.id} ${sellerHay}`.toLowerCase(); return tokens.every((t) => hay.includes(t)); }); }, [q, category]); return (

Layer 1 · live floor

{SHOP_PRODUCT_COUNT} SKUs ·{" "} {SHOP_SELLER_COUNT} vendor stalls — per-listing reviews, velocity, and cart handoff into checkout (USD estimate from spot). Use the left rail for ops, trust, and intel layers.

setQ(e.target.value)} placeholder="tokens match title, description, category…" className="mt-1 w-full max-w-xl border-2 border-[#00ff41]/30 bg-black/80 px-4 py-3 text-sm text-[#c8ffd8] placeholder:text-[#00ff41]/25 focus:border-[#00ff41] focus:outline-none" />

Showing {filtered.length} / {SHOP_PRODUCT_COUNT}

{facet.map((c) => ( ))}
{filtered.map((p) => ( ))}
{filtered.length === 0 ? (

No SKUs match — widen search or pick another category.

) : null}
); } function MarketProductCard({ product: p }: { product: ShopProduct }) { const src = resolveProductImage(p); const local = src.startsWith("/"); const v = getSellerById(p.sellerId); const metrics = getProductSocialMetrics(p.id); const { addToCart, hydrated } = useCart(); const [flash, setFlash] = useState(false); return (
{p.limited ? ( Limited ) : null}

{p.category}

{p.name}

{v ? (

Seller{" "} {v.handle} · stall ★{v.rating.toFixed(2)}

) : null}

{p.description}

“{metrics.testimonials[0]?.text}” @{metrics.testimonials[0]?.handle} · {metrics.testimonials[0]?.daysAgo}d
{SYM[p.currency]} {formatPrice(p.price, p.currency)} {p.currency}
); }