Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9e9ddac
Install react-bootstrap and bootstrap through npm, include bootstrap …
patrickkok Dec 16, 2023
54c11a7
Merge pull request #1 from patrickkok/setup
patrickkok Dec 16, 2023
0cab07c
Install react-router, create History.js and /history route in router.…
patrickkok Dec 17, 2023
9b9543e
Merge pull request #2 from patrickkok/navbar
patrickkok Dec 17, 2023
1bc73ae
Create dummy data, create trade history line item, create History.css
patrickkok Dec 17, 2023
4e4ac49
Add margin: 0 to Navbar container
patrickkok Dec 23, 2023
7ed6dc1
Add filter and sort dropdown menu and functionality, update dummy dat…
patrickkok Dec 23, 2023
1b2dbb6
Add margin 0 to Navbar
patrickkok Dec 23, 2023
6587752
Merge pull request #3 from patrickkok/history
patrickkok Dec 23, 2023
863bf66
Add modal to input new trades, add placeholder for function to write …
patrickkok Dec 26, 2023
b74de2e
Instagram base
mtthw13 Dec 23, 2023
a3d15e9
Merge pull request #5 from patrickkok/database
patrickkok Jan 1, 2024
6c82a11
Merge 'main' into 'history-input' for database
patrickkok Jan 2, 2024
9cbfa5c
Merge pull request #6 from patrickkok/history-input
patrickkok Jan 3, 2024
61d8e70
Add ability for input form to write to database, Add ignore warning c…
patrickkok Jan 3, 2024
f9e12d8
Move Components used in History page to components/History
patrickkok Jan 3, 2024
e0e4e8f
Add database listener to update displayed trades, remove development …
patrickkok Jan 3, 2024
cb7436a
Add reset filter button, bugfix filter code, code cleanup
patrickkok Jan 3, 2024
c1f5652
update with dashboard backup
kendigm Jan 6, 2024
cf69e4f
Update .gitignore
kendigm Jan 6, 2024
e931cd7
Merge pull request #9 from patrickkok/newdashboard
patrickkok Jan 6, 2024
810e586
Bufgix trades sorting, remove dummy data, remove console.log statements
patrickkok Jan 6, 2024
e0b45db
Remove dummy data reference in History.js
patrickkok Jan 6, 2024
d809ad2
Merge pull request #10 from patrickkok/history-database
kendigm Jan 6, 2024
ea7b662
Add Settings page to Navbar, create Settings page. Tidy up Index.js i…
patrickkok Jan 7, 2024
48afe2f
API_features
kendigm Jan 9, 2024
0eddc1c
Add feature toggle for email in settings
patrickkok Jan 10, 2024
6a98f68
Add feature to change password, set profile image, delete account
patrickkok Jan 11, 2024
1ad9936
Merge pull request #12 from patrickkok/settings
kendigm Jan 13, 2024
c29ae09
Merge branch 'main' into API_feature
kendigm Jan 13, 2024
76a7748
Merge pull request #11 from patrickkok/API_feature
patrickkok Jan 13, 2024
a03f21f
Change History to Trades for clarity
patrickkok Jan 13, 2024
58cdcb9
Merge pull request #13 from patrickkok/history-edit
kendigm Jan 13, 2024
ae4d502
Add ability to delete trades, tidy up TradeLineItem props
patrickkok Jan 16, 2024
37e1e87
metrics
kendigm Jan 18, 2024
b0639eb
Merge branch 'API_feature' of https://github.com/patrickkok/project2-…
kendigm Jan 18, 2024
24ce15b
metrics file names
kendigm Jan 18, 2024
d451d87
removed jsx
kendigm Jan 19, 2024
da4dadd
modified src/index.js
kendigm Jan 19, 2024
fdba735
Add buy/sell information to trade, add del/edit functions
patrickkok Jan 21, 2024
1e50e5f
Merge pull request #14 from patrickkok/trades-edit
kendigm Jan 21, 2024
6d335d9
Designing API Integration
kendigm Jan 22, 2024
1a2f112
Merge branch 'API_feature' of https://github.com/patrickkok/project2-…
kendigm Jan 22, 2024
512ba7d
news API Integration
kendigm Jan 23, 2024
6071bc5
Merge branch 'main' into API_feature
kendigm Jan 23, 2024
336056e
Merge pull request #15 from patrickkok/API_feature
patrickkok Jan 23, 2024
8e1fdff
Convert class components to functional components for login, clean me…
patrickkok Jan 24, 2024
6bd2cea
Add redirect if not logged in, remove unused states
patrickkok Jan 24, 2024
2df5225
Remove unused component, change trade lines to match theme
patrickkok Jan 24, 2024
2dfd5b0
Merge pull request #16 from patrickkok/auth-cleanup
kendigm Jan 25, 2024
39a04bb
Update README
patrickkok Jan 25, 2024
ddaf1f0
Merge pull request #17 from patrickkok/readme-update
kendigm Jan 26, 2024
90e4327
Fix Trades not displaying in the center
patrickkok Jan 27, 2024
a1b9bee
Merge pull request #19 from patrickkok/trades-display
kendigm Jan 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Copy link
Copy Markdown

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

https://bc.rocketacademy.co/2-full-stack/2.p-full-stack-app-firebase

# Project Title: MadeOfeMoney

Visit our project here: https://madeofmoney.web.app/
If you wish to use this repository, do create your own .env files with your own firebase credentials.

## Available Scripts

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). In the project directory, you can run:
Expand Down
2,439 changes: 2,331 additions & 108 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"apexcharts": "^3.45.1",
"axios": "^1.6.5",
"bootstrap": "^5.3.2",
"bootstrap-icons": "^1.11.3",
"firebase": "^10.7.1",
"react": "^18.1.0",
"react-apexcharts": "^1.4.1",
"react-bootstrap": "^2.9.1",
"react-dom": "^18.1.0",
"react-scripts": "5.0.1"
"react-google-charts": "^4.0.1",
"react-responsive": "^9.0.2",
"react-router-dom": "^6.21.0",
"react-scripts": "5.0.1",
"react-toggle": "^4.1.3"
},
"scripts": {
"start": "react-scripts start",
Expand Down
Empty file modified public/favicon.ico
100755 → 100644
Empty file.
Empty file modified public/logo192.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/logo512.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 37 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 */
}
35 changes: 19 additions & 16 deletions src/App.js
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;
Binary file added src/assets/logo.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/triangle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/components/Accountsummary.js
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 = () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File name and component name should use PascalCase. AccountSummary

const data = { amountInvested: 1000, cash: 500, portoflioValue: 50000 };
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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;
123 changes: 123 additions & 0 deletions src/components/AuthPortal/AuthForm.js
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not so sure if I agree with the isNewUser variable name. Basically being a new user does not depend on being a user yet or not, but just on the button you click. Therefore another naming could be appropriate here.

</Button>
</form>
</div>
);
};

export default AuthForm;
12 changes: 12 additions & 0 deletions src/components/Educationalmaterial.js
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 = () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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;
40 changes: 40 additions & 0 deletions src/components/Grid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import Table from "react-bootstrap/Table";

const Grid=()=> {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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;
Loading