From 6f0b569fce2c191e22d8f9f3978f4e827217204a Mon Sep 17 00:00:00 2001 From: Vula Builder Date: Sat, 1 Aug 2026 16:13:29 +0000 Subject: [PATCH] Deploy --- .../sections/BrandCarouselSection.tsx | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/components/sections/BrandCarouselSection.tsx diff --git a/src/components/sections/BrandCarouselSection.tsx b/src/components/sections/BrandCarouselSection.tsx new file mode 100644 index 0000000..72c0720 --- /dev/null +++ b/src/components/sections/BrandCarouselSection.tsx @@ -0,0 +1,48 @@ +import Link from 'next/link' + +const VULA_CMS_URL = process.env.VULA_CMS_URL || 'https://ide.vulai.co.za' +const VULA_PROJECT_ID = process.env.VULA_CMS_PROJECT_ID || '' + +interface VulaCategory { id: string; name: string; handle: string } + +async function getCategories(): Promise { + if (!VULA_PROJECT_ID) return [] + try { + const r = await fetch( + `${VULA_CMS_URL}/api/store/${VULA_PROJECT_ID}/categories`, + { next: { revalidate: 300 } } + ) + if (!r.ok) return [] + const data = await r.json() as { product_categories?: VulaCategory[] } + return data.product_categories ?? [] + } catch { + return [] + } +} + +export default async function BrandCarouselSection() { + const categories = await getCategories() + if (!categories.length) return null + + return ( +
+
+

Shop by Category

+
+ {categories.map(cat => ( + +
+ {cat.name.slice(0, 2)} +
+

{cat.name}

+ + ))} +
+
+
+ ) +}