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*/ // Home is the landing page, so it ships in the main bundle. Every // other page, and all of the admin, is fetched when first visited: // a visitor to the front page never downloads the admin, the QR // encoder, the calendar or the group map. Layout and AdminLayout // wrap their in , so the header stays put while // a page loads. import Home from "./pages/Home.tsx" /* 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 }), ) // Community, Retreats, Resources, Organization and History: each // built in the admin from sections. const SitePage = lazyPage(() => import("./pages/SitePage.tsx")) const Feedback = lazyPage(() => import("./pages/Feedback.tsx")) const Request = lazyPage(() => import("./pages/Request.tsx")) const Giving = lazyPage(() => import("./pages/Giving.tsx")) const QrCodes = lazyPage(() => import("./pages/QrCodes.tsx")) const Privacy = lazyPage(() => import("./pages/Privacy.tsx")) const Terms = lazyPage(() => import("./pages/Terms.tsx")) const NotFound = lazyPage(() => import("./pages/NotFound.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 EntityList = lazyPage(() => import("./pages/admin/EntityList.tsx")) const EntityEdit = lazyPage(() => import("./pages/admin/EntityEdit.tsx")) export default function App() { return ( {/* Layout renders the nav once and swaps page content into */} }> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> } /> {/* A schedule as a slideshow for a screen: full screen, no Layout. */} } /> } > } /> }> }> } /> } /> }> } /> } /> } /> } /> } /> } /> }> } /> }> } /> } /> } /> ) }