-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(portfolio): Started with portfolio Linked up with the graph, needs refactoring * Rebased and updated * Updated inteface to add new transaction * Added new transaction form * Updated save and load transactions * update * Added Transactions and confirmation dialog * importing market values from alphavantage.com; Showing the aggregated transactions on the portfolio page * Added portfolio filters
- Loading branch information
Showing
43 changed files
with
1,404 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,5 @@ yarn-error.log* | |
|
||
.idea | ||
tmp | ||
|
||
/src/core/Portfolios/portfolios/*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import Button from '@material-ui/core/Button' | ||
import Dialog from '@material-ui/core/Dialog' | ||
import DialogTitle from '@material-ui/core/DialogTitle' | ||
import DialogContent from '@material-ui/core/DialogContent' | ||
import DialogActions from '@material-ui/core/DialogActions' | ||
import { confirmable } from 'react-confirm' | ||
|
||
const ConfirmDialog = ({ | ||
title, | ||
description, | ||
show, | ||
proceed, | ||
dismiss | ||
}) => ( | ||
<Dialog | ||
disableBackdropClick | ||
disableEscapeKeyDown | ||
maxWidth="xs" | ||
aria-labelledby="confirmation-dialog-title" | ||
open={show} | ||
> | ||
<DialogTitle id="confirmation-dialog-title">{title}</DialogTitle> | ||
<DialogContent>{description}</DialogContent> | ||
<DialogActions> | ||
<Button onClick={dismiss} color="primary"> | ||
Cancel | ||
</Button> | ||
<Button onClick={proceed} color="primary"> | ||
Ok | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
) | ||
|
||
ConfirmDialog.propTypes = { | ||
show: PropTypes.bool.isRequired, // from confirmable. indicates if the dialog is shown or not. | ||
proceed: PropTypes.func.isRequired, // from confirmable. call to close the dialog with promise resolved. | ||
dismiss: PropTypes.func.isRequired, // from confirmable. call to only close the dialog. | ||
title: PropTypes.string.isRequired, // the title of the dialog | ||
description: PropTypes.string.isRequired // the description of the dialog | ||
} | ||
export default confirmable(ConfirmDialog) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,26 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { connect } from 'react-redux' | ||
import { isSignInPending } from 'blockstack' | ||
import { handleBlockstackLogin } from '../../store/user/actions' | ||
|
||
const mapStateToProps = ({ user }) => { | ||
return { | ||
user | ||
} | ||
} | ||
|
||
const mapDispatchToProps = (dispatch) => { | ||
return { | ||
handlePendingSignIn: () => dispatch(handleBlockstackLogin()) | ||
} | ||
} | ||
|
||
export const HandleLoginComponent = ({ user, handlePendingSignIn }) => { | ||
if (user.isLoginPending) { | ||
handlePendingSignIn() | ||
return ( | ||
<div className="Login"> | ||
<h2>Logging In...</h2> | ||
</div> | ||
) | ||
export const HandleLoginComponent = ({ history, handlePendingSignIn }) => { | ||
if (isSignInPending()) { | ||
handlePendingSignIn().then(() => { | ||
history.push('/') | ||
}) | ||
} | ||
|
||
return null | ||
} | ||
|
||
HandleLoginComponent.propTypes = { | ||
user: PropTypes.object.isRequired, | ||
handlePendingSignIn: PropTypes.func.isRequired | ||
handlePendingSignIn: PropTypes.func.isRequired, | ||
history: PropTypes.object.isRequired | ||
} | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(HandleLoginComponent) | ||
export default connect(null, mapDispatchToProps)(HandleLoginComponent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { connect } from 'react-redux' | ||
import { withStyles } from '@material-ui/core/styles' | ||
import './rotating-icon.css' | ||
|
||
const styles = { | ||
root: { | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
'z-index': 1000, | ||
padding: '1.2rem', | ||
display: 'flex', | ||
position: 'fixed', | ||
'overflow-y': 'auto', | ||
'overflow-x': 'hidden', | ||
'align-items': 'center', | ||
'justify-content': 'center', | ||
background: 'rgba(36, 123, 160, 0.7)' | ||
}, | ||
label: { | ||
'margin-left': '20px', | ||
color: 'var(--color-white)', | ||
'font-weight': 'bold', | ||
'font-family': 'SW Garden Grove', | ||
'font-size': '24px' | ||
} | ||
} | ||
|
||
const mapStateToProps = ({ user }) => { | ||
return { isLoading: user.isLoading } | ||
} | ||
|
||
const LoadingOverlay = ({ classes, isLoading }) => { | ||
if (isLoading) { | ||
return ( | ||
<div className={classes.root}> | ||
<div className="rotating-icon" /> | ||
<div className={classes.label}>Loading ...</div> | ||
</div> | ||
) | ||
} | ||
return null | ||
} | ||
|
||
LoadingOverlay.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
isLoading: PropTypes.bool.isRequired | ||
} | ||
|
||
|
||
export default connect(mapStateToProps)(withStyles(styles)(LoadingOverlay)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* --- Loader --- */ | ||
.rotating-icon { | ||
display: inline-block; | ||
width: 25px; | ||
height: 25px; | ||
} | ||
.rotating-icon:after { | ||
content: " "; | ||
display: block; | ||
width: 25px; | ||
height: 25px; | ||
margin: 1px; | ||
border-radius: 50%; | ||
border: 3px solid var(--color-white); | ||
border-color: var(--color-white) transparent var(--color-white) transparent; | ||
animation: rotating-icon 1.2s linear infinite; | ||
} | ||
@keyframes rotating-icon { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react' | ||
import Button from '@material-ui/core/Button' | ||
import { Route, NavLink } from 'react-router-dom' | ||
|
||
const TopNav = () => ( | ||
<div> | ||
<Route | ||
path="/transactions" | ||
render={(() => ( | ||
<div> | ||
<Button size="small" color="inherit" component={NavLink} to="/portfolio"> | ||
Portfolio | ||
</Button> | ||
</div> | ||
))} | ||
/> | ||
<Route | ||
path="/portfolio" | ||
render={(() => ( | ||
<Button size="small" color="inherit" component={NavLink} to="/transactions"> | ||
Transactions | ||
</Button> | ||
))} | ||
/> | ||
<Route | ||
path="/data-sources" | ||
render={(() => ( | ||
<Button size="small" color="inherit" component={NavLink} to="/transactions"> | ||
Transactions | ||
</Button> | ||
))} | ||
/> | ||
</div> | ||
) | ||
|
||
export default TopNav |
Oops, something went wrong.