From 6ec1e090335b3d3c57334747873f5467bba89105 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Mon, 10 Dec 2018 10:22:52 -0500 Subject: [PATCH] better display commit time on pledges --- app/components/PledgesTable.jsx | 16 ++++++++++------ app/dapp.js | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/components/PledgesTable.jsx b/app/components/PledgesTable.jsx index 771129a..c0a143a 100644 --- a/app/components/PledgesTable.jsx +++ b/app/components/PledgesTable.jsx @@ -12,14 +12,18 @@ const pledgeStateMap = { 1: 'Paying', 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 - const date = new Date(commitTime * 1000) + const time = Number(commitTime) + Number(profile.commitTime) + const date = new Date(time * 1000) return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` } -const formatField = field => ({ +const formatField = (field, fundProfiles) => ({ ...field, - commitTime: convertToDatetime(field.commitTime), + commitTime: convertToDatetime(field, fundProfiles), amount: toEther(field.amount), token: getTokenLabel(field.token), intendedProject: projectText(field.intendedProject), @@ -41,7 +45,7 @@ class PledgesTable extends PureComponent { clearRowData = () => this.setState({ rowData: null }) render() { - const { data, transferPledgeAmounts } = this.props + const { data, transferPledgeAmounts, fundProfiles } = this.props const { row, rowData } = this.state return ( @@ -61,7 +65,7 @@ class PledgesTable extends PureComponent { { title: 'Intended Project', field: 'intendedProject' }, { title: 'Pledge State', field: 'pledgeState' }, ]} - data={data.map(formatField)} + data={data.map((f) => formatField(f, fundProfiles))} title="Pledges" actions={[ { diff --git a/app/dapp.js b/app/dapp.js index ad53626..1f7c1f4 100644 --- a/app/dapp.js +++ b/app/dapp.js @@ -81,7 +81,7 @@ class App extends React.Component { return (
- {!!allPledges.length && } + {!!allPledges.length && } {!!fundProfiles.length && }