-
Notifications
You must be signed in to change notification settings - Fork 40
Project2 - MadeOfMoney #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9e9ddac
54c11a7
0cab07c
9b9543e
1bc73ae
4e4ac49
7ed6dc1
1b2dbb6
6587752
863bf66
b74de2e
a3d15e9
6c82a11
9cbfa5c
61d8e70
f9e12d8
e0e4e8f
cb7436a
c1f5652
cf69e4f
e931cd7
810e586
e0b45db
d809ad2
ea7b662
48afe2f
0eddc1c
6a98f68
1ad9936
c29ae09
76a7748
a03f21f
58cdcb9
ae4d502
37e1e87
b0639eb
24ce15b
d451d87
da4dadd
fdba735
1e50e5f
6d335d9
1a2f112
512ba7d
6071bc5
336056e
8e1fdff
6bd2cea
2df5225
2dfd5b0
39a04bb
ddaf1f0
90e4327
a1b9bee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
|
|
||
| # misc | ||
| .DS_Store | ||
| .env | ||
| .env.local | ||
| .env.development.local | ||
| .env.test.local | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,12 +8,47 @@ | |
| } | ||
|
|
||
| .App-header { | ||
| background-color: #282c34; | ||
| background-color: #1e2436; | ||
| min-height: 100vh; | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| justify-content: center; | ||
| font-size: calc(10px + 2vmin); | ||
| color: white; | ||
| color: rgb(232, 222, 222); | ||
| } | ||
| /* App.css */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redundant comment |
||
| .App { | ||
| transition: background-color 0.3s ease; | ||
| } | ||
|
|
||
| .App.dark { | ||
| background-color: #1e2436; /* Dark background color */ | ||
| color: #e8dede; /* Light text color */ | ||
| } | ||
|
|
||
| /* index.css */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment does not make sense to me somehow 🤔 |
||
| body { | ||
| margin: 0; | ||
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", | ||
| "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", | ||
| sans-serif; | ||
| -webkit-font-smoothing: antialiased; | ||
| -moz-osx-font-smoothing: grayscale; | ||
| transition: background-color 0.3s ease; | ||
| } | ||
|
|
||
| body.dark { | ||
| background-color: #1e2436; /* Dark background color */ | ||
| color: #e8dede; /* Light text color */ | ||
| } | ||
|
|
||
| /* Additional dark mode styles */ | ||
| /* App.css */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally, if you mean to make sections for different files in this css file, it might make sense to create css files for specific files instead of using a single css file for the whole app and creating sections |
||
|
|
||
| /* ... (previous styles) */ | ||
|
|
||
| .App.dark Table { | ||
| background-color: #1e2436; /* Dark background color for the table */ | ||
| color: #e8dede; /* Light text color for the table */ | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,23 @@ | ||
| import React from "react"; | ||
| import logo from "./logo.png"; | ||
| import React, { useState } from "react"; | ||
| import Navbar from "./components/Navbar"; | ||
| import "./App.css"; | ||
| import Dashboard from "./pages/Dashboard"; | ||
|
|
||
| class App extends React.Component { | ||
| render() { | ||
| return ( | ||
| <div className="App"> | ||
| <header className="App-header"> | ||
| <img src={logo} className="App-logo" alt="logo" /> | ||
| <p> | ||
| Edit <code>src/App.js</code> and save to reload. | ||
| </p> | ||
| </header> | ||
| </div> | ||
| ); | ||
| } | ||
| } | ||
| const App = () => { | ||
| const [darkMode, setDarkMode] = useState(false); | ||
|
|
||
| const toggleDarkMode = () => { | ||
| setDarkMode(!darkMode); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className={`App ${darkMode ? "dark" : ""}`}> | ||
| <Navbar toggleDarkMode={toggleDarkMode} darkMode={darkMode} /> | ||
| <header className="py-5 my-5"> | ||
| <Dashboard /> | ||
| </header> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default App; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import React from "react"; | ||
| // import { Link } from "react-router-dom"; | ||
| import Container from "react-bootstrap/Container"; | ||
| import Row from "react-bootstrap/Row"; | ||
| import Col from "react-bootstrap/Col"; | ||
|
|
||
| const Accountsummary = () => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File name and component name should use PascalCase. |
||
| const data = { amountInvested: 1000, cash: 500, portoflioValue: 50000 }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is hardcoded data, do we need to have a static variable for it? We could just insert those numbers into the spans below |
||
|
|
||
| return ( | ||
| <Container className="mt-4"> | ||
| <Row className="gx-1"> | ||
| <Col> | ||
| <div className="d-flex align-items-center p-3 bg-primary text-white"> | ||
| <span className="me-2 fw-bold">Amount Invested:</span> | ||
| <span>{data.amountInvested}</span> | ||
| </div> | ||
| </Col> | ||
| <Col> | ||
| <div className="d-flex align-items-center p-3 bg-success text-white"> | ||
| <span className="me-2 fw-bold">Cash:</span> | ||
| <span>{data.cash}</span> | ||
| </div> | ||
| </Col> | ||
| <Col> | ||
| <div className="d-flex align-items-center p-3 bg-danger text-white"> | ||
| <span className="me-2 fw-bold">Portfolio Value:</span> | ||
| <span>{data.portoflioValue}</span> | ||
| </div> | ||
| </Col> | ||
| </Row> | ||
| </Container> | ||
| ); | ||
| }; | ||
|
|
||
| export default Accountsummary; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| import React, { useState } from "react"; | ||
| import Button from "react-bootstrap/Button"; | ||
| import { | ||
| createUserWithEmailAndPassword, | ||
| signInWithEmailAndPassword, | ||
| updateProfile, | ||
| } from "firebase/auth"; | ||
| import { auth } from "../../firebase"; | ||
|
|
||
| const AuthForm = (props) => { | ||
| const [emailInputField, setEmailInputField] = useState(""); | ||
| const [passwordInputField, setPasswordInputField] = useState(""); | ||
| const [nameInputField, setNameInputField] = useState(""); | ||
|
Comment on lines
+11
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could manage these 3 states in a single object instead of three different state variables. This would make it easier to maintain the state |
||
| const [isNewUser, setIsNewUser] = useState(true); | ||
| const [errorCode, setErrorCode] = useState(""); | ||
| const [errorMessage, setErrorMessage] = useState(""); | ||
|
|
||
| const handleChange = (event, setter) => { | ||
| setter(event.target.value); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nicely done with the setter due to managing multiple states! |
||
| }; | ||
|
|
||
| const handleSubmit = (event) => { | ||
| event.preventDefault(); | ||
|
|
||
| const closeAuthForm = () => { | ||
| // Reset auth form state | ||
| setEmailInputField(""); | ||
| setPasswordInputField(""); | ||
| setNameInputField(""); | ||
| setIsNewUser(true); | ||
| setErrorCode(""); | ||
| setErrorMessage(""); | ||
| // Toggle auth form off after authentication | ||
| props.toggleAuthForm(); | ||
| }; | ||
|
|
||
| const setErrorState = (error) => { | ||
| setErrorCode(error.code); | ||
| setErrorMessage(error.message); | ||
| }; | ||
|
|
||
| // Authenticate user on submit | ||
| if (isNewUser) { | ||
| createUserWithEmailAndPassword(auth, emailInputField, passwordInputField) | ||
| .then(() => { | ||
| updateProfile(auth.currentUser, { | ||
| displayName: nameInputField, | ||
| }); | ||
| closeAuthForm(); | ||
| }) | ||
| .catch(setErrorState); | ||
| } else { | ||
| signInWithEmailAndPassword(auth, emailInputField, passwordInputField) | ||
| .then(closeAuthForm) | ||
| .catch(setErrorState); | ||
| } | ||
| }; | ||
|
|
||
| const toggleNewOrReturningAuth = () => { | ||
| setIsNewUser(!isNewUser); | ||
| }; | ||
|
|
||
| return ( | ||
| <div> | ||
| <p>{errorCode ? `Error code: ${errorCode}` : null}</p> | ||
| <p>{errorMessage ? `Error message: ${errorMessage}` : null}</p> | ||
| <p> | ||
| {isNewUser | ||
| ? "Enter your email and password to sign up." | ||
| : "Sign in with this form to post."} | ||
| </p> | ||
| <form onSubmit={handleSubmit}> | ||
| {isNewUser && ( | ||
| <label> | ||
| <span>Name: </span> | ||
| <input | ||
| type="text" | ||
| name="nameInputValue" | ||
| value={nameInputField} | ||
| onChange={(event) => handleChange(event, setNameInputField)} | ||
| /> | ||
| <span>(optional)</span> | ||
| </label> | ||
| )} | ||
| <br /> | ||
| <label> | ||
| <span>Email: </span> | ||
| <input | ||
| type="email" | ||
| name="emailInputValue" | ||
| value={emailInputField} | ||
| onChange={(event) => handleChange(event, setEmailInputField)} | ||
| /> | ||
| </label> | ||
| <br /> | ||
| <label> | ||
| <span>Password: </span> | ||
| <input | ||
| type="password" | ||
| name="passwordInputValue" | ||
| value={passwordInputField} | ||
| onChange={(event) => handleChange(event, setPasswordInputField)} | ||
| /> | ||
| </label> | ||
| <br /> | ||
| <input | ||
| type="submit" | ||
| value={isNewUser ? "Create Account" : "Sign In"} | ||
| // Disable form submission if email or password are empty | ||
| disabled={!emailInputField || !passwordInputField} | ||
| /> | ||
| <br /> | ||
| <Button variant="link" onClick={toggleNewOrReturningAuth}> | ||
| {isNewUser | ||
| ? "If you have an account, click here to login" | ||
| : "If you are a new user, click here to create account"} | ||
|
Comment on lines
+114
to
+116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not so sure if I agree with the |
||
| </Button> | ||
| </form> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default AuthForm; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // import { Link } from "react-router-dom"; | ||
| // import Container from "react-bootstrap/Container"; | ||
|
|
||
| const Educationalmaterial = () => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this even used? |
||
| return ( | ||
| <div> | ||
| <h4 className="fw-bold">Educational material</h4> | ||
| </div> | ||
| ); | ||
| }; | ||
|
Comment on lines
+4
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think 3 lines here do not necessarily warrant a component, or rather it is a bit overkill :) |
||
|
|
||
| export default Educationalmaterial; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import Table from "react-bootstrap/Table"; | ||
|
|
||
| const Grid=()=> { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For a grid I would rather use flexbox or grid in css instead of tables. But I am not too sure about the use-case, so it might still make sense if you need an actual table. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this component even used? Can't find it via search 🤔 |
||
| return ( | ||
| <div className="Table"> | ||
| <Table responsive> | ||
| <thead> | ||
| <tr> | ||
| <th>#</th> | ||
| {Array.from({ length: 5 }).map((_, index) => ( | ||
| <th key={index}>Table </th> | ||
| ))} | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr> | ||
| <td>1</td> | ||
| {Array.from({ length: 5 }).map((_, index) => ( | ||
| <td key={index}>Table {index}</td> | ||
| ))} | ||
| </tr> | ||
| <tr> | ||
| <td>2</td> | ||
| {Array.from({ length: 5 }).map((_, index) => ( | ||
| <td key={index}>Table {index}</td> | ||
| ))} | ||
| </tr> | ||
| <tr> | ||
| <td>3</td> | ||
| {Array.from({ length: 5 }).map((_, index) => ( | ||
| <td key={index}>Table {index}</td> | ||
| ))} | ||
| </tr> | ||
| </tbody> | ||
| </Table> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default Grid; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs more info on how to install and run the application. Also background info on the project and planning docs