/* Ayyam Gallery — shared components (nav, footer, cards, modal, dossier). */ const { useState, useEffect, useMemo, useRef } = React; const _CMP_DATA = window.AYYAM_DATA; const _GALLERY_ARTISTS = _CMP_DATA.GALLERY_ARTISTS; const _EXHIBITED_ARTISTS = _CMP_DATA.EXHIBITED_ARTISTS; const _WORKS = _CMP_DATA.WORKS; const _ARTIST_BIOS = _CMP_DATA.ARTIST_BIOS; /* ---------- Localized labels ---------- */ const L = { en: { brand: "Ayyam Gallery", sub: "Alserkal Avenue · Dubai", nav: ["Exhibitions","Artists","Publications","Viewing Rooms","Art Fairs","Press","About","Visit"], routes: ["exhibitions","artists","publications","viewing-rooms","art-fairs","press","about","visit"], enquire: "Enquire — POA", requestViewing: "Request a viewing", requestCatalogue: "Request catalogue", visit: "Plan your visit", mailing: "Join the mailing list", mailingNote: "Monthly notes on new exhibitions, publications and viewing rooms. No prices, no marketing — gallery correspondence only.", mailingPlaceholder: "Your email", subscribe: "Subscribe", close: "Close", enquireTitle: "Enquire — Price on application", enquireSub: "We respond by email within two working days. Enquiries are handled discreetly by the gallery's collections desk.", msgPlaceholder: "Anything you'd like us to know — installation, framing, collection context.", submit: "Send enquiry", sent: "Thank you — the collections desk will be in touch.", name: "Name", email: "Email", message: "Message", rightsPending: "Rights pending", galleryArtists: "Gallery artists", exhibitedArtists: "Artists exhibited", current: "Current", upcoming: "Upcoming", past: "Past", workOnView: "On view", by: "by", address: "Address", hours: "Hours", contact: "Contact", socials: "Find us", backToArtists: "All artists", sinceLine: "Founded Damascus, 2006", }, ar: { brand: "غاليري أيام", sub: "العسكر أفينيو · دبي", nav: ["المعارض","الفنانون","المنشورات","غرف العرض","المعارض الفنية","الصحافة","حول","الزيارة"], routes: ["exhibitions","artists","publications","viewing-rooms","art-fairs","press","about","visit"], enquire: "استفسر — السعر عند الطلب", requestViewing: "طلب مشاهدة خاصة", requestCatalogue: "طلب الكتالوج", visit: "خطّط لزيارتك", mailing: "اشترك في القائمة البريدية", mailingNote: "ملاحظات شهرية عن المعارض الجديدة والمنشورات وغرف العرض. مراسلات الغاليري فقط — لا أسعار ولا تسويق.", mailingPlaceholder: "بريدك الإلكتروني", subscribe: "اشتراك", close: "إغلاق", enquireTitle: "استفسار — السعر عند الطلب", enquireSub: "نرد بالبريد الإلكتروني خلال يومي عمل. تُعالَج الاستفسارات بسرية تامة من قبل مكتب المقتنيات.", msgPlaceholder: "أي تفاصيل ترغب بإطلاعنا عليها — التركيب، التأطير، سياق المجموعة.", submit: "إرسال الاستفسار", sent: "شكراً — سيتواصل معك مكتب المقتنيات قريباً.", name: "الاسم", email: "البريد الإلكتروني", message: "الرسالة", rightsPending: "حقوق قيد التأكيد", galleryArtists: "فنانو الغاليري", exhibitedArtists: "فنانون عرضوا أعمالهم", current: "حالي", upcoming: "قادم", past: "سابق", workOnView: "معروض", by: "للفنان", address: "العنوان", hours: "أوقات الزيارة", contact: "للتواصل", socials: "تابعونا", backToArtists: "كل الفنانين", sinceLine: "تأسست في دمشق، 2006", } }; /* ---------- Credit line ---------- */ function CreditLine({ work, compact }) { return (
{work.artist},{" "} {work.title}, {work.year}.
{work.medium}, {work.dims}.{" "} {!compact && <>© the artist. Courtesy Ayyam Gallery.} {compact ? "© rights pending" : "[Rights pending]"}
); } /* ---------- Nav ---------- */ function Navbar({ route, setRoute, locale, setLocale, openEnquiry }) { const t = L[locale]; return (
); } /* ---------- Footer ---------- */ function Footer({ locale, setRoute }) { const t = L[locale]; return ( ); } /* ---------- Mailing list block ---------- */ function MailingList({ locale }) { const t = L[locale]; const [submitted, setSubmitted] = useState(false); return (

{locale==="en" ? <>Notes from the gallery, once a month. : t.mailing}

{t.mailingNote}

{e.preventDefault(); setSubmitted(true);}}> {submitted ?
{t.sent}
: <> }
); } /* ---------- Work card ---------- */ function WorkCard({ work, onClick, locale }) { const t = L[locale]; return ( ); } /* ---------- Exhibition card ---------- */ function ExhibitionCard({ ex, onClick, locale }) { const t = L[locale]; const stateLabel = ex.state === "current" ? t.current : ex.state === "upcoming" ? t.upcoming : t.past; return ( ); } /* ---------- Artist tile ---------- */ const PORTRAITS = { "Tammam Azzam":"media/artist-tammam-azzam-portrait.webp", "Khaled Takreti":"media/artist-khaled-takreti-portrait.webp", "Nihad al-Turk":"media/artist-nihad-al-turk-portrait.webp" }; function pickWorkFor(name) { return _WORKS.find(w => w.artist === name); } function ArtistTile({ name, onClick }) { const portrait = PORTRAITS[name]; const work = pickWorkFor(name); const initial = name.split(" ").map(s=>s[0]).slice(0,2).join(""); return ( ); } /* ---------- Enquiry modal ---------- */ function EnquiryModal({ open, onClose, work, locale, kind }) { const t = L[locale]; const [sent, setSent] = useState(false); useEffect(() => { if (open) setSent(false); }, [open, work]); if (!open) return null; const titleByKind = { work: t.enquireTitle, viewing: locale==="en" ? "Request a private viewing" : "طلب مشاهدة خاصة", catalogue: locale==="en" ? "Request a catalogue / publication" : "طلب كتالوج أو منشور", general: locale==="en" ? "Enquire — Ayyam Gallery" : "استفسر — غاليري أيام" }; return (

{titleByKind[kind] || t.enquireTitle}

{t.enquireSub}
{work && (
)} {sent ? (
{t.sent}
) : (
{e.preventDefault(); setSent(true);}}>
)}
); } /* ---------- Artist dossier overlay ---------- */ function Dossier({ artistName, onClose, locale, openEnquiryFor }) { const t = L[locale]; if (!artistName) return null; const works = _WORKS.filter(w => w.artist === artistName); const portrait = PORTRAITS[artistName]; const bio = _ARTIST_BIOS[artistName] || (locale==="en" ? "Full biography and CV available on request via info@ayyamgallery.com." : "السيرة الذاتية الكاملة متاحة عند الطلب عبر info@ayyamgallery.com."); const isGallery = _GALLERY_ARTISTS.includes(artistName); return (
{ if(e.target.classList.contains("overlay")) onClose(); }}>
); } Object.assign(window, { Navbar, Footer, MailingList, WorkCard, ExhibitionCard, ArtistTile, EnquiryModal, Dossier, CreditLine, L, PORTRAITS });