2018-06-12 19:56:41 +00:00
|
|
|
import React, { Fragment } from 'react';
|
2018-05-13 04:31:01 +00:00
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import { Tabs, Tab } from 'react-bootstrap';
|
2018-06-12 19:56:41 +00:00
|
|
|
import Toggle from 'react-toggle';
|
2018-05-13 04:31:01 +00:00
|
|
|
import EmbarkJS from 'Embark/EmbarkJS';
|
2018-05-17 19:53:23 +00:00
|
|
|
import TopNavbar from './components/topnavbar';
|
2018-05-13 04:31:01 +00:00
|
|
|
import TestTokenUI from './components/testtoken';
|
2018-05-17 15:04:47 +00:00
|
|
|
import ERC20TokenUI from './components/erc20token';
|
2018-06-12 22:17:04 +00:00
|
|
|
import TestToken from 'Embark/contracts/TestToken';
|
2018-06-05 00:34:56 +00:00
|
|
|
import ENSSubManagement from './components/ensSubManagement';
|
2018-06-12 22:17:04 +00:00
|
|
|
import ENSSubdomainRegistry from 'Embark/contracts/ENSSubdomainRegistry';
|
2018-06-05 00:34:56 +00:00
|
|
|
import NameLookup from './components/ens/nameLookup';
|
2018-06-12 22:17:04 +00:00
|
|
|
import AdminMode from './components/AdminMode';
|
|
|
|
import TokenPermissions from './components/standard/TokenPermission';
|
2018-05-13 04:31:01 +00:00
|
|
|
|
|
|
|
import './dapp.css';
|
|
|
|
|
|
|
|
class App extends React.Component {
|
|
|
|
constructor(props) {
|
2018-06-12 19:56:41 +00:00
|
|
|
super(props)
|
2018-05-13 04:31:01 +00:00
|
|
|
}
|
2018-06-12 19:56:41 +00:00
|
|
|
state = { admin: false };
|
2018-05-13 04:31:01 +00:00
|
|
|
|
2018-05-22 14:31:27 +00:00
|
|
|
componentDidMount(){
|
2018-05-13 04:31:01 +00:00
|
|
|
__embarkContext.execWhenReady(() => {
|
2018-05-22 14:31:27 +00:00
|
|
|
|
2018-05-13 04:31:01 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-17 19:53:23 +00:00
|
|
|
_renderStatus(title, available) {
|
2018-05-13 04:31:01 +00:00
|
|
|
let className = available ? 'pull-right status-online' : 'pull-right status-offline';
|
|
|
|
return <React.Fragment>
|
2018-05-22 14:31:27 +00:00
|
|
|
{title}
|
2018-05-13 04:31:01 +00:00
|
|
|
<span className={className}></span>
|
|
|
|
</React.Fragment>;
|
|
|
|
}
|
|
|
|
|
2018-06-12 19:56:41 +00:00
|
|
|
render() {
|
|
|
|
const { admin } = this.state;
|
2018-05-23 19:57:38 +00:00
|
|
|
return (
|
2018-06-12 19:56:41 +00:00
|
|
|
<div>
|
|
|
|
<div style={{ display: admin ? 'block' : 'none' }} >
|
|
|
|
<AdminMode style={{ display: admin ? 'block' : 'none' }}/>
|
|
|
|
</div>
|
|
|
|
{!admin &&
|
|
|
|
<Fragment>
|
|
|
|
<NameLookup />
|
|
|
|
<div style={{ textAlign: 'center', marginTop: '10%' }}>
|
2018-06-12 22:17:04 +00:00
|
|
|
<TokenPermissions
|
|
|
|
symbol='SNT'
|
|
|
|
spender={ENSSubdomainRegistry._address}
|
|
|
|
methods={TestToken.methods} />
|
|
|
|
<hr/>
|
2018-06-12 19:56:41 +00:00
|
|
|
<Toggle onChange={() => { this.setState({ admin: !admin })}} />
|
|
|
|
<br/>
|
|
|
|
<span>Admin Mode</span>
|
|
|
|
</div>
|
|
|
|
</Fragment>}
|
|
|
|
</div>
|
|
|
|
);
|
2018-05-13 04:31:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-01 14:25:59 +00:00
|
|
|
export default App;
|