diff --git a/src/components/admin-lte/index.js b/src/components/admin-lte/index.js index ada8245..229ad17 100644 --- a/src/components/admin-lte/index.js +++ b/src/components/admin-lte/index.js @@ -20,7 +20,6 @@ import SendReceive from './send-receive' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' - const { Item } = Sidebar // Screen width to hide the side menu on click @@ -34,7 +33,7 @@ const BchWallet = let _this class AdminLTEPage extends React.Component { - constructor(props) { + constructor (props) { super(props) _this = this this.state = { @@ -58,7 +57,7 @@ class AdminLTEPage extends React.Component { ] } - render() { + render () { return ( <>
- {!_this.state.inFetch &&
- -

{siteConfig.balanceText}

+ {!_this.state.inFetch && ( +
+ +

{siteConfig.balanceText}

+ + + {_this.state.bchBalance} + + USD: ${_this.state.usdBalance} - - {_this.state.bchBalance} - USD: ${_this.state.usdBalance} - -
- -
} + +
)}
@@ -159,7 +159,7 @@ class AdminLTEPage extends React.Component { } // Get wallet balance - async getBalance() { + async handleGetBalance () { try { _this.setState({ inFetch: true @@ -186,7 +186,7 @@ class AdminLTEPage extends React.Component { } } - async componentDidMount() { + async componentDidMount () { _this.customMenuItems() _this.addOnClickEventToScanner() @@ -198,16 +198,16 @@ class AdminLTEPage extends React.Component { setTimeout(() => { _this.dropDownBalance() - _this.getBalance() + _this.handleGetBalance() }, 250) } - componentDidUpdate() { + componentDidUpdate () { _this.updateState() } // Update component state when props change - updateState() { + updateState () { if (_this.props.walletInfo.mnemonic !== _this.state.walletInfo.mnemonic) { _this.setState({ walletInfo: _this.props.walletInfo @@ -223,7 +223,7 @@ class AdminLTEPage extends React.Component { // Due to that it is not possible to add the "onClick" method // directly to the component we do it using JS - customMenuItems() { + customMenuItems () { try { // Ignore menu items without link to components const ignoreItems = ['Balance', 'Qr Scanner', 'Link'] @@ -250,7 +250,7 @@ class AdminLTEPage extends React.Component { } // Displays the BCH balance by default - dropDownBalance() { + dropDownBalance () { try { const balanceEle = document.getElementById('Balance') balanceEle.children[0].click() @@ -262,7 +262,7 @@ class AdminLTEPage extends React.Component { // Section change, renders the corresponding component // to the selected section. each menu item corresponds // to a section. - changeSection(section) { + changeSection (section) { _this.activeItemById(section) _this.setState({ section: section @@ -271,7 +271,7 @@ class AdminLTEPage extends React.Component { } // Adds a visual mark to the selected item on the menu - activeItemById(id) { + activeItemById (id) { try { const elementActived = document.getElementsByClassName('active') elementActived[0].className = '' @@ -283,7 +283,7 @@ class AdminLTEPage extends React.Component { } // Hides the side menu when clicking on mobile devices - hideMenu() { + hideMenu () { try { const windowWidth = window.innerWidth // console.log("Window Width : ",windowWidth) @@ -296,7 +296,7 @@ class AdminLTEPage extends React.Component { } // Adds the "onClick" event to the QR scanner item - addOnClickEventToScanner() { + addOnClickEventToScanner () { try { const qrScannerEle = document.getElementById('Qr Scanner') qrScannerEle.onclick = () => _this.onHandleToggleScannerModal() @@ -306,7 +306,7 @@ class AdminLTEPage extends React.Component { } // Controller to show the QR scanner - onHandleToggleScannerModal() { + onHandleToggleScannerModal () { if (!_this.state.showScannerModal) { _this.hideMenu() } @@ -320,7 +320,7 @@ class AdminLTEPage extends React.Component { // Render non-default menu items. The catch ensures that the render function // won't be interrupted if there is an issue porting new menu items. - renderNewMenuItems() { + renderNewMenuItems () { try { return menuComponents && menuComponents.map(m => m.menuItem) } catch (err) { @@ -330,7 +330,7 @@ class AdminLTEPage extends React.Component { } // Displays the View corresponding to the dynamically loaded menu item. - renderNewViewItems() { + renderNewViewItems () { try { return ( menuComponents && @@ -344,7 +344,7 @@ class AdminLTEPage extends React.Component { } catch (err) { } } - getInvisibleMenuItem() { + getInvisibleMenuItem () { return (
  • {/* Adding this childrens prevents console errors */} @@ -357,7 +357,7 @@ class AdminLTEPage extends React.Component { } // Define backends servers configuration by default - setDefaultServers() { + setDefaultServers () { try { const walletInfo = _this.props.walletInfo const accessLocation = window.location.hostname diff --git a/src/components/admin-lte/wallet/create.js b/src/components/admin-lte/wallet/create.js index d40c774..2fb5286 100644 --- a/src/components/admin-lte/wallet/create.js +++ b/src/components/admin-lte/wallet/create.js @@ -11,7 +11,7 @@ const BchWallet = let _this class NewWallet extends React.Component { - constructor(props) { + constructor (props) { super(props) _this = this this.state = { @@ -22,7 +22,7 @@ class NewWallet extends React.Component { _this.BchWallet = BchWallet } - render() { + render () { return ( <> @@ -65,7 +65,7 @@ class NewWallet extends React.Component { ) } - async handleCreateWallet() { + async handleCreateWallet () { try { const currentWallet = _this.props.walletInfo @@ -125,7 +125,7 @@ class NewWallet extends React.Component { } } - handleError(error) { + handleError (error) { // console.error(error) let errMsg = '' if (error.message) { diff --git a/src/components/admin-lte/wallet/import.js b/src/components/admin-lte/wallet/import.js index fc063fd..7044289 100644 --- a/src/components/admin-lte/wallet/import.js +++ b/src/components/admin-lte/wallet/import.js @@ -13,7 +13,7 @@ const { Text } = Inputs let _this class ImportWallet extends React.Component { - constructor(props) { + constructor (props) { super(props) _this = this @@ -27,7 +27,7 @@ class ImportWallet extends React.Component { _this.BchWallet = BchWallet } - render() { + render () { return ( @@ -84,12 +84,12 @@ class ImportWallet extends React.Component { ) } - componentDidMount() { + componentDidMount () { // add max length property to mnemonic input // document.getElementById("import-mnemonic").maxLength = "12" } - handleUpdate(event) { + handleUpdate (event) { let value = event.target.value if (event.target.name === 'mnemonic') { value = value.toLowerCase() @@ -99,7 +99,7 @@ class ImportWallet extends React.Component { }) } - async handleImportWallet() { + async handleImportWallet () { try { _this.validateInputs() @@ -166,7 +166,7 @@ class ImportWallet extends React.Component { } // Reset form and component state - resetValues() { + resetValues () { _this.setState({ mnemonic: '', privateKey: '', @@ -176,7 +176,7 @@ class ImportWallet extends React.Component { mnemonicEle.value = '' } - validateInputs() { + validateInputs () { const { mnemonic } = _this.state if (mnemonic) { const spaceCount = mnemonic.split(' ').length // mnemonic.match(/ /g).length @@ -190,7 +190,7 @@ class ImportWallet extends React.Component { } } - handleError(error) { + handleError (error) { // console.error(error) let errMsg = '' if (error.message) { diff --git a/src/redux/createStore.js b/src/redux/createStore.js index 84d26a2..8d36609 100644 --- a/src/redux/createStore.js +++ b/src/redux/createStore.js @@ -36,7 +36,6 @@ const reducer = (state, action) => { const _usdBalance = bchBalance * (currentRate / 100) const usdBalance = Number(_usdBalance.toFixed(2)) // usd balance - return Object.assign({}, state, { bchBalance: { bchBalance, usdBalance } })