diff --git a/src_/frontend/component/AdminApp.js b/src_/frontend/component/AdminApp.js deleted file mode 100644 index d08042b..0000000 --- a/src_/frontend/component/AdminApp.js +++ /dev/null @@ -1,191 +0,0 @@ -import React from 'react'; -import { Route, Switch, Redirect } from 'react-router-dom' - -import { abi, address} from '../config/contract'; - -import SuccessButton from './SuccessButton.js'; // A button with complex overrides -import Body, {Maincard, Textfield, TopBar, Insidebox} from '../css'; -import { FontIcon } from 'react-toolbox/lib/font_icon'; // Bundled component import -import { Avatar } from 'react-toolbox/lib/avatar'; -import { Button, IconButton } from 'react-toolbox/lib/button'; // Bundled component import -import { Input } from 'react-toolbox/lib/input'; -import { Dropdown } from 'react-toolbox/lib/dropdown'; -import Card, { CardActions, CardMedia, CardText, CardTitle } from 'react-toolbox/lib/card'; -import { AppBar } from 'react-toolbox/lib/app_bar'; -import { Layout, Panel } from 'react-toolbox/lib/layout'; -import { Table, TableHead, TableRow, TableCell } from 'react-toolbox/lib/table'; - -const AppBars = (config)=>( - - {config.lefticon} - [{config.user}] - - {config.children} - - ); - -const HomeIcon = ( - -); - -const functionList = [ - {label:'Add User',value:'add_user'}, - {label:'Remove User',value:'rem_user'}, -] - - -class App extends React.Component { - constructor(props) { - super(props); - - web3 = window.web3 || global.web3; - var user = web3.eth.accounts? web3.eth.accounts[0]:null; - var contract = abi && typeof abi == 'object' && abi.length>1 && address?web3.eth.contract(abi).at(address):null; - - this.state = { - username: '', - email: '', - github: '', - bitcointalk: '', - web3: web3, - userAddress: user, - abi: '', - address: '', - contract: contract, - action:'' - }; - } - - handleChange (value, ev) { - console.log(value,ev) - this.setState({[ev.target.name]: value }); - } - - handleDropdownChange = (dropdown, value) => { - const newState = {}; - newState[dropdown] = value; - console.log('selected', value); - this.setState(newState); - }; - - web3State (a,b,c,d){ - if(typeof this.state.web3 == 'undefined' || !web3) - this.showAlert({type:'error',msg:'Web3 is Undefined, Can not proceed.'}); - if(!this.isAddressReady()) - this.showAlert({type:'warning',msg:'Ethereum address Unavailable'}); - if(!this.isContractReady()) - this.showAlert({type:'error',msg:'Invalid Contract'}); - } - - showAlert = (config) => { - this.msg.show(config.msg, { - time: 3000, - type: config.type, - position: config.position || 'top right' - //icon: - }) - } - - isRegistered (v,e) { - return true//TODO remove once connected to the contract - if(typeof this.state.web3 === 'undefined' || !this.state.web3 || !this.state.contract) - return false; - return this.state.contract.isRegistered(this.userAddress); - } - - isContractReady (){ - return true//TODO remove once connected to the contract - return this.state.contract && this.state.contract.address; - } - - isAddressReady(){ - //return true//TODO remove once connected to the contract - return this.state.userAddress && this.state.web3.isAddress(this.state.userAddress); - } - - isFormReady(){ - switch (this.state.action){ - case 'add_user': - return true; - break; - default: - return false; - break; - } - } - - customDropdownItem(data) { - return ( -
- {data.label} - [{data.value}] -
- ); - } - - render(){ - return ( -
- - {!this.isRegistered() && - - } - - - -
- - - - - - - - - { this.state.action == 'add_user' && - - - - } - - -
-
-
- this.msg = a} {...this.alertOptions} /> -
-
- ); - } - -} - -export default App; diff --git a/src_/frontend/component/App.js b/src_/frontend/component/App.js deleted file mode 100644 index 45e89d5..0000000 --- a/src_/frontend/component/App.js +++ /dev/null @@ -1,160 +0,0 @@ -import React from 'react'; -import { Route, Switch, Redirect } from 'react-router-dom' - -import Web3 from 'web3'; -import { abi, address} from '../config/contract'; -import endpoint,{} from '../config/network'; - -import AlertContainer from 'react-alert' - -import SuccessButton from './SuccessButton.js'; // A button with complex overrides -import Body, {Maincard, Textfield, TopBar, Insidebox} from '../css'; -import { FontIcon } from 'react-toolbox/lib/font_icon'; // Bundled component import -import { Avatar } from 'react-toolbox/lib/avatar'; -import { Button, IconButton } from 'react-toolbox/lib/button'; // Bundled component import -import { Input } from 'react-toolbox/lib/input'; -//import { Link } from 'react-toolbox/lib/link'; -import Card, { CardActions, CardMedia, CardText, CardTitle } from 'react-toolbox/lib/card'; -import { AppBar } from 'react-toolbox/lib/app_bar'; -import { Layout, Panel } from 'react-toolbox/lib/layout'; - -const AppBars = (config)=>( - - {config.lefticon} - [{config.user}] - - {config.children} - -); - -const HomeIcon = ( - -); - -const Welcomemsg = (

Welcome to Online Ethereum encoder page.

-

); - -class App extends React.Component { - constructor(props) { - super(props); - - //Hanle binds - this.web3State = this.web3State.bind(this); - - this.state = { - username: '', - email: '', - github: '', - bitcointalk: '', - web3: web3, - userAddress: user, - abi: '', - address: '', - //contract: contract - } - } - - alertOptions = { - offset: 14, - position: 'bottom left', - theme: 'dark', - time: 5000, - transition: 'scale' - } - - componentDidMount() { - //this.web3State(); - } - - handleChange (value, ev) { - this.setState({[ev.target.name]: value }); - }; - - web3State (a,b,c,d){ - - //web3 = window.web3 || global.web3; - //web3 = web3? new Web3(Web3.givenProvider || web3.currentProvider) : null; - //web3 = enpoint ? new Web3(new Web3.providers.HttpProvider(endpoint)) : web3; - //var user = web3.eth.accounts? web3.eth.accounts[0]:null; - //var contract = abi && typeof abi == 'object' && abi.length>1 && address?web3.eth.contract(abi).at(address):null; - - /* if(typeof this.state.web3 == 'undefined' || !web3) - this.showAlert({type:'error',msg:'Web3 is Undefined, Can not proceed.'}); - if(!this.isAddressReady()) - this.showAlert({type:'warning',msg:'Ethereum address Unavailable'}); - if(!this.isContractReady()) - this.showAlert({type:'error',msg:'Invalid Contract'}); - */ - } - - showAlert = (config) => { - this.msg.show(config.msg, { - time: 3000, - type: config.type, - position: config.position || 'top right' - }) - } - - isRegistered (v,e) { - if(typeof this.state.web3 === 'undefined' || !this.state.web3 || !this.state.contract) - return false; - return this.state.contract.isRegistered(this.userAddress); - } - - isContractReady (){ - return true//TODO remove once connected to the contract - return this.state.contract && this.state.contract.address; - } - - isAddressReady(){ - //return true//TODO remove once connected to the contract - return this.state.userAddress && this.state.web3.isAddress(this.state.userAddress); - } - - submitDetails (value, ev) { - console.log(this.state.web3, window.web3, global.web3); - console.log('User', this.state); - } - - render(){ - //const regEnabled = this.state.username.length>0 && this.state.email.length>0 && new RegExp('.+@.+').test(this.state.email); - const regEnabled = true; - return ( -
- - - - - - -
- ); - } -} - -export default App; diff --git a/src_/frontend/component/App_.js b/src_/frontend/component/App_.js deleted file mode 100644 index cc371ea..0000000 --- a/src_/frontend/component/App_.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import PurpleAppBar from './PurpleAppBar.js'; // AppBar with simple overrides -import SuccessButton from './SuccessButton.js'; // A button with complex overrides -import { Button } from 'react-toolbox/lib/button'; // Bundled component import - -const App = () => ( -
- -
- -
-
-); - -export default App; diff --git a/src_/frontend/component/Logo.js b/src_/frontend/component/Logo.js deleted file mode 100644 index 002f612..0000000 --- a/src_/frontend/component/Logo.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; - -const Logo = (props) => ( - - - - - - -); - -export default Logo; diff --git a/src_/frontend/component/PurpleAppBar.css b/src_/frontend/component/PurpleAppBar.css deleted file mode 100644 index 7323c9d..0000000 --- a/src_/frontend/component/PurpleAppBar.css +++ /dev/null @@ -1,9 +0,0 @@ -.appBar { - background-color: #800080; -} -.appBar svg { - width: 3.4rem; - height: 3.4rem; - margin-right: 1rem; - fill: #fff; -} diff --git a/src_/frontend/component/PurpleAppBar.js b/src_/frontend/component/PurpleAppBar.js deleted file mode 100644 index faea0a8..0000000 --- a/src_/frontend/component/PurpleAppBar.js +++ /dev/null @@ -1,17 +0,0 @@ -import React, { PropTypes } from 'react'; -import { AppBar } from 'react-toolbox/lib/app_bar'; -import Logo from './Logo.js'; -import theme from './PurpleAppBar.css'; - -const PurpleAppBar = ({ children, ...other }) => ( - - App Example - {children} - -); - -PurpleAppBar.propTypes = { - children: PropTypes.node -}; - -export default PurpleAppBar; diff --git a/src_/frontend/component/SuccessButton.css b/src_/frontend/component/SuccessButton.css deleted file mode 100644 index 47c979a..0000000 --- a/src_/frontend/component/SuccessButton.css +++ /dev/null @@ -1,5 +0,0 @@ -@import "react-toolbox/lib/button/theme.css"; - -.button { - background-color: var(--palette-green-700) !important; -} \ No newline at end of file diff --git a/src_/frontend/component/SuccessButton.js b/src_/frontend/component/SuccessButton.js deleted file mode 100644 index 3cc3690..0000000 --- a/src_/frontend/component/SuccessButton.js +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import { Button } from 'react-toolbox/lib/button'; -import theme from './SuccessButton.css'; - -const SuccessButton = (props) =>