From 107ef43a0eb7f34c38861b1a1d2bceb32cac2982 Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 17 Apr 2026 15:45:46 -0400 Subject: [PATCH] fix: hide category tab when it's already shown as an occasion tab If a "Mothers Day" or "Graduation" occasion is active and its squareCategorySlug matches a product category, suppress the duplicate regular category tab so it doesn't appear twice in the bar. Co-Authored-By: Claude Sonnet 4.6 --- estore/src/components/FeaturedProducts.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/estore/src/components/FeaturedProducts.tsx b/estore/src/components/FeaturedProducts.tsx index 1820e7c..68a556a 100644 --- a/estore/src/components/FeaturedProducts.tsx +++ b/estore/src/components/FeaturedProducts.tsx @@ -82,11 +82,15 @@ export default function FeaturedProducts() { return visible }, [items, catOrder, catHidden]) - const tabs = useMemo(() => [ - ...activeOccasions.map((o) => ({ key: o.key, label: `${o.emoji} ${o.label}`, occasion: true })), - { key: 'all', label: 'All', occasion: false }, - ...productCategories.map((c) => ({ ...c, occasion: false })), - ], [activeOccasions, productCategories]) + const tabs = useMemo(() => { + // Category slugs already represented by an occasion tab — hide them from the regular tabs + const occasionSlugs = new Set(activeOccasions.map((o) => o.squareCategorySlug).filter(Boolean) as string[]) + return [ + ...activeOccasions.map((o) => ({ key: o.key, label: `${o.emoji} ${o.label}`, occasion: true })), + { key: 'all', label: 'All', occasion: false }, + ...productCategories.filter((c) => !occasionSlugs.has(c.key)).map((c) => ({ ...c, occasion: false })), + ] + }, [activeOccasions, productCategories]) const activeOccasion: ActiveOccasion | undefined = useMemo( () => activeOccasions.find((o) => o.key === category),