/* Shared components: Nav, Footer, VehicleCard, LeadModal, icons */
const { useState, useEffect, useRef, useMemo, useCallback } = React;
/* ---------- inline icons (no emoji) ---------- */
const Icon = {
arrow: (p) => (
),
wa: (p) => (
),
phone: (p) => (
),
spark: (p) => (
),
close: (p) => (
),
search: (p) => (
),
check: (p) => (
),
diamond: (p) => (
),
};
/* ---------- logo wordmark ---------- */
function Logo({ size = 19 }) {
return (
);
}
/* ---------- top notice ticker ---------- */
function TopNotice({ items }) {
return (
{items.map((t, i) => (
{t}
{i < items.length - 1 && ◆ }
))}
);
}
/* ---------- navbar ---------- */
function Navbar({ route, go, locale, setLocale, openLead }) {
const t = I18N[locale];
const links = [
['home', 'Home'],
['inventory', t.nav.inventory],
['vehicle', t.nav.approved],
['services', t.nav.services],
['export', t.nav.export],
['contact', t.nav.contact],
];
return (
);
}
/* ---------- footer ---------- */
function Footer({ go, locale }) {
const t = I18N[locale];
return (
);
}
/* ---------- floating action stack (always visible) ---------- */
function FabStack() {
return (
);
}
/* ---------- vehicle card ---------- */
function VehicleCard({ v, onOpen, locale }) {
const t = I18N[locale];
return (
onOpen(v.id)}
style={{
cursor: 'pointer',
background: 'var(--surface)',
border: '1px solid var(--line)',
display: 'flex',
flexDirection: 'column',
transition: 'border-color .2s, transform .25s',
}}
onMouseEnter={(e) => (e.currentTarget.style.borderColor = 'var(--accent)')}
onMouseLeave={(e) => (e.currentTarget.style.borderColor = 'var(--line)')}
>
(e.currentTarget.style.transform = 'scale(1.04)')}
onMouseLeave={(e) => (e.currentTarget.style.transform = 'scale(1)')}
/>
{v.certified && (
Elite Approved
)}
{v.stock}
{v.year} · {v.body}
{v.make} {v.model}
{v.trim}
Mileage {v.mileage.toLocaleString()} km
Engine {v.engine.split(' ').slice(0, 2).join(' ')}
);
}
/* ---------- lead modal ---------- */
function LeadModal({ open, onClose, ctx, locale }) {
const t = I18N[locale];
const [stage, setStage] = useState('form'); // form | success
const [intent, setIntent] = useState(ctx?.kind || 'enquire');
useEffect(() => {
if (open) {
setStage('form');
setIntent(ctx?.kind || 'enquire');
}
}, [open, ctx]);
if (!open) return null;
const labels = {
enquire: 'General Enquiry',
price: 'Request Price',
viewing: 'Book a Viewing',
tradein: 'Trade-in Valuation',
finance: 'Finance Enquiry',
export: 'Export Enquiry',
};
const vehicleLine = ctx?.vehicle
? `${ctx.vehicle.year} ${ctx.vehicle.make} ${ctx.vehicle.model} ${ctx.vehicle.trim} · Stock ${ctx.vehicle.stock}`
: null;
return (
e.stopPropagation()} style={{
background: 'var(--surface)', color: 'var(--text)', width: 'min(720px, 100%)',
border: '1px solid var(--line-2)', maxHeight: '92vh', overflow: 'auto',
}}>
{/* header */}
The Elite Cars · Concierge
{stage === 'success' ? <>Thank you. > : <>{labels[intent]}>}
{stage === 'form' ? (
) : (
Your enquiry has been received. A member of the Elite concierge team will be in touch within two business hours.
{vehicleLine && <>Reference: {vehicleLine} >}
)}
);
}
function Field({ label, tag = 'input', options, rows = 3, ...rest }) {
const baseStyle = {
width: '100%', padding: '12px 0', background: 'transparent', border: 'none',
borderBottom: '1px solid var(--line-2)', color: 'var(--text)', fontSize: 14,
outline: 'none', transition: 'border-color .2s',
};
const onFocus = (e) => (e.target.style.borderBottomColor = 'var(--accent)');
const onBlur = (e) => (e.target.style.borderBottomColor = 'var(--line-2)');
return (
{label}
{tag === 'input' && }
{tag === 'select' && (
—
{options.map((o) => {o} )}
)}
{tag === 'textarea' && }
);
}
/* ---------- archival pill (re-usable) ---------- */
function ArchivePill() {
return (
Demo build · archival photography · live inventory consumed from feed
);
}
Object.assign(window, {
Icon, Logo, TopNotice, Navbar, Footer, FabStack, VehicleCard, LeadModal, Field, ArchivePill,
});