better display commit time on pledges
This commit is contained in:
parent
1664255289
commit
6ec1e09033
|
@ -12,14 +12,18 @@ const pledgeStateMap = {
|
||||||
1: 'Paying',
|
1: 'Paying',
|
||||||
2: 'Paid'
|
2: 'Paid'
|
||||||
}
|
}
|
||||||
const convertToDatetime = commitTime => {
|
const convertToDatetime = (field, fundProfiles) => {
|
||||||
|
const { commitTime, id } = field
|
||||||
|
const profile = fundProfiles[id - 1]
|
||||||
|
//TODO fix - add commitTime from funder and delegates to get actual dateTime
|
||||||
if (Number(commitTime) === 0) return 0
|
if (Number(commitTime) === 0) return 0
|
||||||
const date = new Date(commitTime * 1000)
|
const time = Number(commitTime) + Number(profile.commitTime)
|
||||||
|
const date = new Date(time * 1000)
|
||||||
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`
|
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`
|
||||||
}
|
}
|
||||||
const formatField = field => ({
|
const formatField = (field, fundProfiles) => ({
|
||||||
...field,
|
...field,
|
||||||
commitTime: convertToDatetime(field.commitTime),
|
commitTime: convertToDatetime(field, fundProfiles),
|
||||||
amount: toEther(field.amount),
|
amount: toEther(field.amount),
|
||||||
token: getTokenLabel(field.token),
|
token: getTokenLabel(field.token),
|
||||||
intendedProject: projectText(field.intendedProject),
|
intendedProject: projectText(field.intendedProject),
|
||||||
|
@ -41,7 +45,7 @@ class PledgesTable extends PureComponent {
|
||||||
clearRowData = () => this.setState({ rowData: null })
|
clearRowData = () => this.setState({ rowData: null })
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { data, transferPledgeAmounts } = this.props
|
const { data, transferPledgeAmounts, fundProfiles } = this.props
|
||||||
const { row, rowData } = this.state
|
const { row, rowData } = this.state
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
@ -61,7 +65,7 @@ class PledgesTable extends PureComponent {
|
||||||
{ title: 'Intended Project', field: 'intendedProject' },
|
{ title: 'Intended Project', field: 'intendedProject' },
|
||||||
{ title: 'Pledge State', field: 'pledgeState' },
|
{ title: 'Pledge State', field: 'pledgeState' },
|
||||||
]}
|
]}
|
||||||
data={data.map(formatField)}
|
data={data.map((f) => formatField(f, fundProfiles))}
|
||||||
title="Pledges"
|
title="Pledges"
|
||||||
actions={[
|
actions={[
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,7 +81,7 @@ class App extends React.Component {
|
||||||
return (
|
return (
|
||||||
<FundingContext.Provider value={fundingContext}>
|
<FundingContext.Provider value={fundingContext}>
|
||||||
<div>
|
<div>
|
||||||
{!!allPledges.length && <PledgesTable data={allPledges} transferPledgeAmounts={transferPledgeAmounts} />}
|
{!!allPledges.length && <PledgesTable data={allPledges} transferPledgeAmounts={transferPledgeAmounts} fundProfiles={fundProfiles} />}
|
||||||
{!!fundProfiles.length && <FunderProfilesTable data={fundProfiles} cancelFundProfile={cancelFundProfile}/>}
|
{!!fundProfiles.length && <FunderProfilesTable data={fundProfiles} cancelFundProfile={cancelFundProfile}/>}
|
||||||
<AddFunder appendFundProfile={appendFundProfile} />
|
<AddFunder appendFundProfile={appendFundProfile} />
|
||||||
<Divider variant="middle" />
|
<Divider variant="middle" />
|
||||||
|
|
Loading…
Reference in New Issue