Skip to content

Commit e780a15

Browse files
committed
Cancel edit
1 parent cbb7c50 commit e780a15

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spa/farming/fixedInflation/view.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ var FixedInflationView = React.createClass({
88
var _this = this;
99
return {
1010
'fixedInflation/edit/open' : function(fixedInflationContractAddress) {
11-
_this.emit('edit/toggle', true, () => _this.setState({edit: true, fixedInflationContractAddress, cancelEdit : function() {
12-
_this.setState({edit : false, fixedInflationContractAddress : null, cancelEdit : null});
13-
}}))
11+
_this.emit('edit/toggle', true, () => _this.setState({edit: true, fixedInflationContractAddress}))
1412
}
1513
}
1614
},
15+
cancelEdit() {
16+
this.setState({edit : false, fixedInflationContractAddress : null, cancelEdit : null});
17+
},
1718
calculateTimeTier() {
1819
if(!this.props || !this.props.fixedInflationData || !this.props.fixedInflationData.blockLimit) {
1920
return '';
@@ -34,6 +35,7 @@ var FixedInflationView = React.createClass({
3435
var props = {};
3536
this.props && Object.entries(this.props).forEach(entry => props[entry[0]] = entry[1]);
3637
this.state && Object.entries(this.state).forEach(entry => props[entry[0]] = entry[1]);
38+
delete props.props;
3739
return (<ul className="DFOHosting DFOHostingBBBB">
3840
<section className="HostingCategoryTitle">
3941
<h2>Inflation</h2>
@@ -42,7 +44,7 @@ var FixedInflationView = React.createClass({
4244
{(!this.state || !this.state.edit) && (!this.props || !this.props.fixedInflationData) && <LoaderMinimino/>}
4345
{(!this.state || !this.state.edit) && props.dfoCore && props.dfoCore.deployedFixedInflationContracts && props.dfoCore.deployedFixedInflationContracts.length === 0 && <h4>No Fixed inflation data</h4>}
4446
{(!this.state || !this.state.edit) && props.dfoCore && React.createElement(FixedInflationViewWrapped, {...props, edit : this.props.edit})}
45-
{this.props && this.props.edit && this.state && this.state.edit && React.createElement(FixedInflationEdit, props)}
47+
{this.props && this.props.edit && this.state && this.state.edit && React.createElement(FixedInflationEdit, {...props, cancelEdit : this.cancelEdit})}
4648
</ul>);
4749
}
4850
});

0 commit comments

Comments
 (0)