A schedule block on an event page has a Present button, opening /events/<id>/present in a new tab: a setup screen (days, entries, seconds for each kind of slide) and then an endless full screen slideshow of day overviews, entry spotlights with their person, graphics and map images, its settings kept in the address so a signage screen can bookmark it. Schedule entries take a Map image (069), shown in the fold-out in place of the Google map and as a slide in the presentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
159 lines
6.8 KiB
TypeScript
159 lines
6.8 KiB
TypeScript
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 <Outlet /> in <Suspense>, 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 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 (
|
|
<BrowserRouter>
|
|
<Routes>
|
|
{/* Layout renders the nav once and swaps page content into <Outlet /> */}
|
|
<Route element={<Layout />}>
|
|
<Route index element={<Home />} />
|
|
<Route path="retreats" element={<SitePage key="retreats" id="retreats" />} />
|
|
<Route path="/events/:id" element={<EventDetail />} />
|
|
<Route path="community" element={<SitePage key="community" id="community" />} />
|
|
<Route path="/regions/:id" element={<OrganizationDetail />} />
|
|
<Route path="/groups/:id" element={<OrganizationDetail />} />
|
|
<Route path="/partners/:id" element={<OrganizationDetail />} />
|
|
<Route path="/organizations/:id" element={<OrganizationDetail />} />
|
|
<Route path="/teams/:id" element={<TeamDetail />} />
|
|
<Route path="/awards/:id" element={<AwardDetail />} />
|
|
<Route path="/people/:id" element={<PersonDetail />} />
|
|
<Route path="/blog/:id" element={<BlogPost />} />
|
|
<Route path="/directory/:id" element={<DirectoryPage />} />
|
|
<Route path="organization" element={<SitePage key="organization" id="organization" />} />
|
|
<Route path="resources" element={<SitePage key="resources" id="resources" />} />
|
|
<Route path="history" element={<SitePage key="history" id="history" />} />
|
|
<Route path="feedback" element={<Feedback />} />
|
|
<Route path="request" element={<Request />} />
|
|
<Route path="qr" element={<QrCodes />} />
|
|
<Route path="give" element={<Giving />} />
|
|
<Route path="privacy" element={<Privacy />} />
|
|
<Route path="terms" element={<Terms />} />
|
|
<Route path="*" element={<NotFound />} />
|
|
</Route>
|
|
{/* A schedule as a slideshow for a screen: full screen, no Layout. */}
|
|
<Route
|
|
path="/events/:id/present"
|
|
element={
|
|
<Suspense fallback={null}>
|
|
<SchedulePresent />
|
|
</Suspense>
|
|
}
|
|
/>
|
|
<Route
|
|
element={
|
|
<AuthProvider>
|
|
<Suspense fallback={null}>
|
|
<Outlet />
|
|
</Suspense>
|
|
</AuthProvider>
|
|
}
|
|
>
|
|
<Route path="/admin/login" element={<AdminLogin />} />
|
|
<Route element={<RequireAuth />}>
|
|
<Route path="/admin" element={<AdminLayout />}>
|
|
<Route index element={<Navigate to="/admin/home" replace />} />
|
|
<Route path="home" element={<AdminHome />} />
|
|
<Route element={<RequireRole role="superadmin" />}>
|
|
<Route path="panel" element={<AdminPanel />} />
|
|
</Route>
|
|
<Route path="feedback" element={<AdminFeedback />} />
|
|
<Route path="data-requests" element={<AdminFeedback kind="privacy" />} />
|
|
<Route path="requests" element={<AdminFeedback kind="content" />} />
|
|
<Route path="media" element={<AdminMedia />} />
|
|
<Route path="newsletter" element={<AdminNewsletter />} />
|
|
<Route element={<RequireRole role="admin" />}>
|
|
<Route path="clips" element={<AdminClips />} />
|
|
</Route>
|
|
<Route path=":entity" element={<EntityList />} />
|
|
<Route path=":entity/:id" element={<EntityEdit />} />
|
|
</Route>
|
|
</Route>
|
|
</Route>
|
|
</Routes>
|
|
</BrowserRouter>
|
|
)
|
|
}
|