diff --git a/embark-ui/package.json b/embark-ui/package.json index 99671d5fa..aade08439 100644 --- a/embark-ui/package.json +++ b/embark-ui/package.json @@ -8,6 +8,7 @@ "classnames": "^2.2.6", "connected-react-router": "^4.3.0", "history": "^4.7.2", + "lodash": "^4.17.10", "prop-types": "^15.6.2", "react": "^16.4.1", "react-ace": "^6.1.4", diff --git a/embark-ui/src/actions/index.js b/embark-ui/src/actions/index.js index 9bab56fc1..74270b7dc 100644 --- a/embark-ui/src/actions/index.js +++ b/embark-ui/src/actions/index.js @@ -170,14 +170,14 @@ export const ensRecords = { export const FIDDLE = createRequestTypes('FIDDLE'); export const fiddle = { - request: (codeToCompile) => action(FIDDLE[REQUEST], {codeToCompile}), + request: (codeToCompile) => action(FIDDLE[REQUEST], {codeToCompile, loading: 'Compiling...'}), success: (fiddle) => action(FIDDLE[SUCCESS], {fiddles: [fiddle]}), failure: (error) => action(FIDDLE[FAILURE], {error}) }; export const FIDDLE_DEPLOY = createRequestTypes('FIDDLE_DEPLOY'); export const fiddleDeploy = { - request: (compiledCode) => action(FIDDLE_DEPLOY[REQUEST], {compiledCode}), + request: (compiledCode) => action(FIDDLE_DEPLOY[REQUEST], {compiledCode, loading: 'Deploying...'}), success: () => action(FIDDLE_DEPLOY[SUCCESS]), failure: (error) => action(FIDDLE_DEPLOY[FAILURE], {error}) }; diff --git a/embark-ui/src/components/FiddleDeployButton.js b/embark-ui/src/components/FiddleDeployButton.js index 7805b95e7..9c30a2e1a 100644 --- a/embark-ui/src/components/FiddleDeployButton.js +++ b/embark-ui/src/components/FiddleDeployButton.js @@ -1,47 +1,29 @@ import React, {Component} from 'react'; import PropTypes from 'prop-types'; import {Button} from 'tabler-react'; -import {fiddleDeploy as fiddleDeployAction} from '../actions'; -import {connect} from 'react-redux'; -import {getFiddle} from '../reducers/selectors'; class FiddleDeployButton extends Component{ - handleClick(){ - this.props.postFiddleDeploy(this.props.fiddle); - } render (){ return ( ); } } -function mapStateToProps(state) { - return { - fiddle: getFiddle(state), - error: state.errorMessage, - loading: state.loading, - compiledContract: state.compiledContract - }; -} - FiddleDeployButton.propTypes = { fiddle: PropTypes.object, - postFiddleDeploy: PropTypes.func, + onDeployClick: PropTypes.func, loading: PropTypes.bool, compiledContract: PropTypes.object, error: PropTypes.string }; -export default connect( - mapStateToProps, - { - postFiddleDeploy: fiddleDeployAction.request - }, -)(FiddleDeployButton); +export default FiddleDeployButton; diff --git a/embark-ui/src/components/FiddleResults.js b/embark-ui/src/components/FiddleResults.js index 6de31f81d..3c3764303 100644 --- a/embark-ui/src/components/FiddleResults.js +++ b/embark-ui/src/components/FiddleResults.js @@ -1,6 +1,6 @@ /* eslint {jsx-a11y/anchor-has-content:"off"} */ import React, {Component} from 'react'; -import {Card, List, Badge, Icon} from 'tabler-react'; +import {Card, List, Badge, Icon, Dimmer} from 'tabler-react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; @@ -24,7 +24,7 @@ class FiddleResults extends Component { this.setState(updatedState); } - _getFormatted(errors, errorType){ + _getFormatted(errors, errorType, loading){ const color = (errorType === "error" ? "danger" : errorType); const isFullscreen = Boolean(this.state[errorType + 'sFullscreen']); const classes = classNames({ @@ -46,15 +46,17 @@ class FiddleResults extends Component { - - {errors.map(error => { return error.node; })} - + + + {errors.map(error => { return error.node; })} + + ; } render() { - const {warnings, errors, fatal} = this.props; + const {warnings, errors, fatal, isLoading} = this.props; let renderings = []; if(fatal){ @@ -80,13 +82,13 @@ class FiddleResults extends Component { if (errors.length) renderings.push(