Add announcement for users migrated to the new UI

feature/default_network_editable
Whymarrh Whitby 6 years ago
parent c52ba96b85
commit f3a7054f6b
  1. 3
      app/_locales/en/messages.json
  2. 2
      app/scripts/controllers/preferences.js
  3. 1
      app/scripts/metamask-controller.js
  4. 30
      ui/app/actions.js
  5. 2
      ui/app/app.js
  6. 2
      ui/app/components/index.scss
  7. 14
      ui/app/components/modals/modal.js
  8. 1
      ui/app/components/modals/welcome-beta/index.js
  9. 30
      ui/app/components/modals/welcome-beta/welcome-beta.component.js
  10. 4
      ui/app/components/modals/welcome-beta/welcome-beta.container.js
  11. 1
      ui/app/components/ui-migration-annoucement/index.js
  12. 22
      ui/app/components/ui-migration-annoucement/index.scss
  13. 33
      ui/app/components/ui-migration-annoucement/ui-migration-annoucement.component.js
  14. 21
      ui/app/components/ui-migration-annoucement/ui-migration-announcement.container.js
  15. 6
      ui/app/reducers/metamask.js

@ -1437,6 +1437,9 @@
"typePassword": { "typePassword": {
"message": "Type your MetaMask password" "message": "Type your MetaMask password"
}, },
"uiMigrationAnnouncement": {
"message": "Welcome to the new MetaMask UI. If you have feedback about the UI or feature requests, please reach out to our support team or on GitHub."
},
"uiWelcome": { "uiWelcome": {
"message": "Welcome to the New UI (Beta)" "message": "Welcome to the New UI (Beta)"
}, },

@ -44,7 +44,7 @@ class PreferencesController {
useNativeCurrencyAsPrimaryCurrency: true, useNativeCurrencyAsPrimaryCurrency: true,
}, },
completedOnboarding: false, completedOnboarding: false,
completedUiMigration: false, completedUiMigration: true,
}, opts.initState) }, opts.initState)
this.diagnostics = opts.diagnostics this.diagnostics = opts.diagnostics

@ -426,6 +426,7 @@ module.exports = class MetamaskController extends EventEmitter {
setAccountLabel: nodeify(preferencesController.setAccountLabel, preferencesController), setAccountLabel: nodeify(preferencesController.setAccountLabel, preferencesController),
setFeatureFlag: nodeify(preferencesController.setFeatureFlag, preferencesController), setFeatureFlag: nodeify(preferencesController.setFeatureFlag, preferencesController),
setPreference: nodeify(preferencesController.setPreference, preferencesController), setPreference: nodeify(preferencesController.setPreference, preferencesController),
completeUiMigration: nodeify(preferencesController.completeUiMigration, preferencesController),
completeOnboarding: nodeify(preferencesController.completeOnboarding, preferencesController), completeOnboarding: nodeify(preferencesController.completeOnboarding, preferencesController),
addKnownMethodData: nodeify(preferencesController.addKnownMethodData, preferencesController), addKnownMethodData: nodeify(preferencesController.addKnownMethodData, preferencesController),

@ -317,6 +317,11 @@ var actions = {
UPDATE_PREFERENCES: 'UPDATE_PREFERENCES', UPDATE_PREFERENCES: 'UPDATE_PREFERENCES',
setUseNativeCurrencyAsPrimaryCurrencyPreference, setUseNativeCurrencyAsPrimaryCurrencyPreference,
// Migration of users to new UI
setCompletedUiMigration,
completeUiMigration,
COMPLETE_UI_MIGRATION: 'COMPLETE_UI_MIGRATION',
// Onboarding // Onboarding
setCompletedOnboarding, setCompletedOnboarding,
completeOnboarding, completeOnboarding,
@ -2474,6 +2479,31 @@ function completeOnboarding () {
} }
} }
function setCompletedUiMigration () {
return dispatch => {
dispatch(actions.showLoadingIndication())
return new Promise((resolve, reject) => {
background.completeUiMigration(err => {
dispatch(actions.hideLoadingIndication())
if (err) {
dispatch(actions.displayWarning(err.message))
return reject(err)
}
dispatch(actions.completeUiMigration())
resolve()
})
})
}
}
function completeUiMigration () {
return {
type: actions.COMPLETE_UI_MIGRATION,
}
}
function setNetworkNonce (networkNonce) { function setNetworkNonce (networkNonce) {
return { return {
type: actions.SET_NETWORK_NONCE, type: actions.SET_NETWORK_NONCE,

@ -22,6 +22,7 @@ import Settings from './components/pages/settings'
import Authenticated from './higher-order-components/authenticated' import Authenticated from './higher-order-components/authenticated'
import Initialized from './higher-order-components/initialized' import Initialized from './higher-order-components/initialized'
import Lock from './components/pages/lock' import Lock from './components/pages/lock'
import UiMigrationAnnouncement from './components/ui-migration-annoucement'
const RestoreVaultPage = require('./components/pages/keychains/restore-vault').default const RestoreVaultPage = require('./components/pages/keychains/restore-vault').default
const RevealSeedConfirmation = require('./components/pages/keychains/reveal-seed') const RevealSeedConfirmation = require('./components/pages/keychains/reveal-seed')
const AddTokenPage = require('./components/pages/add-token') const AddTokenPage = require('./components/pages/add-token')
@ -173,6 +174,7 @@ class App extends Component {
} }
}} }}
> >
<UiMigrationAnnouncement />
<Modal /> <Modal />
<Alert <Alert
visible={this.props.alertOpen} visible={this.props.alertOpen}

@ -77,3 +77,5 @@
@import './gas-customization/index'; @import './gas-customization/index';
@import './gas-customization/gas-price-button-group/index'; @import './gas-customization/gas-price-button-group/index';
@import './ui-migration-annoucement/index';

@ -25,7 +25,6 @@ import ConfirmRemoveAccount from './confirm-remove-account'
import ConfirmResetAccount from './confirm-reset-account' import ConfirmResetAccount from './confirm-reset-account'
import TransactionConfirmed from './transaction-confirmed' import TransactionConfirmed from './transaction-confirmed'
import CancelTransaction from './cancel-transaction' import CancelTransaction from './cancel-transaction'
import WelcomeBeta from './welcome-beta'
import RejectTransactions from './reject-transactions' import RejectTransactions from './reject-transactions'
import ClearApprovedOrigins from './clear-approved-origins' import ClearApprovedOrigins from './clear-approved-origins'
import ConfirmCustomizeGasModal from '../gas-customization/gas-modal-page-container' import ConfirmCustomizeGasModal from '../gas-customization/gas-modal-page-container'
@ -201,19 +200,6 @@ const MODALS = {
}, },
}, },
BETA_UI_NOTIFICATION_MODAL: {
contents: h(WelcomeBeta),
mobileModalStyle: {
...modalContainerMobileStyle,
},
laptopModalStyle: {
...modalContainerLaptopStyle,
},
contentStyle: {
borderRadius: '8px',
},
},
CLEAR_APPROVED_ORIGINS: { CLEAR_APPROVED_ORIGINS: {
contents: h(ClearApprovedOrigins), contents: h(ClearApprovedOrigins),
mobileModalStyle: { mobileModalStyle: {

@ -1 +0,0 @@
export { default } from './welcome-beta.container'

@ -1,30 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import Modal, { ModalContent } from '../../modal'
const TransactionConfirmed = (props, context) => {
const { t } = context
const { hideModal } = props
return (
<Modal
onSubmit={() => hideModal()}
submitText={t('ok')}
>
<ModalContent
title={t('uiWelcome')}
description={t('uiWelcomeMessage')}
/>
</Modal>
)
}
TransactionConfirmed.contextTypes = {
t: PropTypes.func,
}
TransactionConfirmed.propTypes = {
hideModal: PropTypes.func,
}
export default TransactionConfirmed

@ -1,4 +0,0 @@
import WelcomeBeta from './welcome-beta.component'
import withModalProps from '../../../higher-order-components/with-modal-props'
export default withModalProps(WelcomeBeta)

@ -0,0 +1 @@
export {default} from './ui-migration-announcement.container'

@ -0,0 +1,22 @@
.ui-migration-announcement {
position: absolute;
z-index: 9999;
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
background: $white;
p {
box-sizing: border-box;
padding: 1em;
font-size: 12pt;
}
p:last-of-type {
cursor: pointer;
text-decoration: underline;
font-weight: bold;
}
}

@ -0,0 +1,33 @@
import PropTypes from 'prop-types'
import React, {PureComponent} from 'react'
export default class UiMigrationAnnouncement extends PureComponent {
static contextTypes = {
t: PropTypes.func.isRequired,
}
static defaultProps = {
shouldShowAnnouncement: true,
};
static propTypes = {
onClose: PropTypes.func.isRequired,
shouldShowAnnouncement: PropTypes.bool,
}
render () {
const { t } = this.context
const { onClose, shouldShowAnnouncement } = this.props
if (!shouldShowAnnouncement) {
return null
}
return (
<div className="ui-migration-announcement">
<p>{t('uiMigrationAnnouncement')}</p>
<p onClick={onClose}>{t('close')}</p>
</div>
)
}
}

@ -0,0 +1,21 @@
import { connect } from 'react-redux'
import UiMigrationAnnouncement from './ui-migration-annoucement.component'
import { setCompletedUiMigration } from '../../actions'
const mapStateToProps = (state) => {
const shouldShowAnnouncement = !state.metamask.completedUiMigration
return {
shouldShowAnnouncement,
}
}
const mapDispatchToProps = dispatch => {
return {
onClose () {
dispatch(setCompletedUiMigration())
},
}
}
export default connect(mapStateToProps, mapDispatchToProps)(UiMigrationAnnouncement)

@ -385,6 +385,12 @@ function reduceMetamask (state, action) {
}) })
} }
case actions.COMPLETE_UI_MIGRATION: {
return extend(metamaskState, {
completedUiMigration: true,
})
}
default: default:
return metamaskState return metamaskState

Loading…
Cancel
Save