mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-10 13:55:45 +00:00
refactor AsideContainer to remove duplication
This commit is contained in:
parent
f483230650
commit
19ad229dbb
@ -16,8 +16,3 @@
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
#root .explorer-row .text-truncate {
|
|
||||||
width: 90%;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
@ -16,58 +16,54 @@ class TextEditorAsideContainer extends Component {
|
|||||||
this.props.fetchContracts();
|
this.props.fetchContracts();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
renderContent(contract, index) {
|
||||||
switch(this.props.currentAsideTab) {
|
switch (this.props.currentAsideTab) {
|
||||||
case 'browser':
|
case 'browser':
|
||||||
return <Preview />;
|
return <Preview/>;
|
||||||
case 'debugger':
|
case 'debugger':
|
||||||
return this.props.contracts.map((contract, index) => {
|
return (
|
||||||
return (
|
<React.Fragment>
|
||||||
<Card key={'contract-' + index}>
|
<h2>{contract.className} - Details</h2>
|
||||||
<CardBody>
|
<ContractDebuggerContainer key={index} contract={contract}/>
|
||||||
<h2>{contract.className} - Details</h2>
|
</React.Fragment>
|
||||||
<ContractDebuggerContainer key={index} contract={contract} />
|
);
|
||||||
</CardBody>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
case 'detail':
|
case 'detail':
|
||||||
return this.props.contracts.map((contract, index) => {
|
return (
|
||||||
return (
|
<React.Fragment>
|
||||||
<Card key={'contract-' + index}>
|
<h2>{contract.className} - Details</h2>
|
||||||
<CardBody>
|
<ContractDetail key={index} contract={contract}/>
|
||||||
<h2>{contract.className} - Details</h2>
|
</React.Fragment>
|
||||||
<ContractDetail key={index} contract={contract} />
|
);
|
||||||
</CardBody>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
case 'logger':
|
case 'logger':
|
||||||
return this.props.contracts.map((contract, index) => {
|
return (
|
||||||
return (
|
<React.Fragment>
|
||||||
<Card key={'contract-' + index}>
|
<h2>{contract.className} - Transactions</h2>
|
||||||
<CardBody>
|
<ContractLoggerContainer key={index} contract={contract}/>)
|
||||||
<h2>{contract.className} - Transactions</h2>
|
</React.Fragment>
|
||||||
<ContractLoggerContainer key={index} contract={contract} />)
|
);
|
||||||
</CardBody>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
case 'overview':
|
case 'overview':
|
||||||
return this.props.contracts.map((contract, index) => {
|
return (
|
||||||
return (
|
<React.Fragment>
|
||||||
<Card key={'contract-' + index}>
|
<h2>{contract.className} - Overview</h2>
|
||||||
<CardBody>
|
<ContractOverviewContainer key={index} contract={contract}/>
|
||||||
<h2>{contract.className} - Overview</h2>
|
</React.Fragment>
|
||||||
<ContractOverviewContainer key={index} contract={contract} />
|
);
|
||||||
</CardBody>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
default:
|
default:
|
||||||
return <React.Fragment></React.Fragment>;
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return this.props.contracts.map((contract, index) => {
|
||||||
|
return (
|
||||||
|
<Card key={'contract-' + index}>
|
||||||
|
<CardBody>
|
||||||
|
{this.renderContent(contract, index)}
|
||||||
|
</CardBody>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToProps(state, props) {
|
function mapStateToProps(state, props) {
|
||||||
@ -88,5 +84,5 @@ export default connect(
|
|||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
{
|
{
|
||||||
fetchContracts: contractsAction.request
|
fetchContracts: contractsAction.request
|
||||||
},
|
}
|
||||||
)(TextEditorAsideContainer);
|
)(TextEditorAsideContainer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user