add num pledges and amount in select delegate profile
This commit is contained in:
parent
2dbc91e53b
commit
1fc2c209a5
|
@ -98,9 +98,10 @@ const SubmissionSection = ({ classes, profiles, delegatePledges, projectId, open
|
||||||
setStatus: _setStatus,
|
setStatus: _setStatus,
|
||||||
status: _status
|
status: _status
|
||||||
}) => {
|
}) => {
|
||||||
const filteredPledges = values.delegateProfile ? delegatePledges.filter(
|
const filterPledges = delegateProfile => delegatePledges.filter(
|
||||||
d => d.profile.id === values.delegateProfile.id && d.pledgeData.amount !== '0' && d.pledgeData.pledgeState === 0 && d.pledgeData.intendedProject === 0
|
d => d.profile.id === delegateProfile.id && d.pledgeData.amount !== '0' && d.pledgeData.pledgeState === 0 && d.pledgeData.intendedProject === 0
|
||||||
) : null
|
)
|
||||||
|
const filteredPledges = values.delegateProfile ? filterPledges(values.delegateProfile) : null
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit} className={classes.submissionRoot}>
|
<form onSubmit={handleSubmit} className={classes.submissionRoot}>
|
||||||
{profiles && profiles.length === 0 &&
|
{profiles && profiles.length === 0 &&
|
||||||
|
@ -122,11 +123,17 @@ const SubmissionSection = ({ classes, profiles, delegatePledges, projectId, open
|
||||||
disabled={!profiles || profiles.length === 0}
|
disabled={!profiles || profiles.length === 0}
|
||||||
value={values.delegateProfile || ''}
|
value={values.delegateProfile || ''}
|
||||||
>
|
>
|
||||||
{profiles && profiles.map((profile, index) => (
|
{profiles && profiles.map((profile, index) => {
|
||||||
<MenuItem style={{display: 'flex', alignItems: 'center'}} key={`profile-${index}`} value={profile}>
|
const filteredPledges = filterPledges(profile)
|
||||||
{profile.name}
|
const numPledges = filteredPledges.length
|
||||||
</MenuItem>
|
const amount = filteredPledges.reduce((cv,pv) => cv + Number(pv.pledgeData.amount) ,0)
|
||||||
))}
|
const token = numPledges ? filteredPledges[0].pledgeData.token : ''
|
||||||
|
return (
|
||||||
|
<MenuItem style={{display: 'flex', alignItems: 'center'}} key={`profile-${index}`} value={profile}>
|
||||||
|
{profile.name} - {numPledges} Pledges - {toEther(amount.toString())} {getTokenLabel(token)}
|
||||||
|
</MenuItem>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</TextField>
|
</TextField>
|
||||||
{filteredPledges && <TextField
|
{filteredPledges && <TextField
|
||||||
className={classes.textField}
|
className={classes.textField}
|
||||||
|
|
Loading…
Reference in New Issue