diff --git a/package.json b/package.json
index 54f9b24..988a882 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"@reach/router": "^1.2.1",
"ms": "^2.1.1",
"react": "^16.8.6",
+ "react-blockies": "^1.4.1",
"react-dom": "^16.8.6"
},
"devDependencies": {
diff --git a/src/components/Balance.jsx b/src/components/Balance.jsx
index 229470e..b3741dc 100644
--- a/src/components/Balance.jsx
+++ b/src/components/Balance.jsx
@@ -1,19 +1,19 @@
import React from 'react'
import PropTypes from 'prop-types'
-import { Consumer } from '../store/createContext'
+import { AppContext } from '../store/createContext'
import { locale } from '../util/moneyFormatter'
import { formatCurrency } from '@coingecko/cryptoformat'
const Balance = ({ balance }) => (
- Hello Preferences
Close
-
- {this.state.accounts &&
- this.state.accounts.map(account => (
-
- {account}
-
-
- ))}
+
Preferences
{' '}
+
Close
+
-
)
}
diff --git a/src/store/AppProvider.jsx b/src/store/AppProvider.jsx
index 6bcf4d3..1bbd8d5 100644
--- a/src/store/AppProvider.jsx
+++ b/src/store/AppProvider.jsx
@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import ms from 'ms'
import Store from 'electron-store'
-import { Provider } from './createContext'
+import { AppContext } from './createContext'
import { refreshInterval, prices, oceanTokenContract } from '../../config'
export default class AppProvider extends PureComponent {
@@ -18,7 +18,8 @@ export default class AppProvider extends PureComponent {
currency: 'ocean',
needsConfig: false,
prices: Object.assign(...prices.map(key => ({ [key]: 0 }))),
- toggleCurrencies: currency => this.setState({ currency })
+ toggleCurrencies: currency => this.setState({ currency }),
+ setBalances: account => this.setBalances(account)
}
async componentDidMount() {
@@ -30,15 +31,6 @@ export default class AppProvider extends PureComponent {
await setInterval(this.setBalances, ms(refreshInterval))
this.setState({ isLoading: false })
-
- // document.addEventListener('DOMContentLoaded', () => {
- // this.store.onDidChange('accounts', async (newValue, oldValue) => {
- // const { accounts } = await this.getAccounts()
- // await this.setBalances(accounts)
-
- // console.log('hello from setting window', newValue, oldValue)
- // })
- // })
}
componentWillUnmount() {
@@ -138,6 +130,10 @@ export default class AppProvider extends PureComponent {
}
render() {
- return
{this.props.children}
+ return (
+
+ {this.props.children}
+
+ )
}
}
diff --git a/src/store/createContext.jsx b/src/store/createContext.jsx
index 25bffa4..75ba03c 100644
--- a/src/store/createContext.jsx
+++ b/src/store/createContext.jsx
@@ -1,5 +1,5 @@
import { createContext } from 'react'
-const { Provider, Consumer } = createContext()
+const AppContext = createContext({})
-export { Provider, Consumer }
+export { AppContext }