All routing in the BAP Beta Tau frontend is declared in a single file —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/asubap/website/llms.txt
Use this file to discover all available pages before exploring further.
src/App.tsx — using React Router DOM v7’s <Routes> and <Route> components inside a <BrowserRouter>. The route tree is split into two categories: public routes that anyone can visit without authentication, and protected routes that require a valid Supabase session before the browser renders them. Protected routes are wrapped in a <ProtectedRoute /> layout component that reads auth state from useAuth() and redirects unauthenticated visitors to /login. Within protected routes, a secondary permission layer restricts certain paths to specific roles (e-board, general-member, sponsor).
Route Declarations in App.tsx
The complete route tree as declared in the source:
Public Routes
Public routes are accessible to any visitor regardless of authentication status. TheNavbar component renders different links based on whether isAuthenticated is true, but the routes themselves impose no auth check.
| Path | Page Component | Description |
|---|---|---|
/ | HomePage | Public homepage with hero, “Who We Are” section, and upcoming events preview. |
/about | AboutPage | Chapter mission, values, and history. |
/sponsors | SponsorsPage | Showcase of chapter sponsors organized by tier. |
/events | EventsPage | Public events calendar listing. Does not show RSVP or check-in actions. |
/membership | ProcessFlow | Step-by-step membership application process guide. |
/login | LogInPage | Google OAuth sign-in page. Renders the GoogleLogin component. |
/contact-us | ContactUsPage | Public contact form for reaching chapter officers. |
/eboard-faculty | EboardFacultyPage | Public directory of executive board members and faculty advisors. |
Protected Routes
Protected routes sit inside the<Route element={<ProtectedRoute />}> layout route. React Router renders ProtectedRoute first; if it returns <Outlet />, the child route renders. If authentication or permission checks fail, ProtectedRoute returns a <Navigate> redirect instead.
| Path | Page Component | Required Role | Description |
|---|---|---|---|
/auth/Home | AuthHome | Session only (no role required) | Post-login landing page. Also shown if role fetch fails, to display the auth error. |
/admin | Admin | e-board | Full admin dashboard with member, event, announcement, sponsor, resource, and e-board management. |
/sponsor | SponsorHome | sponsor | Sponsor portal with company profile and resource upload tools. |
/member | MemberView | general-member | General member dashboard with profile, announcements, and event actions. |
/network | NetworkingPage | Any valid role | Searchable directory of active chapter members. |
/alumni | AlumniPage | Any valid role | Searchable directory of chapter alumni. |
/eboard-network | EboardPage | Any valid role | Directory view of current executive board members. |
/sponsors-network | SponsorsNetworkPage | Any valid role | Authenticated sponsors directory for member networking. |
/events/:eventId | ViewEvent | Any valid role | Full event detail page with RSVP, check-in, and attendee management (admin only). |
/resources | ResourcesPage | Any valid role | Shared resource library with file previews and category filtering. |
/auth/Home is intentionally exempt from the role check inside ProtectedRoute. This allows the AuthHome page to render even when the backend role fetch has failed, so the page can display the error message and offer a sign-out option before the interval or state cleanup occurs.The ProtectedRoute Component
ProtectedRoute is a layout route component — it renders no visual UI of its own, only a redirect or <Outlet /> based on auth state.
Guard Decision Flow
Post-Login Redirect
When an unauthenticated user attempts to visit a protected path,ProtectedRoute saves the attempted path to localStorage before redirecting:
LogInPage (or the AuthProvider after session establishment) should read this value to redirect the user back after a successful login.
Navigation Links
Navigation links are defined insrc/components/nav/NavLink.ts and are not hardcoded in the Navbar component. The getNavLinks(isLoggedIn) function returns the appropriate set based on authentication state.
The authenticated nav always links to
/admin as the “Dashboard” link, regardless of the user’s role. ProtectedRoute will redirect non-e-board users away from /admin to /auth/Home — the role-appropriate dashboard (/member, /sponsor) is reached from AuthHome rather than from the nav bar directly.Adding a New Route
Create the page component
Add a new directory under
src/pages/ (e.g., src/pages/my-feature/) and create the page component file (e.g., MyFeaturePage.tsx).Declare the route
Add a
<Route> element. For a public route, add it at the top level. For a protected route, nest it inside the existing <Route element={<ProtectedRoute />}> block.Add role restrictions if needed
If the route should be restricted to a specific role, add the check to
hasPermission() in ProtectedRoute.tsx: