Skip to content

Commit

Permalink
Merge branch 'main' into task14
Browse files Browse the repository at this point in the history
  • Loading branch information
lsylcy0307 authored May 14, 2024
2 parents 1bb148e + dfd903b commit 3bcc7a4
Show file tree
Hide file tree
Showing 25 changed files with 2,015 additions and 118 deletions.
2 changes: 2 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
will work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<script src="https://kit.fontawesome.com/c87e40864d.js" crossorigin="anonymous"></script>

<title>Boilerplate</title>
</head>
<body>
Expand Down
86 changes: 54 additions & 32 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ import AlertPopup from './components/AlertPopup';
import InviteRegisterPage from './Authentication/InviteRegisterPage';
import DonorProfilePage from './donorProfile/DonorProfilePage';
import ReportsPage from './Reports/ReportsPage';
import CommunicationsPage from './Communications/CommunicationsPage';
import HomeDashboardPage from './HomeDashboard/HomeDashboard';
import NewDonationPage from './NewDonation/NewDonationPage';
import Sidebar from './Sidebar/Sidebar';
import DonationInfoPage from './DonationInfo/DonationInfoPage';
import PopupPage from './Popup/PopupPage';

function App() {
return (
Expand All @@ -39,12 +42,10 @@ function App() {
<CssBaseline>
<AlertPopup />
<Routes>
<Route path="/new-donation" element={<NewDonationPage />} />
{/* Routes accessed only if user is not authenticated */}
<Route element={<UnauthenticatedRoutesWrapper />}>
<Route path="/login" element={<LoginPage />} />
<Route path="/register" element={<RegisterPage />} />
<Route path="/reports" element={<ReportsPage />} />
<Route
path="/verify-account/:token"
element={<VerifyAccountPage />}
Expand All @@ -58,38 +59,59 @@ function App() {
element={<ResetPasswordPage />}
/>
</Route>
<Route
path="/invite/:token"
element={<InviteRegisterPage />}
/>
<Route
path="/donor-profile/:donatorId"
element={<DonorProfilePage />}
/>
<Route path="/home" element={<HomeDashboardPage />} />
{/* Routes accessed only if user is authenticated */}
<Route element={<ProtectedRoutesWrapper />}>
<Route path="/home" element={<HomePage />} />
</Route>
<Route path="/donationInfo" element={<DonationInfoPage />} />
<Route element={<AdminRoutesWrapper />}>
<Route path="/users" element={<AdminDashboardPage />} />
</Route>
{/* <Route element={<ReportsPage />}>
<Route path="/reports" element={<ReportsPage />} />
</Route> */}
</Routes>
<Sidebar
side={
<Routes>
<Route path="/test-sidebar" element={<Sidebar />} />
<Route
path="/new-donation"
element={<NewDonationPage />}
/>
<Route path="/popup" element={<PopupPage />} />
<Route
path="/invite/:token"
element={<InviteRegisterPage />}
/>
<Route
path="/donor-profile/:donatorId"
element={<DonorProfilePage />}
/>
<Route path="/home" element={<HomeDashboardPage />} />

{/* Route which redirects to a different page depending on if the user is an authenticated or not by utilizing the DynamicRedirect component */}
<Route
path="/"
element={
<DynamicRedirect unAuthPath="/login" authPath="/home" />
}
/>
{/* Routes accessed only if user is authenticated */}
<Route element={<ProtectedRoutesWrapper />}>
<Route path="/home" element={<HomePage />} />
<Route
path="/donationInfo"
element={<DonationInfoPage />}
/>
<Route path="/reports" element={<ReportsPage />} />
<Route
path="/communications"
element={<CommunicationsPage />}
/>
</Route>
<Route element={<AdminRoutesWrapper />}>
<Route path="/users" element={<AdminDashboardPage />} />
</Route>

{/* Route which is accessed if no other route is matched */}
<Route path="*" element={<NotFoundPage />} />
</Routes>
{/* Route which redirects to a different page depending on if the user is an authenticated or not by utilizing the DynamicRedirect component */}
<Route
path="/"
element={
<DynamicRedirect
unAuthPath="/login"
authPath="/home"
/>
}
/>

{/* Route which is accessed if no other route is matched */}
<Route path="*" element={<NotFoundPage />} />
</Routes>
}
/>
</CssBaseline>
</ThemeProvider>
</PersistGate>
Expand Down
Loading

0 comments on commit 3bcc7a4

Please sign in to comment.