From 27c1994fd8ff2f27565e8bf9c6009d3e11389ae5 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Thu, 3 Feb 2022 06:27:21 -0800 Subject: [PATCH] feat(site-config.js): Using to switch between dectralized and centralized infra --- src/components/admin-lte/index.js | 40 ++++---- .../admin-lte/tokens/send-tokens.js | 91 +++++++++++-------- src/components/site-config.js | 3 +- 3 files changed, 76 insertions(+), 58 deletions(-) diff --git a/src/components/admin-lte/index.js b/src/components/admin-lte/index.js index 85c5a09..5f09c35 100644 --- a/src/components/admin-lte/index.js +++ b/src/components/admin-lte/index.js @@ -60,18 +60,18 @@ class AdminLTEPage extends React.Component { - + -
+
{!_this.state.inFetch && ( -
+

{siteConfig.balanceText}

@@ -81,9 +81,9 @@ class AdminLTEPage extends React.Component { USD: ${_this.state.usdBalance}
@@ -101,8 +101,8 @@ class AdminLTEPage extends React.Component { - -
+ +
{_this.renderNewViewItems(_this.props)}
@@ -134,14 +134,18 @@ class AdminLTEPage extends React.Component { const bchjs = bchWalletLib.bchjs - let currentRate + const currentRate = (await bchWalletLib.getUsd()) * 100 + console.log('currentRate: ', currentRate) - if (bchjs.restURL.includes('abc.fullstack')) { - currentRate = (await bchjs.Price.getBchaUsd()) * 100 - } else { - // BCHN price. - currentRate = (await bchjs.Price.getUsd()) * 100 - } + // if (bchjs.restURL.includes('abc.fullstack')) { + // currentRate = (await bchjs.Price.getBchaUsd()) * 100 + // } else if (siteConfig.interface === 'consumer-api') { + // bchjs.restURL = `${siteConfig.restURL}/` + // currentRate = (await bchjs.Price.getUsd()) * 100 + // } else { + // // BCHN price. + // currentRate = (await bchjs.Price.getUsd()) * 100 + // } _this.setState({ currentRate: currentRate @@ -383,7 +387,7 @@ class AdminLTEPage extends React.Component { return (
  • {/* Adding this childrens prevents console errors */} - + diff --git a/src/components/admin-lte/tokens/send-tokens.js b/src/components/admin-lte/tokens/send-tokens.js index 5d6b36a..04adcd2 100644 --- a/src/components/admin-lte/tokens/send-tokens.js +++ b/src/components/admin-lte/tokens/send-tokens.js @@ -6,6 +6,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import ScannerModal from '../../qr-scanner/modal' const { Text } = Inputs +const siteConfig = require('../../site-config') + const BchWallet = typeof window !== 'undefined' ? window.SlpWallet : null let _this @@ -33,72 +35,72 @@ class SendTokens extends React.Component { <> - + - -

    + +

    Send

    - + +