aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/app.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-05-14 21:30:50 +0800
committerDan <danjm.com@gmail.com>2018-05-14 22:14:50 +0800
commit6bc8cc819a16118acc010d0efdec90afbda14590 (patch)
tree2d2c35604af2e6a44c5f3ecb5c901a52980710d8 /ui/app/app.js
parent0739618a61cfc383498e466f4fdeb5a25324598f (diff)
downloadtangerine-wallet-browser-6bc8cc819a16118acc010d0efdec90afbda14590.tar
tangerine-wallet-browser-6bc8cc819a16118acc010d0efdec90afbda14590.tar.gz
tangerine-wallet-browser-6bc8cc819a16118acc010d0efdec90afbda14590.tar.bz2
tangerine-wallet-browser-6bc8cc819a16118acc010d0efdec90afbda14590.tar.lz
tangerine-wallet-browser-6bc8cc819a16118acc010d0efdec90afbda14590.tar.xz
tangerine-wallet-browser-6bc8cc819a16118acc010d0efdec90afbda14590.tar.zst
tangerine-wallet-browser-6bc8cc819a16118acc010d0efdec90afbda14590.zip
Merge branch 'develop' into i3725-refactor-send-component-
Diffstat (limited to 'ui/app/app.js')
-rw-r--r--ui/app/app.js149
1 files changed, 21 insertions, 128 deletions
diff --git a/ui/app/app.js b/ui/app/app.js
index 6511979b2..0c0c6ec44 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -1,7 +1,7 @@
const { Component } = require('react')
const PropTypes = require('prop-types')
const connect = require('react-redux').connect
-const { Route, Switch, withRouter } = require('react-router-dom')
+const { Route, Switch, withRouter, matchPath } = require('react-router-dom')
const { compose } = require('recompose')
const h = require('react-hyperscript')
const actions = require('./actions')
@@ -22,16 +22,14 @@ const Home = require('./components/pages/home')
const Authenticated = require('./components/pages/authenticated')
const Initialized = require('./components/pages/initialized')
const Settings = require('./components/pages/settings')
-const UnlockPage = require('./components/pages/unlock')
+const UnlockPage = require('./components/pages/unlock-page')
const RestoreVaultPage = require('./components/pages/keychains/restore-vault')
-const RevealSeedConfirmation = require('./keychains/hd/recover-seed/confirmation')
+const RevealSeedConfirmation = require('./components/pages/keychains/reveal-seed')
const AddTokenPage = require('./components/pages/add-token')
const CreateAccountPage = require('./components/pages/create-account')
const NoticeScreen = require('./components/pages/notice')
-const Loading = require('./components/loading')
-const NetworkIndicator = require('./components/network')
-const Identicon = require('./components/identicon')
+const Loading = require('./components/loading-screen')
const ReactCSSTransitionGroup = require('react-addons-css-transition-group')
const NetworkDropdown = require('./components/dropdowns/network-dropdown')
const AccountMenu = require('./components/account-menu')
@@ -39,6 +37,8 @@ const AccountMenu = require('./components/account-menu')
// Global Modals
const Modal = require('./components/modals/index').Modal
+const AppHeader = require('./components/app-header')
+
// Routes
const {
DEFAULT_ROUTE,
@@ -56,20 +56,11 @@ const {
class App extends Component {
componentWillMount () {
- const {
- currentCurrency,
- setCurrentCurrencyToUSD,
- isRevealingSeedWords,
- clearSeedWords,
- } = this.props
+ const { currentCurrency, setCurrentCurrencyToUSD } = this.props
if (!currentCurrency) {
setCurrentCurrencyToUSD()
}
-
- if (isRevealingSeedWords) {
- clearSeedWords()
- }
}
renderRoutes () {
@@ -78,11 +69,11 @@ class App extends Component {
return (
h(Switch, [
h(Route, { path: INITIALIZE_ROUTE, component: InitializeScreen }),
- h(Initialized, { path: REVEAL_SEED_ROUTE, exact, component: RevealSeedConfirmation }),
h(Initialized, { path: UNLOCK_ROUTE, exact, component: UnlockPage }),
- h(Initialized, { path: SETTINGS_ROUTE, component: Settings }),
h(Initialized, { path: RESTORE_VAULT_ROUTE, exact, component: RestoreVaultPage }),
- h(Initialized, { path: NOTICE_ROUTE, exact, component: NoticeScreen }),
+ h(Authenticated, { path: REVEAL_SEED_ROUTE, exact, component: RevealSeedConfirmation }),
+ h(Authenticated, { path: SETTINGS_ROUTE, component: Settings }),
+ h(Authenticated, { path: NOTICE_ROUTE, exact, component: NoticeScreen }),
h(Authenticated, { path: CONFIRM_TRANSACTION_ROUTE, component: ConfirmTxScreen }),
h(Authenticated, { path: SEND_ROUTE, exact, component: SendTransactionScreen }),
h(Authenticated, { path: ADD_TOKEN_ROUTE, exact, component: AddTokenPage }),
@@ -92,6 +83,15 @@ class App extends Component {
)
}
+ renderAppHeader () {
+ const { location } = this.props
+ const isInitializing = matchPath(location.pathname, {
+ path: INITIALIZE_ROUTE, exact: false,
+ })
+
+ return isInitializing ? null : h(AppHeader)
+ }
+
render () {
const {
isLoading,
@@ -128,8 +128,7 @@ class App extends Component {
// global modal
h(Modal, {}, []),
- // app bar
- this.renderAppBar(),
+ this.renderAppHeader(),
// sidebar
this.renderSidebar(),
@@ -144,6 +143,7 @@ class App extends Component {
(isLoading || isLoadingNetwork) && h(Loading, {
loadingMessage: loadMessage,
+ fullScreen: true,
}),
// content
@@ -205,110 +205,6 @@ class App extends Component {
])
}
- renderAppBar () {
- const {
- isUnlocked,
- network,
- provider,
- networkDropdownOpen,
- showNetworkDropdown,
- hideNetworkDropdown,
- isInitialized,
- welcomeScreenSeen,
- isPopup,
- betaUI,
- } = this.props
-
- if (window.METAMASK_UI_TYPE === 'notification') {
- return null
- }
-
- const props = this.props
- const {isMascara, isOnboarding} = props
-
- // Do not render header if user is in mascara onboarding
- if (isMascara && isOnboarding) {
- return null
- }
-
- // Do not render header if user is in mascara buy ether
- if (isMascara && props.currentView.name === 'buyEth') {
- return null
- }
-
- return (
-
- h('.full-width', {
- style: {},
- }, [
-
- (isInitialized || welcomeScreenSeen || isPopup || !betaUI) && h('.app-header.flex-row.flex-space-between', {
- className: classnames({
- 'app-header--initialized': !isOnboarding,
- }),
- }, [
- h('div.app-header-contents', {}, [
- h('div.left-menu-wrapper', {
- onClick: () => props.history.push(DEFAULT_ROUTE),
- }, [
- // mini logo
- h('img.metafox-icon', {
- height: 42,
- width: 42,
- src: '/images/metamask-fox.svg',
- }),
-
- // metamask name
- h('.flex-row', [
- h('h1', this.context.t('appName')),
- h('div.beta-label', this.context.t('beta')),
- ]),
-
- ]),
-
- betaUI && isInitialized && h('div.header__right-actions', [
- h('div.network-component-wrapper', {
- style: {},
- }, [
- // Network Indicator
- h(NetworkIndicator, {
- network,
- provider,
- disabled: this.props.location.pathname === CONFIRM_TRANSACTION_ROUTE,
- onClick: (event) => {
- event.preventDefault()
- event.stopPropagation()
- return networkDropdownOpen === false
- ? showNetworkDropdown()
- : hideNetworkDropdown()
- },
- }),
-
- ]),
-
- isUnlocked && h('div.account-menu__icon', { onClick: this.props.toggleAccountMenu }, [
- h(Identicon, {
- address: this.props.selectedAddress,
- diameter: 32,
- }),
- ]),
- ]),
- ]),
- ]),
-
- !isInitialized && !isPopup && betaUI && h('.alpha-warning__container', {}, [
- h('h2', {
- className: classnames({
- 'alpha-warning': welcomeScreenSeen,
- 'alpha-warning-welcome-screen': !welcomeScreenSeen,
- }),
- }, 'Please be aware that this version is still under development'),
- ]),
-
- ])
- )
- }
-
toggleMetamaskActive () {
if (!this.props.isUnlocked) {
// currently inactive: redirect to password box
@@ -402,8 +298,6 @@ App.propTypes = {
isMouseUser: PropTypes.bool,
setMouseUserState: PropTypes.func,
t: PropTypes.func,
- isRevealingSeedWords: PropTypes.bool,
- clearSeedWords: PropTypes.func,
}
function mapStateToProps (state) {
@@ -484,7 +378,6 @@ function mapDispatchToProps (dispatch, ownProps) {
setCurrentCurrencyToUSD: () => dispatch(actions.setCurrentCurrency('usd')),
toggleAccountMenu: () => dispatch(actions.toggleAccountMenu()),
setMouseUserState: (isMouseUser) => dispatch(actions.setMouseUserState(isMouseUser)),
- clearSeedWords: () => dispatch(actions.confirmSeedWords()),
}
}