import React from 'react' import PropTypes from 'prop-types' import { withStyles } from '@material-ui/core/styles' import Card from '@material-ui/core/Card' import CardContent from '@material-ui/core/CardContent' import Typography from '@material-ui/core/Typography' import LinearProgress from '@material-ui/core/LinearProgress' import { FundingContext } from '../../context' import { getDepositWithdrawTotals, getPledgesWaitingCommit } from '../../selectors/pledging' import { getTokenAddress } from '../../utils/currencies' const styles = { card: { minWidth: 275, }, cardTitle: { paddingBottom: '1rem' }, fundingSummaries: { display: 'flex', flexDirection: 'column', alignItems: 'center' }, bullet: { display: 'inline-block', margin: '0 2px', transform: 'scale(0.8)', }, title: { fontSize: 14, }, pos: { marginBottom: 12, }, linearColorPrimary: { backgroundColor: '#b2dfdb', }, linearBarColorPrimary: { backgroundColor: '#00695c', }, titleText: { textAlign: 'center', paddingTop: '2rem' } } const getNet = (deposits, withdraws) => Number(deposits) - Number(withdraws) const getValue = (deposits, withdraws) => (getNet(deposits, withdraws) / Number(deposits)) * 100 function SimpleCard(props) { const { classes, title } = props return ( {({ allPledges, allLpEvents, vaultEvents }) => {title} {!!allLpEvents && Object.entries(getDepositWithdrawTotals({ allLpEvents, allPledges, vaultEvents })) .map(token => { const [name, amounts] = token const { deposits, withdraws } = amounts const address = getTokenAddress(name) const pledgesForCommit = getPledgesWaitingCommit({ allPledges }).filter(p => p.token == address) return ( {name} {Number(deposits) - Number(withdraws || 0)} Remaining In Pledges {deposits} Funded {withdraws || 0} Withdrawn {pledgesForCommit.length} Pledges that can be vetoed / approved ) })} } ) } SimpleCard.propTypes = { classes: PropTypes.object.isRequired, title: PropTypes.string } export default withStyles(styles)(SimpleCard)