/* global React, ReactDOM, NA_DATA, NASite, HomePage, TeamsPage, FixturesPage, SessionsPage, CampsPage, AcademyPage, TravelTeamsPage, CoachesPage, AboutPage, SponsorsPage, ShopPage, ContactPage, JoinSuccessPage, useTweaks, TweaksPanel, TweakSection, TweakRadio, TweakSelect */
const { useState, useEffect } = React;
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"accent": "yellow",
"density": "comfortable",
"heroVariant": "scoreboard"
}/*EDITMODE-END*/;
function App() {
// If the user has been redirected back from GoCardless (or hit /join-success
// directly), land them on the success screen on first render.
const initialPage = (() => {
if (typeof window === 'undefined') return 'home';
if (window.location.hash === '#join-success') return 'join-success';
if (window.location.pathname.endsWith('/join-success')) return 'join-success';
return 'home';
})();
const [page, setPage] = useState(initialPage);
const [mobileOpen, setMobileOpen] = useState(false);
const [tweaks, setTweak] = useTweaks(TWEAK_DEFAULTS);
useEffect(() => {
document.documentElement.setAttribute('data-accent', tweaks.accent);
document.documentElement.setAttribute('data-density', tweaks.density);
}, [tweaks.accent, tweaks.density]);
useEffect(() => { window.scrollTo({ top: 0, behavior: 'instant' }); }, [page]);
const { Topbar, Footer } = NASite;
const renderPage = () => {
switch (page) {
case 'home': return