conflict in editor

This commit is contained in:
Jonathan Rainville 2018-10-28 15:02:03 +01:00
parent 19ad229dbb
commit 8b1f970f74
8 changed files with 97 additions and 83 deletions

View File

@ -1,13 +1,3 @@
.contract-function-container .collapse.show .card-body {
min-height: 65px;
}
.contract-function-container .contract-function-button {
position: absolute;
bottom: 15px;
right: 15px;
}
.contract-function-container .gas-price-form #gasPrice { .contract-function-container .gas-price-form #gasPrice {
border-top-right-radius: 0; border-top-right-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;

View File

@ -8,6 +8,7 @@ import {
Label, Label,
Input, Input,
Button, Button,
Badge,
Card, Card,
CardBody, CardBody,
CardHeader, CardHeader,
@ -20,6 +21,7 @@ import {
import GasStationContainer from "../containers/GasStationContainer"; import GasStationContainer from "../containers/GasStationContainer";
import {formatContractForDisplay} from '../utils/presentation'; import {formatContractForDisplay} from '../utils/presentation';
import FontAwesome from 'react-fontawesome'; import FontAwesome from 'react-fontawesome';
import classnames from 'classnames';
import "./ContractOverview.css"; import "./ContractOverview.css";
@ -95,17 +97,22 @@ class ContractFunction extends Component {
render() { render() {
return ( return (
<Card className="contract-function-container"> <Card className="contract-function-container">
<CardHeader className="collapsable" onClick={() => this.toggleFunction()}> <CardHeader className={classnames({collapsable: !ContractFunction.isEvent(this.props.method), closed: !this.state.functionCollapse})}
onClick={() => this.toggleFunction()}>
<CardTitle> <CardTitle>
{ContractFunction.isPureCall(this.props.method) && {ContractFunction.isPureCall(this.props.method) && Boolean(this.props.method.inputs.length) &&
<button className="btn btn-warning btn-sm float-right" onClick={(e) => this.handleCall(e)}>call</button> <Badge color="warning" className="float-right p-2">call</Badge>
}
{ContractFunction.isPureCall(this.props.method) && !this.props.method.inputs.length &&
<Button color="warning" size="sm" className="float-right" onClick={(e) => this.handleCall(e)}>call</Button>
} }
{ContractFunction.isEvent(this.props.method) && {ContractFunction.isEvent(this.props.method) &&
<button className="btn btn-info btn-sm float-right">event</button> <Badge color="info" className="float-right p-2">event</Badge>
} }
{this.props.method.name}({this.props.method.inputs.map(input => input.name).join(', ')}) {this.props.method.name}({this.props.method.inputs.map(input => input.name).join(', ')})
</CardTitle> </CardTitle>
</CardHeader> </CardHeader>
{!ContractFunction.isEvent(this.props.method) &&
<Collapse isOpen={this.state.functionCollapse} className="relative"> <Collapse isOpen={this.state.functionCollapse} className="relative">
<CardBody> <CardBody>
<Form method="post" inline> <Form method="post" inline>
@ -133,7 +140,8 @@ class ContractFunction extends Component {
<Input name="gasPrice" id="gasPrice" placeholder="uint256" <Input name="gasPrice" id="gasPrice" placeholder="uint256"
value={this.state.inputs.gasPrice || ''} value={this.state.inputs.gasPrice || ''}
onChange={(e) => this.handleChange(e, 'gasPrice')}/> onChange={(e) => this.handleChange(e, 'gasPrice')}/>
<Button onClick={(e) => this.autoSetGasPrice(e)} title="Automatically set the gas price to what is currently in the estimator (default: safe low)"> <Button onClick={(e) => this.autoSetGasPrice(e)}
title="Automatically set the gas price to what is currently in the estimator (default: safe low)">
Auto-set Auto-set
</Button> </Button>
</FormGroup> </FormGroup>
@ -151,12 +159,12 @@ class ContractFunction extends Component {
</Row> </Row>
</Col> </Col>
} }
<Button className="contract-function-button" color="primary" disabled={this.callDisabled()} <Button className="contract-function-button float-right" color="primary" disabled={this.callDisabled()}
onClick={(e) => this.handleCall(e)}> onClick={(e) => this.handleCall(e)}>
{this.buttonTitle()} {this.buttonTitle()}
</Button> </Button>
<div className="clearfix"/>
</CardBody> </CardBody>
</Collapse>
{this.props.contractFunctions && this.props.contractFunctions.length > 0 && <CardFooter> {this.props.contractFunctions && this.props.contractFunctions.length > 0 && <CardFooter>
<ListGroup> <ListGroup>
{this.props.contractFunctions.map(contractFunction => ( {this.props.contractFunctions.map(contractFunction => (
@ -167,6 +175,8 @@ class ContractFunction extends Component {
))} ))}
</ListGroup> </ListGroup>
</CardFooter>} </CardFooter>}
</Collapse>}
</Card> </Card>
); );
} }
@ -193,7 +203,7 @@ const ContractOverview = (props) => {
<div> <div>
{(contractDisplay.state === 'Deployed') && <div>Deployed at {contractDisplay.address}</div>} {(contractDisplay.state === 'Deployed') && <div>Deployed at {contractDisplay.address}</div>}
{(contractDisplay.state !== 'Deployed') && <div>{contractDisplay.address}</div>} {(contractDisplay.state !== 'Deployed') && <div>{contractDisplay.address}</div>}
<br /> <br/>
{contractProfile.methods {contractProfile.methods
.filter((method) => { .filter((method) => {
return props.onlyConstructor ? method.type === 'constructor' : method.type !== 'constructor'; return props.onlyConstructor ? method.type === 'constructor' : method.type !== 'constructor';
@ -202,7 +212,7 @@ const ContractOverview = (props) => {
method={method} method={method}
contractFunctions={filterContractFunctions(props.contractFunctions, contractProfile.name, method.name)} contractFunctions={filterContractFunctions(props.contractFunctions, contractProfile.name, method.name)}
contractProfile={contractProfile} contractProfile={contractProfile}
postContractFunction={props.postContractFunction} />)} postContractFunction={props.postContractFunction}/>)}
</div> </div>
); );
}; };

View File

@ -54,7 +54,7 @@ class SearchBar extends React.Component {
value={this.state.searchValue} value={this.state.searchValue}
onBlur={() => this.hideForm()} onBlur={() => this.hideForm()}
onKeyPress={e => this.onKeyPress(e)}/> onKeyPress={e => this.onKeyPress(e)}/>
<Button className='search-bar__button' color="secondary" onClick={(e) => this.onSubmit(e)}> <Button className="search-bar__button" color="secondary" onClick={(e) => this.onSubmit(e)}>
<FontAwesome name="search"/> <FontAwesome name="search"/>
</Button> </Button>
</div> </div>

View File

@ -1,4 +0,0 @@
.text-editor__debuggerLine {
opacity: 0.4;
background-color: #20a8d8;
}

View File

@ -5,7 +5,6 @@ import FontAwesomeIcon from 'react-fontawesome';
import classNames from 'classnames'; import classNames from 'classnames';
import {DARK_THEME, LIGHT_THEME} from '../constants'; import {DARK_THEME, LIGHT_THEME} from '../constants';
import './TextEditor.css';
const SUPPORTED_LANGUAGES = ['css', 'sol', 'html', 'json']; const SUPPORTED_LANGUAGES = ['css', 'sol', 'html', 'json'];
const DEFAULT_LANGUAGE = 'javascript'; const DEFAULT_LANGUAGE = 'javascript';

View File

@ -10,3 +10,22 @@
right: 0; right: 0;
left: 0; left: 0;
} }
.text-editor__debuggerLine {
opacity: 0.4;
background-color: #20a8d8;
}
.explorer-aside-card {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: auto;
}
.contract-function-container .card-header.closed {
border-bottom: none;
border-radius: 0.25rem;
}

View File

@ -71,7 +71,7 @@ class EditorContainer extends React.Component {
<Col xs={this.textEditorXsSize()} md={this.textEditorMdSize()} style={{overflow: 'hidden'}}> <Col xs={this.textEditorXsSize()} md={this.textEditorMdSize()} style={{overflow: 'hidden'}}>
<TextEditorContainer currentFile={this.props.currentFile} onFileContentChange={(newContent) => this.onFileContentChange(newContent)} /> <TextEditorContainer currentFile={this.props.currentFile} onFileContentChange={(newContent) => this.onFileContentChange(newContent)} />
</Col> </Col>
{this.state.currentAsideTab && <Col xs={6} md={3}> {this.state.currentAsideTab && <Col xs={6} md={3} className="editor-aside">
<TextEditorAsideContainer currentAsideTab={this.state.currentAsideTab} currentFile={this.props.currentFile} /> <TextEditorAsideContainer currentAsideTab={this.state.currentAsideTab} currentFile={this.props.currentFile} />
</Col>} </Col>}
</Row> </Row>

View File

@ -56,7 +56,7 @@ class TextEditorAsideContainer extends Component {
render() { render() {
return this.props.contracts.map((contract, index) => { return this.props.contracts.map((contract, index) => {
return ( return (
<Card key={'contract-' + index}> <Card key={'contract-' + index} className="explorer-aside-card">
<CardBody> <CardBody>
{this.renderContent(contract, index)} {this.renderContent(contract, index)}
</CardBody> </CardBody>