import { BrowserRouter, Routes, Route, Outlet, Navigate, } from "react-router-dom" import { lazy, Suspense } from "react" /*Components*/ import Layout from "./components/Layout.tsx" /*Libraries*/ import { AuthProvider, RequireAuth } from "./lib/auth.tsx" import RequireRole from "./pages/admin/RequireRole.tsx" /*Pages*/ // Every page, the front page included, and all of the admin, is // fetched when first visited: a visitor never downloads the admin, // and a page's own parts come with it. The front page's data is asked // for by its HTML before this runs (pageMeta.js, preload). Layout and // AdminLayout wrap their in , so the header stays // put while a page loads. /* A page's chunk can be missing when a deploy replaced the build while this tab still ran the old one. Reload once to pick up the new build; if that doesn't help, let the error surface. */ const CHUNK_RELOAD = "site-chunk-reload" const lazyPage = (load) => lazy(() => load() .then((page) => { try { sessionStorage.removeItem(CHUNK_RELOAD) } catch {} return page }) .catch((err) => { const key = CHUNK_RELOAD let reloaded = false try { reloaded = sessionStorage.getItem(key) === "1" sessionStorage.setItem(key, "1") } catch {} if (!reloaded) { window.location.reload() return new Promise(() => {}) } throw err }), ) // Every page at its address (Pages → Page management): its sections. const PageAtPath = lazyPage(() => import("./pages/PageAtPath.tsx")) // The front page: its sections, in the front page's layout. const SitePage = lazyPage(() => import("./pages/SitePage.tsx")) // Profile accounts (076): signing in, an invite's welcome, the profile. const SignIn = lazyPage(() => import("./pages/SignIn.tsx")) const AccountWelcome = lazyPage(() => import("./pages/AccountWelcome.tsx")) const Account = lazyPage(() => import("./pages/Account.tsx")) /*Entity Pages*/ const EventDetail = lazyPage(() => import("./pages/EventDetail.tsx")) const OrganizationDetail = lazyPage( () => import("./pages/OrganizationDetail.tsx"), ) const TeamDetail = lazyPage(() => import("./pages/TeamDetail.tsx")) const AwardDetail = lazyPage(() => import("./pages/AwardDetail.tsx")) const PersonDetail = lazyPage(() => import("./pages/PersonDetail.tsx")) const BlogPost = lazyPage(() => import("./pages/BlogPost.tsx")) const DirectoryPage = lazyPage(() => import("./pages/DirectoryPage.tsx")) const SchedulePresent = lazyPage(() => import("./pages/SchedulePresent.tsx")) /*Admin Pages*/ const AdminLayout = lazyPage(() => import("./pages/admin/AdminLayout.tsx")) const AdminLogin = lazyPage(() => import("./pages/admin/AdminLogin.tsx")) const AdminPanel = lazyPage(() => import("./pages/admin/AdminPanel.tsx")) const AdminHome = lazyPage(() => import("./pages/admin/AdminHome.tsx")) const AdminFeedback = lazyPage(() => import("./pages/admin/AdminFeedback.tsx")) const AdminMedia = lazyPage(() => import("./pages/admin/AdminMedia.tsx")) const AdminClips = lazyPage(() => import("./pages/admin/AdminClips.tsx")) const AdminVideoFrames = lazyPage(() => import("./pages/admin/AdminVideoFrames.tsx")) const AdminNewsletter = lazyPage(() => import("./pages/admin/AdminNewsletter.tsx")) const AdminProfiles = lazyPage(() => import("./pages/admin/AdminProfiles.tsx")) const AdminConvert = lazyPage(() => import("./pages/admin/AdminConvert.tsx")) const AdminPco = lazyPage(() => import("./pages/admin/AdminPco.tsx")) const EntityList = lazyPage(() => import("./pages/admin/EntityList.tsx")) const EntityEdit = lazyPage(() => import("./pages/admin/EntityEdit.tsx")) export default function App() { return ( {/* The whole app: the site shows a profile link and hidden pages by who's signed in. */} {/* Layout renders the nav once and swaps page content into */} }> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* Every page of the site: Pages → Page management (PageAtPath). */} } /> {/* A schedule as a slideshow for a screen: full screen, no Layout. */} } /> } > } /> }> }> } /> } /> }> } /> } /> } /> } /> } /> } /> } /> }> } /> }> } /> } /> } /> } /> } /> ) }