// Modal overlays — collection story, lookbook lightbox, consultation form.
const { useState: useStateO, useEffect: useEffectO } = React;
// ───────────────────────────────────────────── COLLECTION STORY MODAL
function CollectionView({ collectionId, onClose }){
const collection = window.PG_DATA.COLLECTIONS.find(c=>c.id===collectionId);
useEffectO(()=>{
if(!collection) return;
document.body.style.overflow = 'hidden';
const onKey = e=>{ if(e.key==='Escape') onClose(); };
window.addEventListener('keydown', onKey);
return ()=>{ document.body.style.overflow=''; window.removeEventListener('keydown', onKey); };
},[collection, onClose]);
if(!collection) return null;
const enquireLink = `https://wa.me/971566854889?text=${encodeURIComponent(`Hi Pavit Gujral, I'd like to enquire about the ${collection.name} Collection.`)}`;
return (
✕
{/* Hero panel — black with epigraph + key piece */}
Pavit Gujral · The Collection
The
{collection.name}
{collection.epigraph}
{collection.attribution}
{/* Story panel */}
The story · {collection.theme}
{collection.story.map((p,i)=>(
{p}
))}
{/* Pieces gallery */}
Pieces in the collection
{collection.pieces.length} pieces · price on request
{collection.pieces.map(p=>(
))}
);
}
function PieceCard({ piece }){
const [hover, setHover] = useStateO(false);
const link = `https://wa.me/971566854889?text=${encodeURIComponent(`Hi Pavit Gujral, I'd like to enquire about: ${piece.enquire}`)}`;
return (
setHover(true)}
onMouseLeave={()=>setHover(false)}
style={{background:'#15110E', border:'1px solid var(--line)', overflow:'hidden', display:'flex', flexDirection:'column'}}>
{piece.badge && (
★ {piece.badge}
)}
);
}
// ───────────────────────────────────────────── LOOKBOOK LIGHTBOX
function Lightbox({ index, onClose, onNext, onPrev }){
const items = window.PG_DATA.LOOKBOOK;
useEffectO(()=>{
document.body.style.overflow = 'hidden';
const onKey = e=>{
if(e.key==='Escape') onClose();
if(e.key==='ArrowRight') onNext();
if(e.key==='ArrowLeft') onPrev();
};
window.addEventListener('keydown', onKey);
return ()=>{ document.body.style.overflow=''; window.removeEventListener('keydown', onKey); };
},[onClose, onNext, onPrev]);
if(index==null) return null;
const item = items[index];
return (
✕
‹
›
{item.label}
{index+1} / {items.length}
);
}
// ───────────────────────────────────────────── CONSULTATION FORM MODAL
function ConsultationForm({ open, onClose, initialCollection='' }){
const [data, setData] = useStateO({
name:'', email:'', phone:'', occasion:'Bespoke / customised design',
collection: initialCollection, message:''
});
const [sent, setSent] = useStateO(false);
useEffectO(()=>{
if(open){
document.body.style.overflow='hidden';
setSent(false);
setData(d=>({...d, collection: initialCollection}));
} else {
document.body.style.overflow='';
}
const onKey = e=>{ if(e.key==='Escape' && open) onClose(); };
window.addEventListener('keydown', onKey);
return ()=>window.removeEventListener('keydown', onKey);
},[open, onClose, initialCollection]);
if(!open) return null;
const set = (k,v)=>setData(d=>({...d, [k]:v}));
const handoff = ()=>{
const lines = [
`Hi Pavit Gujral, I'd like to book a consultation.`,
data.name && `Name: ${data.name}`,
data.email && `Email: ${data.email}`,
data.phone && `Phone: ${data.phone}`,
`Occasion: ${data.occasion}`,
data.collection && `Collection of interest: ${data.collection}`,
data.message && `Message: ${data.message}`
].filter(Boolean).join('\n');
const url = `https://wa.me/971566854889?text=${encodeURIComponent(lines)}`;
window.open(url, '_blank');
setSent(true);
};
const COLLECTIONS = window.PG_DATA.COLLECTIONS;
return (
{/* Left — context panel */}
✕
Book a Consultation
The first conversation is yours.
Share the brief — an occasion, an inherited stone, a collection that caught the eye — and we will be in touch within the working day. The studio is by appointment.
{/* Right — form */}
{!sent ? (
) : (
Brief sent
Thank you, {data.name || 'beautifully said'}.
Your message has been handed off to WhatsApp. Pavit's atelier responds within the working day — usually faster. While you wait, a few stones to look at:
Continue browsing
)}
);
}
Object.assign(window, { CollectionView, Lightbox, ConsultationForm });