create admin mode

This commit is contained in:
Barry Gitarts 2018-06-12 15:56:41 -04:00
parent 984600ed16
commit 0d6822f6b8
2 changed files with 52 additions and 22 deletions

View File

@ -0,0 +1,30 @@
import React, { Fragment } from 'react';
import { Tabs, Tab } from 'react-bootstrap';
import TopNavbar from './topnavbar';
import TestTokenUI from './testtoken';
import ERC20TokenUI from './erc20token';
import ENSSubManagement from './ensSubManagement';
import NameLookup from './ens/nameLookup';
const AdminMode = () => (
<Fragment>
<TopNavbar />
<Tabs defaultActiveKey={1} id="uncontrolled-tab-example">
<Tab eventKey={1} title="TestToken">
<TestTokenUI />
</Tab>
<Tab eventKey={2} title="ERC20Token">
<ERC20TokenUI />
</Tab>
<Tab eventKey={3} title="ENS Management">
<ENSSubManagement />
</Tab>
<Tab eventKey={4} title="Name Lookup">
<NameLookup />
</Tab>
</Tabs>
</Fragment>
);
export default AdminMode;

View File

@ -1,21 +1,22 @@
import React from 'react'; import React, { Fragment } from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Tabs, Tab } from 'react-bootstrap'; import { Tabs, Tab } from 'react-bootstrap';
import Toggle from 'react-toggle';
import EmbarkJS from 'Embark/EmbarkJS'; import EmbarkJS from 'Embark/EmbarkJS';
import TopNavbar from './components/topnavbar'; import TopNavbar from './components/topnavbar';
import TestTokenUI from './components/testtoken'; import TestTokenUI from './components/testtoken';
import ERC20TokenUI from './components/erc20token'; import ERC20TokenUI from './components/erc20token';
import ENSSubManagement from './components/ensSubManagement'; import ENSSubManagement from './components/ensSubManagement';
import NameLookup from './components/ens/nameLookup'; import NameLookup from './components/ens/nameLookup';
import AdminMode from './components/AdminMode'
import './dapp.css'; import './dapp.css';
class App extends React.Component { class App extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props)
} }
state = { admin: false };
componentDidMount(){ componentDidMount(){
__embarkContext.execWhenReady(() => { __embarkContext.execWhenReady(() => {
@ -32,25 +33,24 @@ class App extends React.Component {
</React.Fragment>; </React.Fragment>;
} }
render(){ render() {
const { admin } = this.state;
return ( return (
<div> <div>
<TopNavbar /> <div style={{ display: admin ? 'block' : 'none' }} >
<Tabs defaultActiveKey={1} id="uncontrolled-tab-example"> <AdminMode style={{ display: admin ? 'block' : 'none' }}/>
<Tab eventKey={1} title="TestToken"> </div>
<TestTokenUI /> {!admin &&
</Tab> <Fragment>
<Tab eventKey={2} title="ERC20Token"> <NameLookup />
<ERC20TokenUI /> <div style={{ textAlign: 'center', marginTop: '10%' }}>
</Tab> <Toggle onChange={() => { this.setState({ admin: !admin })}} />
<Tab eventKey={3} title="ENS Management"> <br/>
<ENSSubManagement /> <span>Admin Mode</span>
</Tab> </div>
<Tab eventKey={4} title="Name Lookup"> </Fragment>}
<NameLookup /> </div>
</Tab> );
</Tabs>
</div>);
} }
} }