mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add announcement for users migrated to the new UI
This commit is contained in:
parent
c52ba96b85
commit
f3a7054f6b
@ -1437,6 +1437,9 @@
|
||||
"typePassword": {
|
||||
"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": {
|
||||
"message": "Welcome to the New UI (Beta)"
|
||||
},
|
||||
|
@ -44,7 +44,7 @@ class PreferencesController {
|
||||
useNativeCurrencyAsPrimaryCurrency: true,
|
||||
},
|
||||
completedOnboarding: false,
|
||||
completedUiMigration: false,
|
||||
completedUiMigration: true,
|
||||
}, opts.initState)
|
||||
|
||||
this.diagnostics = opts.diagnostics
|
||||
|
@ -426,6 +426,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
setAccountLabel: nodeify(preferencesController.setAccountLabel, preferencesController),
|
||||
setFeatureFlag: nodeify(preferencesController.setFeatureFlag, preferencesController),
|
||||
setPreference: nodeify(preferencesController.setPreference, preferencesController),
|
||||
completeUiMigration: nodeify(preferencesController.completeUiMigration, preferencesController),
|
||||
completeOnboarding: nodeify(preferencesController.completeOnboarding, preferencesController),
|
||||
addKnownMethodData: nodeify(preferencesController.addKnownMethodData, preferencesController),
|
||||
|
||||
|
@ -317,6 +317,11 @@ var actions = {
|
||||
UPDATE_PREFERENCES: 'UPDATE_PREFERENCES',
|
||||
setUseNativeCurrencyAsPrimaryCurrencyPreference,
|
||||
|
||||
// Migration of users to new UI
|
||||
setCompletedUiMigration,
|
||||
completeUiMigration,
|
||||
COMPLETE_UI_MIGRATION: 'COMPLETE_UI_MIGRATION',
|
||||
|
||||
// Onboarding
|
||||
setCompletedOnboarding,
|
||||
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) {
|
||||
return {
|
||||
type: actions.SET_NETWORK_NONCE,
|
||||
|
@ -22,6 +22,7 @@ import Settings from './components/pages/settings'
|
||||
import Authenticated from './higher-order-components/authenticated'
|
||||
import Initialized from './higher-order-components/initialized'
|
||||
import Lock from './components/pages/lock'
|
||||
import UiMigrationAnnouncement from './components/ui-migration-annoucement'
|
||||
const RestoreVaultPage = require('./components/pages/keychains/restore-vault').default
|
||||
const RevealSeedConfirmation = require('./components/pages/keychains/reveal-seed')
|
||||
const AddTokenPage = require('./components/pages/add-token')
|
||||
@ -173,6 +174,7 @@ class App extends Component {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<UiMigrationAnnouncement />
|
||||
<Modal />
|
||||
<Alert
|
||||
visible={this.props.alertOpen}
|
||||
|
@ -77,3 +77,5 @@
|
||||
@import './gas-customization/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 TransactionConfirmed from './transaction-confirmed'
|
||||
import CancelTransaction from './cancel-transaction'
|
||||
import WelcomeBeta from './welcome-beta'
|
||||
import RejectTransactions from './reject-transactions'
|
||||
import ClearApprovedOrigins from './clear-approved-origins'
|
||||
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: {
|
||||
contents: h(ClearApprovedOrigins),
|
||||
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)
|
1
ui/app/components/ui-migration-annoucement/index.js
Normal file
1
ui/app/components/ui-migration-annoucement/index.js
Normal file
@ -0,0 +1 @@
|
||||
export {default} from './ui-migration-announcement.container'
|
22
ui/app/components/ui-migration-annoucement/index.scss
Normal file
22
ui/app/components/ui-migration-annoucement/index.scss
Normal file
@ -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:
|
||||
return metamaskState
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user