Merge pull request #1011 from embark-framework/bugfix/deployment-interface

Do no show interface on injected web3
This commit is contained in:
Eric Mastro 2018-10-30 20:55:52 +01:00 committed by GitHub
commit 8d33ac6cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -112,26 +112,26 @@ class Web3Contract extends React.Component {
}
inputsAsArray() {
return findConstructor(this.props.contract.abiDefinition).inputs
const constructor = findConstructor(this.props.contract.abiDefinition);
if (!constructor) return [];
return constructor.inputs
.map(input => this.state.inputs[input.name])
.filter(value => value);
}
actionDisabled() {
return this.inputsAsArray().length !== findConstructor(this.props.contract.abiDefinition).inputs.length;
const constructor = findConstructor(this.props.contract.abiDefinition);
if (!constructor) return false;
return this.inputsAsArray().length !== constructor.inputs.length;
}
render() {
const abiConstructor = findConstructor(this.props.contract.abiDefinition);
const isInterface = !abiConstructor;
const argumentsRequired = abiConstructor && abiConstructor.inputs.length > 0;
return (
<LayoutContract contract={this.props.contract} cardTitle={
<React.Fragment>
{isInterface && `${this.props.contract.className} is an interface`}
{!isInterface && this.props.contract.className}
</React.Fragment>
}>
<LayoutContract contract={this.props.contract} cardTitle={this.props.contract.className}>
<Row>
<Col md={6}>
{argumentsRequired &&
@ -148,7 +148,7 @@ class Web3Contract extends React.Component {
{!this.props.web3 && <NoWeb3/>}
{this.props.web3 && !isInterface &&
{this.props.web3 &&
<React.Fragment>
<Button className="mr-2"
color="primary"

View File

@ -42,7 +42,7 @@ class TextEditorAsideContainer extends Component {
case 'overview':
return (
<React.Fragment>
<h2>{contract.className} - Overview</h2>
<h2>{contract.className} - Interact</h2>
<ContractOverviewContainer key={index} contract={contract}/>
</React.Fragment>
);