import type { Metadata } from "next"; import { PageHeader } from "@/components/PageHeader"; import { EntityCard } from "@/components/catalog/EntityCard"; import { EmptyState } from "@/components/catalog/EmptyState"; import { normalizeImage, pickText, slugify } from "@/lib/meshkee/format"; import { safe } from "@/lib/meshkee/client"; import { getStoreItems } from "@/lib/meshkee/store-items"; import type { StoreItemListResponse } from "@/lib/meshkee/types"; export const metadata: Metadata = { title: "فروشگاه", description: "خرید بسته‌ها و کالاهای آموزشی استاد علی عالمی.", }; export default async function StorePage() { const { items } = await safe(getStoreItems({ pageSize: 24 }), { items: [], total: 0, page: 1, pageSize: 24, }); return ( <>
{items.length === 0 ? ( ) : (
{items.map((item) => { const name = pickText(item.product?.nameFa, item.nameFa, item.product?.name, item.name); const image = normalizeImage(item.product?.titleImageUrl ?? item.product?.imageUrl ?? item.variants?.[0]?.images?.[0]); const firstVariant = item.variants?.[0]; const productId = item.productId ?? item.product?.id ?? item.id; return ( ); })}
)}
); }