Skip to content

Commit b5cd843

Browse files
Victor WeiVictor Wei
authored andcommitted
removed bloatware
1 parent d5879cb commit b5cd843

File tree

8 files changed

+66
-231
lines changed

8 files changed

+66
-231
lines changed

frontend/src/App.tsx

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@ import { ChakraProvider } from "@chakra-ui/react";
22
import "bootstrap/dist/css/bootstrap.min.css";
33
import React, { useReducer, useState } from "react";
44
import { Route, BrowserRouter as Router, Switch } from "react-router-dom";
5-
import Login from "./components/auth/Login";
65
import PrivateRoute from "./components/auth/PrivateRoute";
76
import Signup from "./components/auth/Signup";
87
import Layout from "./components/common/Layout";
9-
import CreatePage from "./components/pages/CreatePage";
10-
import DisplayPage from "./components/pages/DisplayPage";
11-
import EditTeamInfoPage from "./components/pages/EditTeamPage";
12-
import HooksDemo from "./components/pages/HooksDemo";
138
import NotFound from "./components/pages/NotFound";
14-
import SimpleEntityCreatePage from "./components/pages/SimpleEntityCreatePage";
15-
import SimpleEntityDisplayPage from "./components/pages/SimpleEntityDisplayPage";
16-
import SimpleEntityUpdatePage from "./components/pages/SimpleEntityUpdatePage";
17-
import UpdatePage from "./components/pages/UpdatePage";
189
import CheckoutSuccessPage from "./components/temp_navbar/CheckoutSuccessPage";
1910
import AUTHENTICATED_USER_KEY from "./constants/AuthConstants";
2011
import * as Routes from "./constants/Routes";
@@ -27,9 +18,8 @@ import sampleContextReducer from "./reducers/SampleContextReducer";
2718
import { AuthenticatedUser } from "./types/AuthTypes";
2819
import { getLocalStorageObj } from "./utils/LocalStorageUtils";
2920
// import Donate from "./components/temp_navbar/Donate"; // Temp for Navbar
21+
import HomePage from "./components/auth/HomePage";
3022
import DonationForm from "./components/common/DonationForm";
31-
import PersonalDetails from "./components/pages/PersonalDetails";
32-
import HomePage from "./components/common/HomePage";
3323

3424
const App = (): React.ReactElement => {
3525
const currentUser: AuthenticatedUser = getLocalStorageObj<AuthenticatedUser>(
@@ -66,52 +56,6 @@ const App = (): React.ReactElement => {
6656
path={Routes.CHECKOUT_SUCCESS}
6757
component={CheckoutSuccessPage}
6858
/>
69-
{/* Temp for Navbar */}
70-
<PrivateRoute
71-
exact
72-
path={Routes.HOME_PAGE}
73-
component={Layout}
74-
/>
75-
<PrivateRoute
76-
exact
77-
path={Routes.CREATE_ENTITY_PAGE}
78-
component={CreatePage}
79-
/>
80-
<PrivateRoute
81-
exact
82-
path={Routes.UPDATE_ENTITY_PAGE}
83-
component={UpdatePage}
84-
/>
85-
<PrivateRoute
86-
exact
87-
path={Routes.DISPLAY_ENTITY_PAGE}
88-
component={DisplayPage}
89-
/>
90-
<PrivateRoute
91-
exact
92-
path={Routes.CREATE_SIMPLE_ENTITY_PAGE}
93-
component={SimpleEntityCreatePage}
94-
/>
95-
<PrivateRoute
96-
exact
97-
path={Routes.UPDATE_SIMPLE_ENTITY_PAGE}
98-
component={SimpleEntityUpdatePage}
99-
/>
100-
<PrivateRoute
101-
exact
102-
path={Routes.DISPLAY_SIMPLE_ENTITY_PAGE}
103-
component={SimpleEntityDisplayPage}
104-
/>
105-
<PrivateRoute
106-
exact
107-
path={Routes.EDIT_TEAM_PAGE}
108-
component={EditTeamInfoPage}
109-
/>
110-
<PrivateRoute
111-
exact
112-
path={Routes.HOOKS_PAGE}
113-
component={HooksDemo}
114-
/>
11559
<PrivateRoute path={Routes.HOME_PAGE} component={Layout} />
11660
<Route exact path="*" component={NotFound} />
11761
</Switch>

frontend/src/components/common/HomePage.tsx renamed to frontend/src/components/auth/HomePage.tsx

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,61 @@ const HomePage = (): React.ReactElement => {
115115
Efficace.
116116
</Text>
117117
</Box>
118-
<GoogleLogin
119-
clientId={process.env.REACT_APP_OAUTH_CLIENT_ID || ""}
120-
buttonText="Login with Google"
121-
onSuccess={(response: GoogleResponse): void => {
122-
if ("tokenId" in response) {
123-
onGoogleLoginSuccess(response.tokenId);
124-
} else {
118+
119+
<form>
120+
<div>
121+
<input
122+
type="email"
123+
value={email}
124+
onChange={(event) => setEmail(event.target.value)}
125+
placeholder="username@domain.com"
126+
/>
127+
</div>
128+
<div>
129+
<input
130+
type="password"
131+
value={password}
132+
onChange={(event) => setPassword(event.target.value)}
133+
placeholder="password"
134+
/>
135+
</div>
136+
<div>
137+
<button
138+
className="btn btn-primary"
139+
type="button"
140+
onClick={onLogInClick}
141+
>
142+
Log In
143+
</button>
144+
</div>
145+
146+
<GoogleLogin
147+
clientId={process.env.REACT_APP_OAUTH_CLIENT_ID || ""}
148+
buttonText="Login with Google"
149+
onSuccess={(response: GoogleResponse): void => {
150+
if ("tokenId" in response) {
151+
onGoogleLoginSuccess(response.tokenId);
152+
} else {
153+
// eslint-disable-next-line no-alert
154+
window.alert(response);
155+
}
156+
}}
157+
onFailure={(error: GoogleErrorResponse) =>
125158
// eslint-disable-next-line no-alert
126-
window.alert(response);
159+
window.alert(JSON.stringify(error))
127160
}
128-
}}
129-
onFailure={(error: GoogleErrorResponse) =>
130-
// eslint-disable-next-line no-alert
131-
window.alert(JSON.stringify(error))
132-
}
133-
/>
161+
/>
162+
</form>
163+
164+
<div>
165+
<button
166+
className="btn btn-primary"
167+
type="button"
168+
onClick={onSignUpClick}
169+
>
170+
Sign Up
171+
</button>
172+
</div>
134173
</Box>
135174
</Flex>
136175
);

frontend/src/components/auth/Login.tsx

Lines changed: 0 additions & 107 deletions
This file was deleted.

frontend/src/components/common/Layout.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
// Template for Navbar - To-Do (Reroute this to the Dashboard component)
2-
// Ensure that whatever link paths to dashboard links to layout/dashboard
3-
// For testing (to view the navbar), navigate to localhost:3000/layout
4-
5-
import React from "react";
1+
import React, { useEffect } from "react";
62
import { Box } from "@chakra-ui/react";
7-
import { Route, Switch } from "react-router-dom";
3+
import { Route, Switch, useHistory } from "react-router-dom";
84
import Navbar from "./NavBar";
95
import DonationDashboard from "../pages/DonationDashboard";
106
import AccountManagement from "../temp_navbar/AccountManagement";
117
// import DonationHistory from "../temp_navbar/DonationHistory";
128
import DonationHistory from "../pages/DonationHistory";
139
import * as Routes from "../../constants/Routes";
1410

15-
const Layout = () => {
11+
const Layout: React.FC = () => {
12+
const history = useHistory();
13+
14+
useEffect(() => {
15+
history.push(Routes.DASHBOARD_PAGE);
16+
}, []);
17+
1618
return (
1719
<Box>
1820
<Navbar />

frontend/src/components/pages/CreatePage.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

frontend/src/components/pages/DisplayPage.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

frontend/src/components/pages/DonationDashboard.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import React from "react";
22
import ValueDonatedPerCause from "../common/ValueDonatedPerCause";
3+
import Logout from "../auth/Logout";
34

45
const DonationDashboard: React.FC = () => {
56
return (
67
<div>
78
{/* Temporary place to put ValueDonatedPerCause component, below the dashboard */}
89
<ValueDonatedPerCause />
10+
11+
<Logout />
912
</div>
1013
);
1114
};

frontend/src/constants/Routes.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,3 @@ export const DONATE = "/donate"; // TEMP FOR NAVBAR
1515
export const CHECKOUT_SUCCESS = "/checkout-success";
1616

1717
export const SIGNUP_PAGE = "/signup";
18-
19-
export const EDIT_TEAM_PAGE = "/edit-team";
20-
21-
export const DISPLAY_ENTITY_PAGE = "/entity";
22-
23-
export const CREATE_ENTITY_PAGE = "/entity/create";
24-
25-
export const UPDATE_ENTITY_PAGE = "/entity/update";
26-
27-
export const DISPLAY_SIMPLE_ENTITY_PAGE = "/simpleEntity";
28-
29-
export const CREATE_SIMPLE_ENTITY_PAGE = "/simpleEntity/create";
30-
31-
export const UPDATE_SIMPLE_ENTITY_PAGE = "/simpleEntity/update";
32-
33-
export const HOOKS_PAGE = "/hooks";

0 commit comments

Comments
 (0)