diff --git a/src/components/ScrollOverlays.tsx b/src/components/ScrollOverlays.tsx index 87c9550..bf41ecb 100644 --- a/src/components/ScrollOverlays.tsx +++ b/src/components/ScrollOverlays.tsx @@ -1,7 +1,7 @@ 'use client'; import { useScroll, useTransform, motion } from 'framer-motion'; -import { ReactNode } from 'react'; +import { ReactNode, useEffect, useState } from 'react'; import Link from 'next/link'; interface SectionProps { @@ -132,6 +132,33 @@ const SECTION_CONFIGS = [ export function ScrollOverlays() { const { scrollYProgress } = useScroll(); + // Dynamically load personas from the pricing API so any admin-added attire shows here + const [attireItems, setAttireItems] = useState<{ label: string; id: string }[]>([ + { label: 'Kandura', id: 'emarati-kandura' }, + { label: 'Vest', id: 'industrial-vest' }, + { label: 'Suit', id: 'business-suit' }, + ]); + + useEffect(() => { + fetch('/api/admin/pricing/') + .then((r) => r.json()) + .then((data) => { + const excluded = new Set(['base', 'custom-color', 'emarati-kandura', 'industrial-vest', 'business-suit']); + const extras: { label: string; id: string }[] = (data.items ?? []) + .filter((item: { id: string; label: string; modelPath?: string | null }) => + !excluded.has(item.id) && item.modelPath + ) + .map((item: { id: string; label: string }) => ({ label: item.label, id: item.id })); + setAttireItems([ + { label: 'Kandura', id: 'emarati-kandura' }, + { label: 'Vest', id: 'industrial-vest' }, + { label: 'Suit', id: 'business-suit' }, + ...extras, + ]); + }) + .catch(() => {}); + }, []); + return (