/* global React, VEHICLES, BRANDS, BODY_TYPES */
const { useState: useState1, useEffect: useEffect1, useMemo: useMemo1, useRef: useRef1 } = React;
/* ============================================================
HOME
============================================================ */
const HOME_HERO = [
{ id: "pagani-huayra-bc-roadster", title: ["Pagani Huayra", "Roadster BC"], note: "1 of 40 worldwide · Just arrived" },
{ id: "koenigsegg-jesko-attack", title: ["Koenigsegg", "Jesko Attack"], note: "Track-spec aero · 1,600 HP" },
{ id: "bugatti-chiron-sport", title: ["Bugatti Chiron", "Pur Sport"], note: "Glacier White · 1,500 HP" },
{ id: "mclaren-p1-gtr", title: ["McLaren", "P1 GTR"], note: "Road-converted hypercar" },
];
const HomeScreen = ({ navigate, onEnquire, openVehicle }) => {
const [slide, setSlide] = useState1(0);
useEffect1(() => {
const t = setInterval(() => setSlide(s => (s + 1) % HOME_HERO.length), 6500);
return () => clearInterval(t);
}, []);
const cur = HOME_HERO[slide];
const curVehicle = VEHICLES.find(v => v.id === cur.id);
const featured = useMemo1(() => VEHICLES.filter(v => v.condition === "new").slice(0, 6), []);
const services = [
{ num: "01", title: "Acquire from our showroom", body: "Always ~100 outstanding automobiles in stock — hypercars, supercars, GTs, classics and luxury SUVs. Every car is private-treaty.", link: "Browse inventory", to: "inventory" },
{ num: "02", title: "Sell us your car", body: "Bring a high-end vehicle to a trusted home. Submit photos and details — receive a discreet valuation within one business day.", link: "Sell your car", to: "sell" },
{ num: "03", title: "Worldwide export", body: "We arrange delivery to any port or airport worldwide — established export to GCC, Europe, the Russian-speaking market, and Greater China.", link: "Export enquiry", to: "export" },
];
return (
{/* Hero */}
Dubai · U.A.E. · Since 1995
Featured · {cur.note}
The world's most exclusive automobile showroom
Singular machines,
sourced and delivered worldwide.
A private showroom of hypercars, supercars, classics and luxury saloons —
acquired, traded and exported by Alain Class Motors from Dubai since 1995.
navigate("inventory")}>
Browse inventory
openVehicle(curVehicle)}>
View this car
{String(slide + 1).padStart(2,'0')} / {String(HOME_HERO.length).padStart(2,'0')}
{HOME_HERO.map((_, i) => (
setSlide(i)} aria-label={"Slide " + (i+1)}/>
))}
{/* Top Gear accolade */}
Press · cited media
The best supercar dealership in the world.
— BBC Top GearAttributed quote · topgear.com
{/* Trust strip */}
31yrs
Since 1995 · Al Ain origin
~100
Vehicles in stock at any time
5
U.A.E. branches · ~32,500 sq ft
∞
Worldwide import & export
{/* Featured inventory */}
{/* Services teaser */}
{services.map(s => (
navigate(s.to)}>
— {s.num}
{s.title}
{s.body}
{s.link}
))}
{/* Brand wall */}
{BRANDS.slice(0, 16).map(b => (
navigate("inventory")}>{b}
))}
Alain Class Motors is an independent multi-brand showroom and is not affiliated with, endorsed by, or sponsored by any of the manufacturers above. All marques are the property of their respective owners.
{/* Visit a branch */}
Visit a showroom
Five U.A.E. addresses.
Private viewings on request.
From the flagship on Sheikh Zayed Road to the heritage Al Ain showroom — every vehicle is on display in person. We're happy to arrange private viewings, after-hours appointments, or vehicle delivery to your home or hotel.
navigate("contact")}>See all branches
onEnquire("enquire")}>Book a viewing
);
};
window.HomeScreen = HomeScreen;
/* ============================================================
INVENTORY
============================================================ */
const InventoryScreen = ({ navigate, openVehicle }) => {
const [brand, setBrand] = useState1("All");
const [body, setBody] = useState1("All");
const [cond, setCond] = useState1("All");
const [sort, setSort] = useState1("featured");
const filtered = useMemo1(() => {
let arr = VEHICLES.slice();
if (brand !== "All") arr = arr.filter(v => v.make === brand);
if (body !== "All") arr = arr.filter(v => v.body === body);
if (cond !== "All") arr = arr.filter(v => v.condition === cond);
if (sort === "year-desc") arr.sort((a,b) => b.year - a.year);
if (sort === "year-asc") arr.sort((a,b) => a.year - b.year);
if (sort === "make") arr.sort((a,b) => a.make.localeCompare(b.make));
return arr;
}, [brand, body, cond, sort]);
const bodyCounts = useMemo1(() => {
const c = {};
VEHICLES.forEach(v => { c[v.body] = (c[v.body] || 0) + 1; });
return c;
}, []);
return (
Inventory · {VEHICLES.length} live
Vehicles in the showroom.
Demo seed only — production reads from the live DMS / Dubicars feed.
All prices are POA (price on application) .
Updated daily across five U.A.E. branches.
setBrand("All")}>
All brands {VEHICLES.length}
{[...new Set(VEHICLES.map(v => v.make))].sort().map(b => (
setBrand(b)}>
{b}
))}
Sort
setSort(e.target.value)}>
Featured
Year — newest
Year — oldest
Make A → Z
setBody("All")}>All body types
{BODY_TYPES.map(t => (
setBody(t.id)}>
{t.label} {bodyCounts[t.id] || 0}
))}
setCond("All")}>All
setCond("new")}>New
setCond("used")}>Pre-owned
Showing {filtered.length} of {VEHICLES.length}
Prices on application · Watermarked photography
{filtered.length === 0 ? (
No vehicles match these filters. { setBrand("All"); setBody("All"); setCond("All"); }}>Clear filters
) : (
{filtered.map(v => (
))}
)}
);
};
window.InventoryScreen = InventoryScreen;