From 83809815c1510c56d953751127b510a3868e048c Mon Sep 17 00:00:00 2001 From: "amirhosein.ashourloo" Date: Sun, 23 Aug 2026 08:57:24 +0330 Subject: [PATCH] Wire featured categories to a static-image slot Add a featured-categories list slot (published via /meshkee/static-image-slots alongside the existing banner slots) so the homepage category strip can be driven by admin-uploaded images instead of the category API, which has no image field. Falls back to the current category list whenever the slot has no images configured or the fetch fails. Co-Authored-By: Claude Sonnet 5 --- src/app/page.tsx | 3 +- src/components/home/FeaturedCategories.tsx | 52 ++++++++++++++++++++-- src/lib/meshkee.ts | 10 +++++ 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 2f69b9b..8ee47cb 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -46,13 +46,14 @@ export default async function Home() { (slot) => slot.key === STATIC_IMAGE_KEYS.threeBannerRow, ); const heroImages = imagesForSlot(staticImageSlots, STATIC_IMAGE_KEYS.homeHero); + const featuredCategoryImages = imagesForSlot(staticImageSlots, STATIC_IMAGE_KEYS.featuredCategories); return ( <> - + +
+ {/* eslint-disable-next-line @next/next/no-img-element */} + {label} +
+ {label && ( + + {label} + + )} + + ); + return image.linkUrl ? {content} : content; +} + +export function FeaturedCategories({ + categories, + images = [], +}: { + categories: Category[]; + images?: StaticImageWithUrl[]; +}) { return (
@@ -18,7 +42,29 @@ export function FeaturedCategories({ categories }: { categories: Category[] }) { enTitle="Featured Categories" action="همه دسته‌ها" /> - {categories.length === 0 ? ( + {images.length > 0 ? ( + + {images.map((image, i) => ( + +
+ +
+
+ ))} +
+ ) : categories.length === 0 ? ( ) : ( {