diff options
author | Clark, Jason (Contractor) <Jason_Clark@comcast.com> | 2017-11-24 09:33:44 +0800 |
---|---|---|
committer | Clark, Jason (Contractor) <Jason_Clark@comcast.com> | 2017-11-24 09:33:44 +0800 |
commit | 90fc4812bc75857581e56eb6d63484dbc5c48cb1 (patch) | |
tree | b80fbcf3c7c2772edf747852542127488fa59c11 /ui/app | |
parent | 28409294c3cd70ddbc9a9f3467d402c89e110261 (diff) | |
download | tangerine-wallet-browser-90fc4812bc75857581e56eb6d63484dbc5c48cb1.tar tangerine-wallet-browser-90fc4812bc75857581e56eb6d63484dbc5c48cb1.tar.gz tangerine-wallet-browser-90fc4812bc75857581e56eb6d63484dbc5c48cb1.tar.bz2 tangerine-wallet-browser-90fc4812bc75857581e56eb6d63484dbc5c48cb1.tar.lz tangerine-wallet-browser-90fc4812bc75857581e56eb6d63484dbc5c48cb1.tar.xz tangerine-wallet-browser-90fc4812bc75857581e56eb6d63484dbc5c48cb1.tar.zst tangerine-wallet-browser-90fc4812bc75857581e56eb6d63484dbc5c48cb1.zip |
incremental commit
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/actions.js | 9 | ||||
-rw-r--r-- | ui/app/components/identicon.js | 3 | ||||
-rw-r--r-- | ui/app/reducers/metamask.js | 6 | ||||
-rw-r--r-- | ui/app/settings.js | 25 |
4 files changed, 42 insertions, 1 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 2ca62c41f..957e42223 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -234,6 +234,9 @@ var actions = { toggleAccountMenu, useEtherscanProvider, + + TOGGLE_USE_BLOCKIE: 'TOGGLE_USE_BLOCKIE', + toggleUseBlockie, } module.exports = actions @@ -1550,3 +1553,9 @@ function toggleAccountMenu () { type: actions.TOGGLE_ACCOUNT_MENU, } } + +function toggleUseBlockie () { + return { + type: actions.TOGGLE_USE_BLOCKIE, + } +} diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index d30b7cd56..63f3087a4 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -4,6 +4,7 @@ const inherits = require('util').inherits const isNode = require('detect-node') const findDOMNode = require('react-dom').findDOMNode const jazzicon = require('jazzicon') +const blockies = require('blockies') const iconFactoryGen = require('../../lib/icon-factory') const iconFactory = iconFactoryGen(jazzicon) @@ -18,7 +19,7 @@ function IdenticonComponent () { IdenticonComponent.prototype.render = function () { var props = this.props - const { className = '', address } = props + const { className = '', address, useBlockie } = props var diameter = props.diameter || this.defaultDiameter return address diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index 83161320e..ee496dc6f 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -36,6 +36,7 @@ function reduceMetamask (state, action) { editingTransactionId: null, }, coinOptions: {}, + useBlockie: false, }, state.metamask) switch (action.type) { @@ -314,6 +315,11 @@ function reduceMetamask (state, action) { coinOptions, }) + case actions.TOGGLE_USE_BLOCKIE: + return extend(metamaskState, { + useBlockie: !metamaskState.useBlockie, + }) + default: return metamaskState diff --git a/ui/app/settings.js b/ui/app/settings.js index 786a70e7e..793906bdb 100644 --- a/ui/app/settings.js +++ b/ui/app/settings.js @@ -8,6 +8,7 @@ const validUrl = require('valid-url') const { exportAsFile } = require('./util') const TabBar = require('./components/tab-bar') const SimpleDropdown = require('./components/dropdowns/simple-dropdown') +import Switch from 'react-toggle-switch' const getInfuraCurrencyOptions = () => { const sortedCurrencies = infuraCurrencies.objects.sort((a, b) => { @@ -51,6 +52,26 @@ class Settings extends Component { ]) } + renderBlockieOptIn () { + const { metamask: { useBlockie }, toggleUseBlockie } = this.props + + return h('div.settings__content-row', [ + h('div.settings__content-item', [ + h('span', 'Use Blockie Identicon'), + ]), + h('div.settings__content-item', [ + h('div.settings__content-item-col', [ + + h(Switch, { + on: useBlockie, + onClick: event => toggleUseBlockie(), + }), + + ]), + ]), + ]) + } + renderCurrentConversion () { const { metamask: { currentCurrency, conversionDate }, setCurrentCurrency } = this.props @@ -214,6 +235,7 @@ class Settings extends Component { return ( h('div.settings__content', [ warning && h('div.settings__error', warning), + this.renderBlockieOptIn(), this.renderCurrentConversion(), // this.renderCurrentProvider(), this.renderNewRpcUrl(), @@ -335,6 +357,7 @@ class Settings extends Component { Settings.propTypes = { tab: PropTypes.string, metamask: PropTypes.object, + useBlockie: PropTypes.bool, setCurrentCurrency: PropTypes.func, setRpcTarget: PropTypes.func, displayWarning: PropTypes.func, @@ -347,6 +370,7 @@ const mapStateToProps = state => { return { metamask: state.metamask, warning: state.appState.warning, + useBlockie: state.useBlockie, } } @@ -357,6 +381,7 @@ const mapDispatchToProps = dispatch => { setRpcTarget: newRpc => dispatch(actions.setRpcTarget(newRpc)), displayWarning: warning => dispatch(actions.displayWarning(warning)), revealSeedConfirmation: () => dispatch(actions.revealSeedConfirmation()), + toggleUseBlockie: () => dispatch(actions.toggleUseBlockie()), } } |