import Link from "next/link"; import { cookies } from "next/headers"; const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000/api"; interface Product { slug: string; name: string; description: string; category: string; product_type: string; image_url: string; base_price: number; } function getMockupType(productType: string): string { if (productType.includes("shirt") || productType.includes("tee") || productType.includes("hoodie")) return "shirt"; if (productType.includes("sticker")) return "sticker"; if (productType.includes("print")) return "print"; return "shirt"; } async function getProducts(spaceId: string): Promise { try { const params = new URLSearchParams(); if (spaceId && spaceId !== "default") { params.set("space", spaceId); } const url = `${API_URL}/products${params.toString() ? `?${params}` : ""}`; const res = await fetch(url, { next: { revalidate: 3600 } }); if (!res.ok) return []; return res.json(); } catch { return []; } } export default async function ProductsPage() { const cookieStore = await cookies(); const spaceId = cookieStore.get("space_id")?.value || "default"; const products = await getProducts(spaceId); return (

Products

Print-on-demand merch — designed by the community, fulfilled by Printful.

{products.length === 0 ? (

No products yet

New designs are being added. Check back soon or create your own.

Upload a Design
) : (
{products.map((product) => (
{/* Product image */}
{product.name} {/* Category badge */}
{product.product_type}
{/* Product info */}

{product.name}

{product.description}

${product.base_price.toFixed(2)} View Details →
))}
)}
); }