Skip to content

Commit

Permalink
removed bloatware
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Wei authored and Victor Wei committed Oct 22, 2024
1 parent d5879cb commit b5cd843
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 231 deletions.
58 changes: 1 addition & 57 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,10 @@ import { ChakraProvider } from "@chakra-ui/react";
import "bootstrap/dist/css/bootstrap.min.css";
import React, { useReducer, useState } from "react";
import { Route, BrowserRouter as Router, Switch } from "react-router-dom";
import Login from "./components/auth/Login";
import PrivateRoute from "./components/auth/PrivateRoute";
import Signup from "./components/auth/Signup";
import Layout from "./components/common/Layout";
import CreatePage from "./components/pages/CreatePage";
import DisplayPage from "./components/pages/DisplayPage";
import EditTeamInfoPage from "./components/pages/EditTeamPage";
import HooksDemo from "./components/pages/HooksDemo";
import NotFound from "./components/pages/NotFound";
import SimpleEntityCreatePage from "./components/pages/SimpleEntityCreatePage";
import SimpleEntityDisplayPage from "./components/pages/SimpleEntityDisplayPage";
import SimpleEntityUpdatePage from "./components/pages/SimpleEntityUpdatePage";
import UpdatePage from "./components/pages/UpdatePage";
import CheckoutSuccessPage from "./components/temp_navbar/CheckoutSuccessPage";
import AUTHENTICATED_USER_KEY from "./constants/AuthConstants";
import * as Routes from "./constants/Routes";
Expand All @@ -27,9 +18,8 @@ import sampleContextReducer from "./reducers/SampleContextReducer";
import { AuthenticatedUser } from "./types/AuthTypes";
import { getLocalStorageObj } from "./utils/LocalStorageUtils";
// import Donate from "./components/temp_navbar/Donate"; // Temp for Navbar
import HomePage from "./components/auth/HomePage";
import DonationForm from "./components/common/DonationForm";
import PersonalDetails from "./components/pages/PersonalDetails";
import HomePage from "./components/common/HomePage";

const App = (): React.ReactElement => {
const currentUser: AuthenticatedUser = getLocalStorageObj<AuthenticatedUser>(
Expand Down Expand Up @@ -66,52 +56,6 @@ const App = (): React.ReactElement => {
path={Routes.CHECKOUT_SUCCESS}
component={CheckoutSuccessPage}
/>
{/* Temp for Navbar */}
<PrivateRoute
exact
path={Routes.HOME_PAGE}
component={Layout}
/>
<PrivateRoute
exact
path={Routes.CREATE_ENTITY_PAGE}
component={CreatePage}
/>
<PrivateRoute
exact
path={Routes.UPDATE_ENTITY_PAGE}
component={UpdatePage}
/>
<PrivateRoute
exact
path={Routes.DISPLAY_ENTITY_PAGE}
component={DisplayPage}
/>
<PrivateRoute
exact
path={Routes.CREATE_SIMPLE_ENTITY_PAGE}
component={SimpleEntityCreatePage}
/>
<PrivateRoute
exact
path={Routes.UPDATE_SIMPLE_ENTITY_PAGE}
component={SimpleEntityUpdatePage}
/>
<PrivateRoute
exact
path={Routes.DISPLAY_SIMPLE_ENTITY_PAGE}
component={SimpleEntityDisplayPage}
/>
<PrivateRoute
exact
path={Routes.EDIT_TEAM_PAGE}
component={EditTeamInfoPage}
/>
<PrivateRoute
exact
path={Routes.HOOKS_PAGE}
component={HooksDemo}
/>
<PrivateRoute path={Routes.HOME_PAGE} component={Layout} />
<Route exact path="*" component={NotFound} />
</Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,61 @@ const HomePage = (): React.ReactElement => {
Efficace.
</Text>
</Box>
<GoogleLogin
clientId={process.env.REACT_APP_OAUTH_CLIENT_ID || ""}
buttonText="Login with Google"
onSuccess={(response: GoogleResponse): void => {
if ("tokenId" in response) {
onGoogleLoginSuccess(response.tokenId);
} else {

<form>
<div>
<input
type="email"
value={email}
onChange={(event) => setEmail(event.target.value)}
placeholder="[email protected]"
/>
</div>
<div>
<input
type="password"
value={password}
onChange={(event) => setPassword(event.target.value)}
placeholder="password"
/>
</div>
<div>
<button
className="btn btn-primary"
type="button"
onClick={onLogInClick}
>
Log In
</button>
</div>

<GoogleLogin
clientId={process.env.REACT_APP_OAUTH_CLIENT_ID || ""}
buttonText="Login with Google"
onSuccess={(response: GoogleResponse): void => {
if ("tokenId" in response) {
onGoogleLoginSuccess(response.tokenId);
} else {
// eslint-disable-next-line no-alert
window.alert(response);
}
}}
onFailure={(error: GoogleErrorResponse) =>
// eslint-disable-next-line no-alert
window.alert(response);
window.alert(JSON.stringify(error))
}
}}
onFailure={(error: GoogleErrorResponse) =>
// eslint-disable-next-line no-alert
window.alert(JSON.stringify(error))
}
/>
/>
</form>

<div>
<button
className="btn btn-primary"
type="button"
onClick={onSignUpClick}
>
Sign Up
</button>
</div>
</Box>
</Flex>
);
Expand Down
107 changes: 0 additions & 107 deletions frontend/src/components/auth/Login.tsx

This file was deleted.

16 changes: 9 additions & 7 deletions frontend/src/components/common/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
// Template for Navbar - To-Do (Reroute this to the Dashboard component)
// Ensure that whatever link paths to dashboard links to layout/dashboard
// For testing (to view the navbar), navigate to localhost:3000/layout

import React from "react";
import React, { useEffect } from "react";
import { Box } from "@chakra-ui/react";
import { Route, Switch } from "react-router-dom";
import { Route, Switch, useHistory } from "react-router-dom";
import Navbar from "./NavBar";
import DonationDashboard from "../pages/DonationDashboard";
import AccountManagement from "../temp_navbar/AccountManagement";
// import DonationHistory from "../temp_navbar/DonationHistory";
import DonationHistory from "../pages/DonationHistory";
import * as Routes from "../../constants/Routes";

const Layout = () => {
const Layout: React.FC = () => {
const history = useHistory();

useEffect(() => {
history.push(Routes.DASHBOARD_PAGE);
}, []);

return (
<Box>
<Navbar />
Expand Down
15 changes: 0 additions & 15 deletions frontend/src/components/pages/CreatePage.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions frontend/src/components/pages/DisplayPage.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions frontend/src/components/pages/DonationDashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React from "react";
import ValueDonatedPerCause from "../common/ValueDonatedPerCause";
import Logout from "../auth/Logout";

const DonationDashboard: React.FC = () => {
return (
<div>
{/* Temporary place to put ValueDonatedPerCause component, below the dashboard */}
<ValueDonatedPerCause />

<Logout />
</div>
);
};
Expand Down
16 changes: 0 additions & 16 deletions frontend/src/constants/Routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,3 @@ export const DONATE = "/donate"; // TEMP FOR NAVBAR
export const CHECKOUT_SUCCESS = "/checkout-success";

export const SIGNUP_PAGE = "/signup";

export const EDIT_TEAM_PAGE = "/edit-team";

export const DISPLAY_ENTITY_PAGE = "/entity";

export const CREATE_ENTITY_PAGE = "/entity/create";

export const UPDATE_ENTITY_PAGE = "/entity/update";

export const DISPLAY_SIMPLE_ENTITY_PAGE = "/simpleEntity";

export const CREATE_SIMPLE_ENTITY_PAGE = "/simpleEntity/create";

export const UPDATE_SIMPLE_ENTITY_PAGE = "/simpleEntity/update";

export const HOOKS_PAGE = "/hooks";

0 comments on commit b5cd843

Please sign in to comment.