Initial commit of fiddle tab

Not any functionality yet
This commit is contained in:
emizzle 2018-08-02 19:03:32 +10:00 committed by Pascal Precht
parent aaa5a6fd58
commit fd97ba51c7
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
4 changed files with 59 additions and 2 deletions

View File

@ -0,0 +1,11 @@
import React from 'react';
const Fiddle = () => (
<React.Fragment>
<h1>Fiddle</h1>
<p>Play around with contract code and deploy against your running node.</p>
<div id="fiddle-container"/>
</React.Fragment>
);
export default Fiddle;

View File

@ -10,7 +10,8 @@ const navBarItems = [
{value: "Contracts", to: "/embark/contracts", icon: "box", LinkComponent: withRouter(NavLink)},
{value: "Explorer", to: "/embark/explorer/accounts", icon: "activity", LinkComponent: withRouter(NavLink)},
{value: "Processes", to: "/embark/processes", icon: "cpu", LinkComponent: withRouter(NavLink)},
{value: "Documentation", to: "/embark/documentation", icon: "file-text", LinkComponent: withRouter(NavLink)}
{value: "Documentation", to: "/embark/documentation", icon: "file-text", LinkComponent: withRouter(NavLink)},
{value: "Fiddle", to: "/embark/fiddle", icon: "codepen", LinkComponent: withRouter(NavLink)}
];
const Layout = (props) => (

View File

@ -0,0 +1,44 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { fetchAccounts } from '../actions';
import Fiddle from '../components/Fiddle';
class FiddleContainer extends Component {
componentWillMount() {
this.props.fetchAccounts();
}
render() {
const { accounts } = this.props;
if (!accounts.data) {
return (
<h1>
<i>Loading accounts...</i>
</h1>
)
}
if (accounts.error) {
return (
<h1>
<i>Error API...</i>
</h1>
)
}
return (
<Fiddle />
);
}
};
function mapStateToProps(state) {
return { accounts: state.accounts }
}
export default connect(
mapStateToProps,
{
fetchAccounts
},
)(FiddleContainer)

View File

@ -2,12 +2,12 @@ import React from 'react';
import {Route, Switch} from 'react-router-dom';
import HomeContainer from './containers/HomeContainer';
import AccountsContainer from './containers/AccountsContainer';
import ContractsContainer from './containers/ContractsContainer';
import NoMatch from './components/NoMatch';
import ExplorerLayout from './components/ExplorerLayout';
import ProcessesLayout from './components/ProcessesLayout';
import ContractLayout from './components/ContractLayout';
import FiddleContainer from './containers/FiddleContainer';
const routes = (
<React.Fragment>
@ -18,6 +18,7 @@ const routes = (
<Route path="/embark/explorer/accounts" component={AccountsContainer} />
<Route path="/embark/contracts/:contractName" component={ContractLayout} />
<Route path="/embark/contracts" component={ContractsContainer} />
<Route path="/embark/fiddle" component={FiddleContainer} />
<Route component={NoMatch} />
</Switch>
</React.Fragment>