Trying to implement BCHA prices

This commit is contained in:
Chris Troutner
2020-11-17 17:58:12 -08:00
parent 11aa29eb28
commit e4382daba2
+23 -13
View File
@@ -60,18 +60,18 @@ class AdminLTEPage extends React.Component {
<AdminLTE
title={[siteConfig.title]}
titleShort={[siteConfig.titleShort]}
theme='blue'
theme="blue"
>
<Sidebar.Core>
<Item key='Balance' text='Balance' icon={siteConfig.balanceIcon}>
<Item key="Balance" text="Balance" icon={siteConfig.balanceIcon}>
<Box
className='hover-shadow border-none background-none'
className="hover-shadow border-none background-none"
loaded={!_this.state.inFetch}
>
<div className='sidebar-balance'>
<div className="sidebar-balance">
<div>
{!_this.state.inFetch && (
<div className='siderbar-balance-content'>
<div className="siderbar-balance-content">
<span>
<h3>{siteConfig.balanceText}</h3>
@@ -81,9 +81,9 @@ class AdminLTEPage extends React.Component {
<small>USD: ${_this.state.usdBalance}</small>
</span>
<FontAwesomeIcon
className='ml-1 icon'
size='lg'
icon='redo'
className="ml-1 icon"
size="lg"
icon="redo"
onClick={_this.handleGetBalance}
/>
</div>
@@ -101,8 +101,8 @@ class AdminLTEPage extends React.Component {
<Navbar.Core>
<VersionStatus />
</Navbar.Core>
<Layout path='/'>
<div className='components-container'>
<Layout path="/">
<div className="components-container">
{_this.renderNewViewItems(_this.props)}
</div>
</Layout>
@@ -132,7 +132,17 @@ class AdminLTEPage extends React.Component {
const myBalance = await bchWalletLib.getBalance()
const bchjs = bchWalletLib.bchjs
const currentRate = await bchjs.Price.getUsd() * 100
let currentRate
if (bchjs.restURL.includes('abc.fullstack')) {
currentRate = await bchjs.Price.getBchaUsd()
console.log(`currentRate: ${currentRate}`)
} else {
// BCHN price.
currentRate = (await bchjs.Price.getUsd()) * 100
}
_this.setState({
currentRate: currentRate
})
@@ -341,14 +351,14 @@ class AdminLTEPage extends React.Component {
return ''
})
)
} catch (err) { }
} catch (err) {}
}
getInvisibleMenuItem () {
return (
<li style={{ display: 'none' }}>
{/* Adding this childrens prevents console errors */}
<a href='#'>
<a href="#">
<span />
<span />
</a>