/* global React, ReactDOM, Nav, Footer, Hero, RankingsStrip, ExpertiseSection, LeadershipFeature, InsightsTeaser, RegionMap, AwardsRow, ClosingCTA,
ExpertisePage, PeoplePage, OfficesPage, InsightsPage, AboutPage, ContactPage, CareersPage,
Modal, EnquiryForm, LawyerDetail, STRINGS,
useTweaks, TweaksPanel, TweakSection, TweakRadio, TweakSelect, TweakToggle, TweakColor */
const { useState, useEffect, useCallback } = React;
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"accent": "marine",
"display": "cormorant",
"locale": "en",
"denseHero": false
}/*EDITMODE-END*/;
function App() {
const [tweak, setTweak] = useTweaks(TWEAK_DEFAULTS);
const [page, setPage] = useState("home");
const [modal, setModal] = useState(null); // { kind: 'enquiry' | 'lawyer', data: ... }
const locale = tweak.locale;
const t = STRINGS[locale] || STRINGS.en;
// Apply attributes on documentElement
useEffect(() => {
document.documentElement.setAttribute("data-accent", tweak.accent);
document.documentElement.setAttribute("data-display", tweak.display);
document.documentElement.setAttribute("lang", locale === "ar" ? "ar" : "en");
document.documentElement.setAttribute("dir", locale === "ar" ? "rtl" : "ltr");
}, [tweak.accent, tweak.display, locale]);
const navigate = useCallback((p) => {
setPage(p);
window.scrollTo({ top: 0, behavior: "instant" });
}, []);
const openEnquiry = useCallback((preset = {}) => {
setModal({ kind: "enquiry", data: preset });
}, []);
const openLawyer = useCallback((p) => {
setModal({ kind: "lawyer", data: p });
}, []);
const closeModal = useCallback(() => setModal(null), []);
const pageContent = (() => {
switch (page) {
case "expertise":
return ;
case "people":
return ;
case "offices":
return ;
case "insights":
return ;
case "about":
return ;
case "contact":
return ;
case "careers":
return ;
case "home":
default:
return (
);
}
})();
return (
);
}
// Tweak color options can be objects {value, color} — TweakColor expects either a hex string
// or an array of hexes. Wrap to support our value/color pattern:
(function patchTweakColor() {
const orig = window.TweakColor;
window.TweakColor = function (props) {
const { options, value, onChange } = props;
if (options && options.length && typeof options[0] === "object" && options[0].value !== undefined) {
const hexOptions = options.map((o) => o.color);
const hexValue = options.find((o) => o.value === value)?.color || hexOptions[0];
return orig({ ...props, options: hexOptions, value: hexValue, onChange: (h) => onChange(options.find((o) => o.color === h)?.value) });
}
return orig(props);
};
})();
ReactDOM.createRoot(document.getElementById("root")).render();