aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-11-15 00:04:55 +0800
committerDan <danjm.com@gmail.com>2017-12-05 10:38:23 +0800
commit7f795240706c013dc4a9ece0e9c9e33897c7fc71 (patch)
tree631ca16db8ea6d5efd2e57f4c25699e3482512ca /ui
parent6561e75aa2fb03c77544da3c090ad6ea2883d29a (diff)
downloadtangerine-wallet-browser-7f795240706c013dc4a9ece0e9c9e33897c7fc71.tar
tangerine-wallet-browser-7f795240706c013dc4a9ece0e9c9e33897c7fc71.tar.gz
tangerine-wallet-browser-7f795240706c013dc4a9ece0e9c9e33897c7fc71.tar.bz2
tangerine-wallet-browser-7f795240706c013dc4a9ece0e9c9e33897c7fc71.tar.lz
tangerine-wallet-browser-7f795240706c013dc4a9ece0e9c9e33897c7fc71.tar.xz
tangerine-wallet-browser-7f795240706c013dc4a9ece0e9c9e33897c7fc71.tar.zst
tangerine-wallet-browser-7f795240706c013dc4a9ece0e9c9e33897c7fc71.zip
Add UI selection
Diffstat (limited to 'ui')
-rw-r--r--ui/app/actions.js29
-rw-r--r--ui/app/app.js60
-rw-r--r--ui/app/css/index.scss1
-rw-r--r--ui/app/css/itcss/components/menu.scss2
-rw-r--r--ui/app/reducers/metamask.js6
-rw-r--r--ui/app/root.js4
-rw-r--r--ui/app/select-app.js21
7 files changed, 94 insertions, 29 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index e79f4373e..745b8779e 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -237,6 +237,11 @@ var actions = {
SET_USE_BLOCKIE: 'SET_USE_BLOCKIE',
setUseBlockie,
+
+ // Feature Flags
+ setFeatureFlag,
+ updateFeatureFlags,
+ UPDATE_FEATURE_FLAGS: 'UPDATE_FEATURE_FLAGS',
}
module.exports = actions
@@ -1506,6 +1511,30 @@ function updateTokenExchangeRate (token = '') {
}
}
+function setFeatureFlag (feature, activated) {
+ return (dispatch) => {
+ dispatch(actions.showLoadingIndication())
+ return new Promise((resolve, reject) => {
+ background.setFeatureFlag(feature, activated, (err, updatedFeatureFlags) => {
+ dispatch(actions.hideLoadingIndication())
+ if (err) {
+ dispatch(actions.displayWarning(err.message))
+ reject(err)
+ }
+ dispatch(actions.updateFeatureFlags(updatedFeatureFlags))
+ resolve(updatedFeatureFlags)
+ })
+ })
+ }
+}
+
+function updateFeatureFlags (updatedFeatureFlags) {
+ return {
+ type: actions.UPDATE_FEATURE_FLAGS,
+ value: updatedFeatureFlags,
+ }
+}
+
// Call Background Then Update
//
// A function generator for a common pattern wherein:
diff --git a/ui/app/app.js b/ui/app/app.js
index e90c3e98e..7e1eb200f 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -116,40 +116,41 @@ App.prototype.render = function () {
log.debug('Main ui render function')
return (
+ h('.new-ui', [
+ h('.flex-column.full-height', {
+ style: {
+ overflowX: 'hidden',
+ position: 'relative',
+ alignItems: 'center',
+ },
+ }, [
- h('.flex-column.full-height', {
- style: {
- overflowX: 'hidden',
- position: 'relative',
- alignItems: 'center',
- },
- }, [
-
- // global modal
- h(Modal, {}, []),
+ // global modal
+ h(Modal, {}, []),
- // app bar
- this.renderAppBar(),
+ // app bar
+ this.renderAppBar(),
- // sidebar
- this.renderSidebar(),
+ // sidebar
+ this.renderSidebar(),
- // network dropdown
- h(NetworkDropdown, {
- provider: this.props.provider,
- frequentRpcList: this.props.frequentRpcList,
- }, []),
+ // network dropdown
+ h(NetworkDropdown, {
+ provider: this.props.provider,
+ frequentRpcList: this.props.frequentRpcList,
+ }, []),
- h(AccountMenu),
+ h(AccountMenu),
- (isLoading || isLoadingNetwork) && h(Loading, {
- loadingMessage: loadMessage,
- }),
+ (isLoading || isLoadingNetwork) && h(Loading, {
+ loadingMessage: loadMessage,
+ }),
- // this.renderLoadingIndicator({ isLoading, isLoadingNetwork, loadMessage }),
+ // this.renderLoadingIndicator({ isLoading, isLoadingNetwork, loadMessage }),
- // content
- this.renderPrimary(),
+ // content
+ this.renderPrimary(),
+ ])
])
)
}
@@ -268,6 +269,13 @@ App.prototype.renderAppBar = function () {
},
}, 'MetaMask'),
+ h('span', {
+ style: {},
+ onClick: () => {
+ props.dispatch(actions.setFeatureFlag('betaUI', false))
+ },
+ }, 'Leave Beta')
+
]),
h('div.header__right-actions', [
diff --git a/ui/app/css/index.scss b/ui/app/css/index.scss
index 01899ccad..445c819ff 100644
--- a/ui/app/css/index.scss
+++ b/ui/app/css/index.scss
@@ -4,6 +4,7 @@
http://www.creativebloq.com/web-design/manage-large-css-projects-itcss-101517528
https://www.xfive.co/blog/itcss-scalable-maintainable-css-architecture/
*/
+
@import './itcss/settings/index.scss';
@import './itcss/tools/index.scss';
@import './itcss/generic/index.scss';
diff --git a/ui/app/css/itcss/components/menu.scss b/ui/app/css/itcss/components/menu.scss
index 17e24de98..77c49bbcf 100644
--- a/ui/app/css/itcss/components/menu.scss
+++ b/ui/app/css/itcss/components/menu.scss
@@ -11,7 +11,7 @@
flex-flow: row nowrap;
align-items: center;
position: relative;
- z-index: 200;
+ z-index: 201;
font-weight: 200;
@media screen and (max-width: 575px) {
diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js
index fb53bbaef..6d6068d05 100644
--- a/ui/app/reducers/metamask.js
+++ b/ui/app/reducers/metamask.js
@@ -37,6 +37,7 @@ function reduceMetamask (state, action) {
},
coinOptions: {},
useBlockie: false,
+ featureFlags: {},
}, state.metamask)
switch (action.type) {
@@ -320,6 +321,11 @@ function reduceMetamask (state, action) {
useBlockie: action.value,
})
+ case actions.UPDATE_FEATURE_FLAGS:
+ return extend(metamaskState, {
+ featureFlags: action.value,
+ })
+
default:
return metamaskState
diff --git a/ui/app/root.js b/ui/app/root.js
index 9e7314b20..21d6d1829 100644
--- a/ui/app/root.js
+++ b/ui/app/root.js
@@ -2,7 +2,7 @@ const inherits = require('util').inherits
const Component = require('react').Component
const Provider = require('react-redux').Provider
const h = require('react-hyperscript')
-const App = require('./app')
+const SelectedApp = require('./select-app')
module.exports = Root
@@ -15,7 +15,7 @@ Root.prototype.render = function () {
h(Provider, {
store: this.props.store,
}, [
- h(App),
+ h(SelectedApp),
])
)
diff --git a/ui/app/select-app.js b/ui/app/select-app.js
new file mode 100644
index 000000000..3cba44052
--- /dev/null
+++ b/ui/app/select-app.js
@@ -0,0 +1,21 @@
+const inherits = require('util').inherits
+const Component = require('react').Component
+const connect = require('react-redux').connect
+const h = require('react-hyperscript')
+const App = require('./app')
+const OldApp = require('../../old-ui/app/app')
+
+function mapStateToProps (state) {
+ return { betaUI: state.metamask.featureFlags.betaUI }
+}
+
+module.exports = connect(mapStateToProps)(SelectedApp)
+
+inherits(SelectedApp, Component)
+function SelectedApp () { Component.call(this) }
+
+SelectedApp.prototype.render = function () {
+ const { betaUI } = this.props
+ const Selected = betaUI ? App : OldApp
+ return h(Selected)
+}