(Refactor) A few enhancements of code
This commit is contained in:
parent
c8009db1fd
commit
df60ea1683
|
@ -6,7 +6,7 @@ import { BallotCard } from './BallotCard.jsx'
|
||||||
@observer
|
@observer
|
||||||
export class BallotEmissionFundsCard extends React.Component {
|
export class BallotEmissionFundsCard extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
let { id, votingState, pos, contractsStore } = this.props
|
const { id, votingState, pos, contractsStore } = this.props
|
||||||
const amount = contractsStore.web3Instance.fromWei(votingState.amount, 'ether')
|
const amount = contractsStore.web3Instance.fromWei(votingState.amount, 'ether')
|
||||||
return (
|
return (
|
||||||
<BallotCard votingType="votingToManageEmissionFunds" votingState={votingState} id={id} pos={pos}>
|
<BallotCard votingType="votingToManageEmissionFunds" votingState={votingState} id={id} pos={pos}>
|
||||||
|
|
|
@ -93,7 +93,7 @@ export class BallotEmissionFundsMetadata extends React.Component {
|
||||||
onChange={e => ballotStore.changeBallotMetadata(e, 'receiver', 'ballotEmissionFunds')}
|
onChange={e => ballotStore.changeBallotMetadata(e, 'receiver', 'ballotEmissionFunds')}
|
||||||
/>
|
/>
|
||||||
<p className="hint">
|
<p className="hint">
|
||||||
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.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -53,7 +53,7 @@ export class NewBallot extends React.Component {
|
||||||
.add(minBallotDurationInHours, 'hours')
|
.add(minBallotDurationInHours, 'hours')
|
||||||
.format()
|
.format()
|
||||||
let neededMinutes = moment(minEndTime).diff(moment(ballotStore.endTime), 'minutes')
|
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')
|
let duration = moment.unix(ballotStore.endTimeUnix).diff(moment.unix(startTime), 'hours')
|
||||||
|
|
||||||
if (duration < 0) {
|
if (duration < 0) {
|
||||||
|
@ -75,7 +75,7 @@ export class NewBallot extends React.Component {
|
||||||
.utc()
|
.utc()
|
||||||
.add(14, 'days')
|
.add(14, 'days')
|
||||||
.format()
|
.format()
|
||||||
let exceededMinutes = moment(ballotStore.endTime).diff(moment(twoWeeks), 'minutes')
|
const exceededMinutes = moment(ballotStore.endTime).diff(moment(twoWeeks), 'minutes')
|
||||||
if (exceededMinutes > 0) {
|
if (exceededMinutes > 0) {
|
||||||
swal('Warning!', messages.SHOULD_BE_LESS_OR_EQUAL_14_DAYS(duration), 'warning')
|
swal('Warning!', messages.SHOULD_BE_LESS_OR_EQUAL_14_DAYS(duration), 'warning')
|
||||||
commonStore.hideLoading()
|
commonStore.hideLoading()
|
||||||
|
@ -177,8 +177,8 @@ export class NewBallot extends React.Component {
|
||||||
createBallotForKeys = (startTime, endTime) => {
|
createBallotForKeys = (startTime, endTime) => {
|
||||||
const { ballotStore, contractsStore } = this.props
|
const { ballotStore, contractsStore } = this.props
|
||||||
const inputToMethod = {
|
const inputToMethod = {
|
||||||
startTime: startTime,
|
startTime,
|
||||||
endTime: endTime,
|
endTime,
|
||||||
affectedKey: ballotStore.ballotKeys.affectedKey,
|
affectedKey: ballotStore.ballotKeys.affectedKey,
|
||||||
affectedKeyType: ballotStore.ballotKeys.keyType,
|
affectedKeyType: ballotStore.ballotKeys.keyType,
|
||||||
newVotingKey: ballotStore.ballotKeys.newVotingKey,
|
newVotingKey: ballotStore.ballotKeys.newVotingKey,
|
||||||
|
@ -203,8 +203,8 @@ export class NewBallot extends React.Component {
|
||||||
createBallotForMinThreshold = (startTime, endTime) => {
|
createBallotForMinThreshold = (startTime, endTime) => {
|
||||||
const { ballotStore, contractsStore } = this.props
|
const { ballotStore, contractsStore } = this.props
|
||||||
const inputToMethod = {
|
const inputToMethod = {
|
||||||
startTime: startTime,
|
startTime,
|
||||||
endTime: endTime,
|
endTime,
|
||||||
proposedValue: ballotStore.ballotMinThreshold.proposedValue,
|
proposedValue: ballotStore.ballotMinThreshold.proposedValue,
|
||||||
memo: ballotStore.memo
|
memo: ballotStore.memo
|
||||||
}
|
}
|
||||||
|
@ -214,8 +214,8 @@ export class NewBallot extends React.Component {
|
||||||
createBallotForProxy = (startTime, endTime) => {
|
createBallotForProxy = (startTime, endTime) => {
|
||||||
const { ballotStore, contractsStore } = this.props
|
const { ballotStore, contractsStore } = this.props
|
||||||
const inputToMethod = {
|
const inputToMethod = {
|
||||||
startTime: startTime,
|
startTime,
|
||||||
endTime: endTime,
|
endTime,
|
||||||
proposedValue: ballotStore.ballotProxy.proposedAddress,
|
proposedValue: ballotStore.ballotProxy.proposedAddress,
|
||||||
contractType: ballotStore.ballotProxy.contractType,
|
contractType: ballotStore.ballotProxy.contractType,
|
||||||
memo: ballotStore.memo
|
memo: ballotStore.memo
|
||||||
|
@ -226,8 +226,8 @@ export class NewBallot extends React.Component {
|
||||||
createBallotForEmissionFunds = (startTime, endTime) => {
|
createBallotForEmissionFunds = (startTime, endTime) => {
|
||||||
const { ballotStore, contractsStore } = this.props
|
const { ballotStore, contractsStore } = this.props
|
||||||
const inputToMethod = {
|
const inputToMethod = {
|
||||||
startTime: startTime,
|
startTime,
|
||||||
endTime: endTime,
|
endTime,
|
||||||
receiver: ballotStore.ballotEmissionFunds.receiver,
|
receiver: ballotStore.ballotEmissionFunds.receiver,
|
||||||
memo: ballotStore.memo
|
memo: ballotStore.memo
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue