Skip to content

Commit

Permalink
Merge pull request #101 from ctc-uci/main
Browse files Browse the repository at this point in the history
merge main to dev-deployment
  • Loading branch information
Madhu2244 authored May 6, 2024
2 parents 3b0cc9a + 76b6f31 commit 7cb6283
Show file tree
Hide file tree
Showing 99 changed files with 28,675 additions and 1,421 deletions.
15,552 changes: 15,552 additions & 0 deletions .pnp.cjs

Large diffs are not rendered by default.

2,053 changes: 2,053 additions & 0 deletions .pnp.loader.mjs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/fph-logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
<link href="https://fonts.googleapis.com/css?family=Inter" rel="stylesheet" />
<title>Feeding Pets of the Homeless</title>
</head>
<body>
<div id="root"></div>
Expand Down
1,527 changes: 1,463 additions & 64 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"lint-staged": "^14.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-html-email": "^3.0.0",
"react-icons": "^5.0.1",
"yarn": "^1.22.21"
},
"lint-staged": {
Expand Down Expand Up @@ -65,6 +68,7 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"firebase": "^9.23.0",
"framer-motion": "^10.18.0",
"husky": "^8.0.3",
"prettier": "^3.0.3",
Expand Down
Binary file added public/congratulations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/fph-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

160 changes: 128 additions & 32 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route, Routes } from 'react-router-dom';
import { Route, Routes, useLocation } from 'react-router-dom';
import { BackendProvider } from './contexts/BackendContext';
import Sidebar from './components/Sidebar/Sidebar.jsx';
import BusinessDashboard from './components/BusinessDashboard/BusinessDashboard';
Expand All @@ -7,46 +7,142 @@ import BusinessNotificationCenter from './components/BusinessNotificationCenter/
import AdminDashboard from './components/AdminDashboard/AdminDashboard';
import EditContactInformation from './components/EditContactInformation';
import BusinessDonationHistory from './components/BusinessDonationHistory/BusinessDonationHistory.jsx';
import ViewDonationHistory from './components/BusinessDonationHistory/ViewDonationHistory/ViewDonationHistory.jsx';
import ContactUs from './components/ContactUsForm/ContactUs';
import DonationTrackingTable from './components/DonationTrackingTable/DonationTrackingTable.jsx';
import styles from './App.module.css';
import DonationItemsTable from './components/DonationItemsTable/DonationItemsTable.jsx';
import BusinessSetupPageMaster from './components/SetUp/BusinessSetupPageMaster.jsx';
import Login from './components/Authentication/Login.jsx';
import BusinessFormMaster from './components/OnBoarding/BusinessFormMaster.jsx';
import ForgotPassword from './components/Authentication/ForgotPassword.jsx';
import { AuthProvider } from './contexts/AuthContext';
import ProtectedRoute from './utils/ProtectedRoute.jsx';
import ViewBusiness from './components/ViewBusiness/ViewBusiness.jsx';
import { AddBusinessForm, BusinessForm } from './components/BusinessForm/BusinessForm.jsx';
import Congrats from './components/DonationForm/Congrats.jsx';
import ViewRequest from './components/ViewRequest/ViewRequest.jsx';
import AdminSettingsMaster from './components/AdminSettings/AdminSettingsMaster.jsx';
import ViewDonation from './components/ViewDonation/ViewDonation.jsx';

const App = () => {
const location = useLocation();
const currentRoute = location.pathname.toLowerCase();
return (
<BackendProvider>
<div className={styles.appLayout}>
<Sidebar isAdmin={true} />
<div className={styles.mainContent}>
<Routes>
<Route exact path="/" element={<div>Welcome to the App</div>} />
<Route exact path="/ContactUs" element={<ContactUs />} />
<Route exact path="/AdminDashboard" element={<AdminDashboard />} />
<Route exact path="/AdminManageForms" />
<Route exact path="/AdminTeamManagement" />
<Route exact path="/EditContactInformation" element={<EditContactInformation />} />
<Route exact path="/BusinessDashboard" element={<BusinessDashboard />} />
<Route exact path="/BusinessDonationTrackingForm" element={<DonationForm />} />
<Route
exact
path="/BusinessDonationHistory"
element={<BusinessDonationHistory />}
></Route>
<Route
exact
path="/BusinessNotificationCenter"
element={<BusinessNotificationCenter />}
></Route>
<Route
exact
path="/EditContactInformation"
element={<EditContactInformation />}
></Route>
<Route exact path="/DonationItemsTable" element={<DonationItemsTable />} />
<Route exact path="/DonationTrackingTable" element={<DonationTrackingTable />} />
</Routes>
<AuthProvider>
<div className={styles.appLayout}>
{currentRoute == '/onboarding' ||
currentRoute == '/signupadmin' ||
currentRoute == '/signupbusiness' ||
currentRoute == '/login' ||
currentRoute == '/forgotpassword' ||
currentRoute == '/businessform' || <Sidebar isAdmin={false} />}
<div className={styles.mainContent}>
<Routes>
<Route
exact
path="/Onboarding"
element={<BusinessFormMaster />}
/>
<Route
exact
path="/SignupAdmin"
element={<BusinessSetupPageMaster isAdmin={true} />}
/>
<Route
exact
path="/SignupBusiness"
element={<BusinessSetupPageMaster isAdmin={false} />}
/>
<Route exact path="/Login" element={<Login isAdmin={true} />} />
<Route exact path="/ForgotPassword" element={<ForgotPassword />} />
<Route exact path="/ContactUs" element={<ProtectedRoute Component={ContactUs} />} />
<Route exact path="/Congrats" element={<ProtectedRoute Component={Congrats} />} />
<Route
exact
path="/AdminDashboard"
element={<ProtectedRoute Component={AdminDashboard} />}
/>
<Route
exact
path="/AdminSettings"
element={<ProtectedRoute Component={AdminSettingsMaster} />}
/>
<Route
exact
path="/EditContactInformation"
element={<ProtectedRoute Component={EditContactInformation} />}
/>
<Route
exact
path="/BusinessDashboard"
element={<ProtectedRoute Component={BusinessDashboard} />}
/>
<Route
exact
path="/BusinessDonationTrackingForm"
element={<ProtectedRoute Component={DonationForm} />}
/>
<Route
exact
path="/BusinessDonationHistory"
element={<ProtectedRoute Component={BusinessDonationHistory} />}
></Route>
<Route
exact
path="/BusinessNotificationCenter"
element={<ProtectedRoute Component={BusinessNotificationCenter} />}
></Route>
<Route
exact
path="/EditContactInformation"
element={<ProtectedRoute Component={EditContactInformation} />}
></Route>
<Route
exact
path="/DonationItemsTable"
element={<ProtectedRoute Component={DonationItemsTable} />}
/>
<Route
exact
path="/DonationTrackingTable"
element={<ProtectedRoute Component={DonationTrackingTable} />}
/>
<Route
exact
path="/ViewBusiness/:id"
element={<ProtectedRoute Component={ViewBusiness} />}
/>
<Route
exact
path="/EditBusiness/:id"
element={<ProtectedRoute Component={BusinessForm} />}
/>
<Route
exact
path="/ViewRequest/:id"
element={<ProtectedRoute Component={ViewRequest} />}
/>
<Route
exact
path="/ViewDonation/:id"
element={<ProtectedRoute Component={ViewDonation} />}
/>
<Route
exact
path="/BusinessDonationHistory/:id"
element={<ProtectedRoute Component={ViewDonationHistory} />}
/>
<Route
exact
path="/AddBusiness"
element={<ProtectedRoute Component={AddBusinessForm} />}
/>
</Routes>
</div>
</div>
</div>
</AuthProvider>
</BackendProvider>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/App.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
.mainContent {
flex: 1; /* Takes up the remaining space */
overflow: auto; /* Adds scroll to the main content if needed */
background-color: var(--fph-gray-50, #f9f8f7);
}
Binary file added src/assets/FemalePettingDog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/MalePettingDog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 20 additions & 4 deletions src/components/AdminAllBusinesses/AdminAllBusinesses.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import BusinessTable from '../BusinessTable/BusinessTable';
import PendingBusinessTable from '../PendingBusinessTable/PendingBusinessTable';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useAuth } from '../../contexts/AuthContext.jsx';
import { Button, Text } from '@chakra-ui/react';
import { Link } from 'react-router-dom';
import BusinessForm from '../BusinessForm/BusinessForm';
Expand All @@ -9,6 +10,21 @@ const AdminAllBusinesses = () => {
const [pendingFlag, setPendingFlag] = useState(false);
const [formFlag, setFormFlag] = useState(false);
const [formItem, setFormItem] = useState({});
const [isAdminUser, setIsAdminUser] = useState(false);

const { isAdmin } = useAuth();
const navigate = useNavigate();

useEffect(() => {
const checkIsAdmin = async () => {
if (!(await isAdmin())) {
navigate('/BusinessDashboard');
} else {
setIsAdminUser(true);
}
};
checkIsAdmin();
}, []);

const handleClickPending = () => {
setPendingFlag(true);
Expand Down Expand Up @@ -46,7 +62,7 @@ const AdminAllBusinesses = () => {
<Button colorScheme="teal" variant="outline" onClick={handleClickPending}>
Pending Applications
</Button>
<BusinessTable />
{/* <BusinessTable /> */}
</>
)}

Expand All @@ -64,7 +80,7 @@ const AdminAllBusinesses = () => {
</div>
);

return contents;
return isAdminUser ? contents : <></>;
};

export default AdminAllBusinesses;
Loading

0 comments on commit 7cb6283

Please sign in to comment.