// ============================================================
// Mfg2SolutionsMobile — MOBILE port of the desktop "Solutions for this
// sector" section (Mfg2Solutions) from mfg2-page-2.jsx.
//
// Desktop = interactive facility schematic (left) + 5-row hover list (right),
// on a Soft-Green surface with Paper-White text.
// Mobile keeps the SAME story, palette, type & iconography but swaps hover
// for touch, following the approved EV-Charging mobile pattern:
// • Intro (eyebrow + headline + supporting copy), stacked
// • Interactive diagram, always visible, the visual focus
// • Solution cards as a horizontal swipe carousel below the diagram
// • Tapping a card / diagram marker -> updates the active diagram zone
// • A dedicated "Explore …" link inside each card handles navigation,
// so a first tap activates and the link tap navigates (no touch conflict)
// • Default active zone: 02 — Battery Storage (per approved screenshot)
// ============================================================
const MFG_AMBER = 'rgba(233,199,134,1)'; // --gi-amber-soft
const MFG_AMBER_FILL = 'rgba(233,199,134,0.18)';
const MFG_SOFT_GREEN = '#375844';
// ============================================================
// Mfg2FacilitySchematicMobile — identical SVG schematic to desktop, with
// the numbered markers made tappable (large invisible hit targets).
// 5 zones · 01 Solar PV (roof) · 02 Battery (pad) · 03 Audit (facility)
// · 04 LED Lighting (ceiling band) · 05 EV Charging (loading & yard)
// ============================================================
const Mfg2FacilitySchematicMobile = ({ activeIndex, onSelectZone }) => {
const W = 540;
const H = 360;
const amber = MFG_AMBER;
const amberFill= MFG_AMBER_FILL;
const ink = 'rgba(255,255,255,0.55)';
const inkDim = 'rgba(255,255,255,0.32)';
const inkFaint = 'rgba(255,255,255,0.18)';
const inkText = 'rgba(255,255,255,0.62)';
const zones = [
{ id: 0, label: '01', cx: 270, cy: 96,
hl: },
{ id: 1, label: '02', cx: 502, cy: 244,
hl: },
{ id: 2, label: '03', cx: 270, cy: 200,
hl: },
{ id: 3, label: '04', cx: 270, cy: 134,
hl: },
{ id: 4, label: '05', cx: 80, cy: 308,
hl: },
];
return (
);
};
// ============================================================
// Mfg2SolutionsMobile — full mobile section
// ============================================================
const Mfg2SolutionsMobile = () => {
const rows = [
{ idx: '01', icon: 'sun', name: 'Commercial Solar', zone: 'Rooftop', tag: 'Offset daytime production load.', why: 'High annual consumption and large roof areas make manufacturing facilities strong candidates for rooftop solar generation — sized to the optimised load, not the unmanaged one.', href: 'Solutions - Commercial Solar.html' },
{ idx: '02', icon: 'battery-charging', name: 'Battery Storage', zone: 'Outdoor pad', tag: 'Cut peak demand charges.', why: 'Storage captures excess solar generation and shaves the demand spikes that set monthly billing — and unlocks IESO demand-response revenue on flexible loads.', href: 'Solutions - Battery Storage.html' },
{ idx: '03', icon: 'clipboard-list', name: 'Energy Audits', zone: 'Whole facility', tag: 'Establish the baseline first.', why: 'Audits identify demand reduction opportunities across HVAC, compressed air, lighting, and building controls — before any generation system is sized against the wrong load.', href: 'Solutions - Energy Audits.html' },
{ idx: '04', icon: 'lightbulb', name: 'LED Lighting', zone: 'Production ceiling', tag: 'Highest-return retrofit on the floor.', why: 'Manufacturing facilities often have large, poorly lit production areas with legacy HID fixtures. LED retrofits cut both consumption and demand and qualify for saveONenergy incentives.', href: 'Solutions - LED Lighting.html' },
{ idx: '05', icon: 'plug-zap', name: 'EV Charging', zone: 'Loading & yard', tag: 'Fleet electrification on a plan.', why: 'For facilities with vehicle fleets or planning electrification, on-site solar provides a cost-effective charging infrastructure tied to operational schedules.', href: 'Solutions - EV Charging.html' },
];
// Default active zone: 02 — Battery Storage (index 1), per approved screenshot.
const [active, setActive] = React.useState(1);
const scrollerRef = React.useRef(null);
const cardRefs = React.useRef([]);
const programmatic = React.useRef(false);
const rafId = React.useRef(0);
const settleTimer = React.useRef(0);
const didInit = React.useRef(false);
// (Re)draw lucide icons whenever the active card changes.
React.useEffect(() => {
const t = setTimeout(() => window.lucide && window.lucide.createIcons({ attrs: { 'stroke-width': 1.4 } }), 20);
return () => clearTimeout(t);
}, [active]);
const scrollToCard = (i, instant) => {
const sc = scrollerRef.current;
const card = cardRefs.current[i];
if (!sc || !card) return;
programmatic.current = true;
window.clearTimeout(settleTimer.current);
const target = card.offsetLeft - (sc.clientWidth - card.clientWidth) / 2;
const max = sc.scrollWidth - sc.clientWidth;
const end = Math.max(0, Math.min(max, target));
const start = sc.scrollLeft;
const dist = end - start;
window.cancelAnimationFrame(scrollToCard._raf);
if (instant) {
// No CSS scroll-snap to fight us, so a direct jump holds. Re-assert on
// the next frame in case layout settles a hair after the first paint.
sc.scrollLeft = end;
window.requestAnimationFrame(() => {
sc.scrollLeft = end;
programmatic.current = false;
});
return;
}
if (Math.abs(dist) < 1) {
programmatic.current = false;
return;
}
const dur = 420;
const t0 = (window.performance || Date).now();
const ease = (t) => 1 - Math.pow(1 - t, 3); // easeOutCubic
const step = (now) => {
const p = Math.min(1, (now - t0) / dur);
sc.scrollLeft = start + dist * ease(p);
if (p < 1) {
scrollToCard._raf = window.requestAnimationFrame(step);
} else {
programmatic.current = false;
}
};
scrollToCard._raf = window.requestAnimationFrame(step);
};
// Center the default card (02) on first paint. The flex children may not
// have their final layout on the first frame (offsetLeft still 0), so retry
// across a few frames until a card reports a non-zero offset, then jump.
React.useEffect(() => {
if (didInit.current) return;
let tries = 0;
const tryCenter = () => {
const sc = scrollerRef.current;
const card = cardRefs.current[1];
if (sc && card && card.offsetLeft > 0) {
didInit.current = true;
scrollToCard(1, true);
return;
}
if (tries++ < 40) requestAnimationFrame(tryCenter);
};
requestAnimationFrame(tryCenter);
// Belt-and-suspenders: also re-center once everything (fonts/images) loads.
const onLoad = () => { didInit.current = false; tries = 0; requestAnimationFrame(tryCenter); };
window.addEventListener('load', onLoad);
return () => window.removeEventListener('load', onLoad);
}, []);
// Tap a card OR a diagram marker -> select that zone + center its card.
const selectZone = (i) => {
setActive(i);
scrollToCard(i);
};
const nearestCard = () => {
const sc = scrollerRef.current;
if (!sc) return 0;
const center = sc.scrollLeft + sc.clientWidth / 2;
let best = 0, bestDist = Infinity;
cardRefs.current.forEach((c, i) => {
if (!c) return;
const cc = c.offsetLeft + c.clientWidth / 2;
const d = Math.abs(cc - center);
if (d < bestDist) { bestDist = d; best = i; }
});
return best;
};
// Swipe -> live-update the active zone to the nearest card, then JS-snap to
// center it once the user stops scrolling (CSS scroll-snap is disabled
// because mandatory snap reverts programmatic centering to position 0).
const handleScroll = () => {
if (programmatic.current) return;
window.clearTimeout(settleTimer.current);
settleTimer.current = window.setTimeout(() => {
const i = nearestCard();
scrollToCard(i);
}, 110);
if (rafId.current) return;
rafId.current = requestAnimationFrame(() => {
rafId.current = 0;
const best = nearestCard();
setActive((prev) => (prev === best ? prev : best));
});
};
return (
{/* Top amber tick — mirrors desktop */}
{/* ===== 1 · INTRO ===== */}
Solutions for this sector
What manufacturing projects typically involve.
A complete manufacturing program begins with the load baseline, then
sequences efficiency and generation together — solar, storage, lighting,
and EV infrastructure planned around production schedules and BEPS positioning.