From df60ea1683557116c2e4ea39fc8b4914643f806b Mon Sep 17 00:00:00 2001 From: Vadim Arasev Date: Thu, 20 Sep 2018 11:39:04 +0300 Subject: [PATCH] (Refactor) A few enhancements of code --- src/components/BallotEmissionFundsCard.jsx | 2 +- .../BallotEmissionFundsMetadata.jsx | 2 +- src/components/NewBallot.jsx | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/BallotEmissionFundsCard.jsx b/src/components/BallotEmissionFundsCard.jsx index d1f41de..c6862d6 100644 --- a/src/components/BallotEmissionFundsCard.jsx +++ b/src/components/BallotEmissionFundsCard.jsx @@ -6,7 +6,7 @@ import { BallotCard } from './BallotCard.jsx' @observer export class BallotEmissionFundsCard extends React.Component { render() { - let { id, votingState, pos, contractsStore } = this.props + const { id, votingState, pos, contractsStore } = this.props const amount = contractsStore.web3Instance.fromWei(votingState.amount, 'ether') return ( diff --git a/src/components/BallotEmissionFundsMetadata.jsx b/src/components/BallotEmissionFundsMetadata.jsx index 8e81065..95e9360 100644 --- a/src/components/BallotEmissionFundsMetadata.jsx +++ b/src/components/BallotEmissionFundsMetadata.jsx @@ -93,7 +93,7 @@ export class BallotEmissionFundsMetadata extends React.Component { onChange={e => ballotStore.changeBallotMetadata(e, 'receiver', 'ballotEmissionFunds')} />

- The address to which the funds will be sent if `Send` operation obtains the majority of votes. + The address which the funds will be sent to, in case of the majority of votes.

diff --git a/src/components/NewBallot.jsx b/src/components/NewBallot.jsx index e4069f6..45fffdd 100644 --- a/src/components/NewBallot.jsx +++ b/src/components/NewBallot.jsx @@ -53,7 +53,7 @@ export class NewBallot extends React.Component { .add(minBallotDurationInHours, 'hours') .format() let neededMinutes = moment(minEndTime).diff(moment(ballotStore.endTime), 'minutes') - let neededHours = Math.floor(neededMinutes / 60) + const neededHours = Math.floor(neededMinutes / 60) let duration = moment.unix(ballotStore.endTimeUnix).diff(moment.unix(startTime), 'hours') if (duration < 0) { @@ -75,7 +75,7 @@ export class NewBallot extends React.Component { .utc() .add(14, 'days') .format() - let exceededMinutes = moment(ballotStore.endTime).diff(moment(twoWeeks), 'minutes') + const exceededMinutes = moment(ballotStore.endTime).diff(moment(twoWeeks), 'minutes') if (exceededMinutes > 0) { swal('Warning!', messages.SHOULD_BE_LESS_OR_EQUAL_14_DAYS(duration), 'warning') commonStore.hideLoading() @@ -177,8 +177,8 @@ export class NewBallot extends React.Component { createBallotForKeys = (startTime, endTime) => { const { ballotStore, contractsStore } = this.props const inputToMethod = { - startTime: startTime, - endTime: endTime, + startTime, + endTime, affectedKey: ballotStore.ballotKeys.affectedKey, affectedKeyType: ballotStore.ballotKeys.keyType, newVotingKey: ballotStore.ballotKeys.newVotingKey, @@ -203,8 +203,8 @@ export class NewBallot extends React.Component { createBallotForMinThreshold = (startTime, endTime) => { const { ballotStore, contractsStore } = this.props const inputToMethod = { - startTime: startTime, - endTime: endTime, + startTime, + endTime, proposedValue: ballotStore.ballotMinThreshold.proposedValue, memo: ballotStore.memo } @@ -214,8 +214,8 @@ export class NewBallot extends React.Component { createBallotForProxy = (startTime, endTime) => { const { ballotStore, contractsStore } = this.props const inputToMethod = { - startTime: startTime, - endTime: endTime, + startTime, + endTime, proposedValue: ballotStore.ballotProxy.proposedAddress, contractType: ballotStore.ballotProxy.contractType, memo: ballotStore.memo @@ -226,8 +226,8 @@ export class NewBallot extends React.Component { createBallotForEmissionFunds = (startTime, endTime) => { const { ballotStore, contractsStore } = this.props const inputToMethod = { - startTime: startTime, - endTime: endTime, + startTime, + endTime, receiver: ballotStore.ballotEmissionFunds.receiver, memo: ballotStore.memo }