From 093c8b56ea7b2d0a77aff51ced8c6cf8cdf99624 Mon Sep 17 00:00:00 2001 From: Alireza Hassani Date: Wed, 7 Oct 2026 18:26:46 +0330 Subject: [PATCH] Match category image slots to the homepage bento frame sizes. Co-authored-by: Cursor --- src/data/website-slots.ts | 68 ++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/src/data/website-slots.ts b/src/data/website-slots.ts index b35f621..075261e 100644 --- a/src/data/website-slots.ts +++ b/src/data/website-slots.ts @@ -64,12 +64,55 @@ export const WEBSITE_SLOT_DEFS: WebsiteSlotDef[] = [ previewObjectPosition: "object-[center_20%]", }, { + /** + * Homepage CategoryBento (lg): 3×3 grid, height min(62vw, 560px). + * Cell sizes at 1520×560 content (max-w 1600 − lg padding, 8px gaps): + * 0: 1×3 tall · 1: 2×1 wide · 2: 1×1 · 3: 1×2 · 4: 1×1 + */ slug: "category-strip", labelFa: "دسته‌بندی‌ها", labelEn: "Categories", - kind: "collection", - aspectRatio: 68 / 80, - aspectLabel: "68×80", + kind: "fixed-set", + itemCount: 5, + aspectRatio: 501 / 560, + aspectLabel: "بنتو · ۵ قاب", + cellLabels: [ + { + labelFa: "قاب بلند", + labelEn: "Tall", + aspectRatio: 501 / 560, + aspectLabel: "501×560", + previewWidthRem: 7, + }, + { + labelFa: "قاب عریض", + labelEn: "Wide", + aspectRatio: 1011 / 181, + aspectLabel: "1011×181", + previewWidthRem: 16, + }, + { + labelFa: "قاب میانی", + labelEn: "Middle", + aspectRatio: 501 / 181, + aspectLabel: "501×181", + previewWidthRem: 9, + }, + { + labelFa: "قاب نیمه‌بلند", + labelEn: "Half-tall", + aspectRatio: 501 / 371, + aspectLabel: "501×371", + previewWidthRem: 8, + }, + { + labelFa: "قاب پایین", + labelEn: "Bottom", + aspectRatio: 501 / 181, + aspectLabel: "501×181", + previewWidthRem: 9, + }, + ], }, { slug: "promo-1", @@ -180,22 +223,23 @@ export function normalizeSlotDef(raw: WebsiteSlotDefApi): WebsiteSlotDef { const local = WEBSITE_SLOT_DEFS.find((d) => d.slug === slug); return { slug, - labelFa: raw.labelFa, - labelEn: raw.labelEn, + labelFa: raw.labelFa || local?.labelFa || slug, + labelEn: raw.labelEn || local?.labelEn || slug, kind: + local?.kind ?? raw.kind ?? ((raw as { duplicatable?: boolean }).duplicatable ? "collection" : "fixed"), - sectionKey: raw.sectionKey, - sectionLabelFa: raw.sectionLabelFa, - sectionLabelEn: raw.sectionLabelEn, - itemCount: raw.itemCount, - aspectRatio: raw.aspectRatio || 1, - aspectLabel: raw.aspectLabel || "", + sectionKey: raw.sectionKey ?? local?.sectionKey, + sectionLabelFa: raw.sectionLabelFa ?? local?.sectionLabelFa, + sectionLabelEn: raw.sectionLabelEn ?? local?.sectionLabelEn, + itemCount: local?.itemCount ?? raw.itemCount, + aspectRatio: local?.aspectRatio ?? raw.aspectRatio ?? 1, + aspectLabel: local?.aspectLabel || raw.aspectLabel || "", previewObjectPosition: raw.previewObjectPosition ?? local?.previewObjectPosition, - cellLabels: (raw.cellLabels ?? local?.cellLabels)?.map((cell, index) => ({ + cellLabels: (local?.cellLabels ?? raw.cellLabels)?.map((cell, index) => ({ ...cell, previewObjectPosition: cell.previewObjectPosition ??