"use client"; import { Package } from "lucide-react"; import type { CatalogItemData } from "@/components/admin/catalog/catalog-items-table/types"; import { cn } from "@/lib/utils"; import { getShopGridClass, getShopTileSize, parseFirstItemId, ShopTile, } from "./shop-tile"; interface ItemsShopPreviewProps { items: CatalogItemData[]; furniRevisionMap: Record; layout: string; canEdit: boolean; onItemClick?: (item: CatalogItemData) => void; } /** * The preview is a visual check, not an editor. Mounting a tile (image, badges, * click handler) per offer made pages with hundreds of items crawl, so the grid * shows a window and states how many are hidden. The table view is the place to * work through the full list. */ const PREVIEW_TILE_LIMIT = 200; export function ItemsShopPreview({ items, furniRevisionMap, layout, canEdit, onItemClick, }: ItemsShopPreviewProps) { if (items.length === 0) { return (

No items in this page yet

); } const gridClass = getShopGridClass(layout); const tileSize = getShopTileSize(layout); const visibleItems = items.length > PREVIEW_TILE_LIMIT ? items.slice(0, PREVIEW_TILE_LIMIT) : items; return (
Shop preview · {layout} {items.length} items {visibleItems.length !== items.length && ` · showing first ${visibleItems.length}`}
{visibleItems.map((item) => { const firstId = parseFirstItemId(item.itemIds); const furni = firstId != null ? furniRevisionMap[firstId] : undefined; return ( ); })}
{visibleItems.length !== items.length && (

Preview capped at {PREVIEW_TILE_LIMIT} items — use the table view for the rest.

)}
); }