diff --git a/test/unit/actions/config_test.js b/test/unit/actions/config_test.js index 2f4ebe172..7418f0bd5 100644 --- a/test/unit/actions/config_test.js +++ b/test/unit/actions/config_test.js @@ -17,13 +17,6 @@ describe('config view actions', function () { } freeze(initialState) - describe('SHOW_CONFIG_PAGE', function () { - it('should set appState.currentView.name to config', function () { - const result = reducers(initialState, actions.showConfigPage()) - assert.equal(result.appState.currentView.name, 'config') - }) - }) - describe('SET_RPC_TARGET', function () { it('sets the state.metamask.rpcTarget property of the state to the action.value', function () { const action = { diff --git a/test/unit/actions/view_info_test.js b/test/unit/actions/view_info_test.js deleted file mode 100644 index 90f607552..000000000 --- a/test/unit/actions/view_info_test.js +++ /dev/null @@ -1,19 +0,0 @@ -import assert from 'assert' -import freeze from 'deep-freeze-strict' -import * as actions from '../../../ui/app/store/actions' -import reducers from '../../../ui/app/ducks' - -describe('SHOW_INFO_PAGE', function () { - it('sets the state.appState.currentView.name property to info', function () { - const initialState = { - appState: { - activeAddress: 'foo', - }, - } - freeze(initialState) - - const action = actions.showInfoPage() - const resultingState = reducers(initialState, action) - assert.equal(resultingState.appState.currentView.name, 'info') - }) -}) diff --git a/test/unit/ui/app/reducers/app.spec.js b/test/unit/ui/app/reducers/app.spec.js index 0ba3fa6e4..ce0eea32a 100644 --- a/test/unit/ui/app/reducers/app.spec.js +++ b/test/unit/ui/app/reducers/app.spec.js @@ -146,59 +146,6 @@ describe('App State', () => { assert.equal(state.currentView.name, 'restoreVault') }) - it('shows config page', () => { - const state = reduceApp(metamaskState, { - type: actions.SHOW_CONFIG_PAGE, - value: true, - }) - - assert.equal(state.currentView.name, 'config') - assert.equal(state.currentView.context, '0xAddress') - assert.equal(state.transForward, true) - }) - - it('shows add token page', () => { - const state = reduceApp(metamaskState, { - type: actions.SHOW_ADD_TOKEN_PAGE, - value: true, - }) - - assert.equal(state.currentView.name, 'add-token') - assert.equal(state.currentView.context, '0xAddress') - assert.equal(state.transForward, true) - }) - - it('sets new account form', () => { - const state = reduceApp(metamaskState, { - type: actions.SET_NEW_ACCOUNT_FORM, - formToSelect: 'context', - }) - - assert.equal(state.currentView.name, 'accountDetail') - assert.equal(state.currentView.context, 'context') - }) - - it('shows info page', () => { - const state = reduceApp(metamaskState, { - type: actions.SHOW_INFO_PAGE, - }) - - assert.equal(state.currentView.name, 'info') - assert.equal(state.currentView.context, '0xAddress') - assert.equal(state.transForward, true) - }) - - it('shows send page', () => { - const state = reduceApp(metamaskState, { - type: actions.SHOW_SEND_PAGE, - }) - - assert.equal(state.currentView.name, 'sendTransaction') - assert.equal(state.currentView.context, '0xAddress') - assert.equal(state.transForward, true) - assert.equal(state.warning, null) - }) - it('shows send token page', () => { const state = reduceApp(metamaskState, { type: actions.SHOW_SEND_TOKEN_PAGE, diff --git a/test/unit/ui/app/selectors.spec.js b/test/unit/ui/app/selectors.spec.js index 9a2722026..a8e1079d0 100644 --- a/test/unit/ui/app/selectors.spec.js +++ b/test/unit/ui/app/selectors.spec.js @@ -152,11 +152,6 @@ describe('Selectors', function () { assert(selectedTokenContract.abi) }) - it('#getCurrentViewContext', () => { - const currentViewContext = selectors.getCurrentViewContext(mockState) - assert.equal(currentViewContext, '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc') - }) - it('#getTotalUnapprovedCount', () => { const totalUnapprovedCount = selectors.getTotalUnapprovedCount(mockState) assert.equal(totalUnapprovedCount, 1) diff --git a/ui/app/components/app/account-menu/account-menu.container.js b/ui/app/components/app/account-menu/account-menu.container.js index 7182550a5..206afb176 100644 --- a/ui/app/components/app/account-menu/account-menu.container.js +++ b/ui/app/components/app/account-menu/account-menu.container.js @@ -7,8 +7,6 @@ import { hideSidebar, lockMetamask, hideWarning, - showConfigPage, - showInfoPage, showModal, } from '../../../store/actions' import { @@ -54,16 +52,6 @@ function mapDispatchToProps (dispatch) { dispatch(hideSidebar()) dispatch(toggleAccountMenu()) }, - showConfigPage: () => { - dispatch(showConfigPage()) - dispatch(hideSidebar()) - dispatch(toggleAccountMenu()) - }, - showInfoPage: () => { - dispatch(showInfoPage()) - dispatch(hideSidebar()) - dispatch(toggleAccountMenu()) - }, showRemoveAccountConfirmationModal: identity => { return dispatch(showModal({ name: 'CONFIRM_REMOVE_ACCOUNT', identity })) }, diff --git a/ui/app/components/app/loading-network-screen/loading-network-screen.container.js b/ui/app/components/app/loading-network-screen/loading-network-screen.container.js index 2ff819b2c..f33a12e56 100644 --- a/ui/app/components/app/loading-network-screen/loading-network-screen.container.js +++ b/ui/app/components/app/loading-network-screen/loading-network-screen.container.js @@ -6,7 +6,6 @@ import { getNetworkIdentifier } from '../../../selectors/selectors' const mapStateToProps = state => { const { loadingMessage, - currentView, } = state.appState const { provider, @@ -20,7 +19,7 @@ const mapStateToProps = state => { : [provider.type] return { - isLoadingNetwork: network === 'loading' && currentView.name !== 'config', + isLoadingNetwork: network === 'loading', loadingMessage, lastSelectedProvider, setProviderArgs, diff --git a/ui/app/components/app/modals/account-details-modal/account-details-modal.container.js b/ui/app/components/app/modals/account-details-modal/account-details-modal.container.js index b76c5d4a0..b4e9c282e 100644 --- a/ui/app/components/app/modals/account-details-modal/account-details-modal.container.js +++ b/ui/app/components/app/modals/account-details-modal/account-details-modal.container.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux' -import * as actions from '../../../../store/actions' +import { showModal, setAccountLabel } from '../../../../store/actions' import { getSelectedIdentity, getRpcPrefsForCurrentProvider } from '../../../../selectors/selectors' import AccountDetailsModal from './account-details-modal.component' @@ -14,13 +14,8 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { - // Is this supposed to be used somewhere? - showQrView: (selected, identity) => dispatch(actions.showQrView(selected, identity)), - showExportPrivateKeyModal: () => { - dispatch(actions.showModal({ name: 'EXPORT_PRIVATE_KEY' })) - }, - hideModal: () => dispatch(actions.hideModal()), - setAccountLabel: (address, label) => dispatch(actions.setAccountLabel(address, label)), + showExportPrivateKeyModal: () => dispatch(showModal({ name: 'EXPORT_PRIVATE_KEY' })), + setAccountLabel: (address, label) => dispatch(setAccountLabel(address, label)), } } diff --git a/ui/app/components/app/wallet-view/wallet-view.container.js b/ui/app/components/app/wallet-view/wallet-view.container.js index 29790f9a3..e9073e273 100644 --- a/ui/app/components/app/wallet-view/wallet-view.container.js +++ b/ui/app/components/app/wallet-view/wallet-view.container.js @@ -2,15 +2,13 @@ import { connect } from 'react-redux' import { withRouter } from 'react-router-dom' import { compose } from 'recompose' import WalletView from './wallet-view.component' -import { showSendPage, hideSidebar, setSelectedToken, showAddTokenPage } from '../../../store/actions' -import { getMetaMaskAccounts, getSelectedAddress, getSelectedAccount } from '../../../selectors/selectors' +import { hideSidebar, setSelectedToken } from '../../../store/actions' +import { getSelectedAddress, getSelectedAccount } from '../../../selectors/selectors' function mapStateToProps (state) { return { - network: state.metamask.network, sidebarOpen: state.appState.sidebar.isOpen, identities: state.metamask.identities, - accounts: getMetaMaskAccounts(state), keyrings: state.metamask.keyrings, selectedAddress: getSelectedAddress(state), selectedAccount: getSelectedAccount(state), @@ -20,10 +18,8 @@ function mapStateToProps (state) { function mapDispatchToProps (dispatch) { return { - showSendPage: () => dispatch(showSendPage()), hideSidebar: () => dispatch(hideSidebar()), unsetSelectedToken: () => dispatch(setSelectedToken()), - showAddTokenPage: () => dispatch(showAddTokenPage()), } } diff --git a/ui/app/ducks/app/app.js b/ui/app/ducks/app/app.js index c1bcc57ae..fb2e7ea1f 100644 --- a/ui/app/ducks/app/app.js +++ b/ui/app/ducks/app/app.js @@ -185,56 +185,6 @@ export default function reduceApp (state, action) { return newState - case actions.SHOW_CONFIG_PAGE: - return { - ...appState, - currentView: { - name: 'config', - context: appState.currentView.context, - }, - transForward: action.value, - } - - case actions.SHOW_ADD_TOKEN_PAGE: - return { - ...appState, - currentView: { - name: 'add-token', - context: appState.currentView.context, - }, - transForward: action.value, - } - - case actions.SET_NEW_ACCOUNT_FORM: - return { - ...appState, - currentView: { - name: appState.currentView.name, - context: action.formToSelect, - }, - } - - case actions.SHOW_INFO_PAGE: - return { - ...appState, - currentView: { - name: 'info', - context: appState.currentView.context, - }, - transForward: true, - } - - case actions.SHOW_SEND_PAGE: - return { - ...appState, - currentView: { - name: 'sendTransaction', - context: appState.currentView.context, - }, - transForward: true, - warning: null, - } - case actions.SHOW_SEND_TOKEN_PAGE: return { ...appState, diff --git a/ui/app/pages/create-account/create-account.container.js b/ui/app/pages/create-account/create-account.container.js deleted file mode 100644 index 0d6d79632..000000000 --- a/ui/app/pages/create-account/create-account.container.js +++ /dev/null @@ -1,20 +0,0 @@ -import { connect } from 'react-redux' -import * as actions from '../../store/actions' -import { getCurrentViewContext } from '../../selectors/selectors' -import CreateAccountPage from './create-account.component' - -const mapStateToProps = state => ({ - displayedForm: getCurrentViewContext(state), -}) - -const mapDispatchToProps = dispatch => ({ - displayForm: form => dispatch(actions.setNewAccountForm(form)), - showQrView: (selected, identity) => dispatch(actions.showQrView(selected, identity)), - showExportPrivateKeyModal: () => { - dispatch(actions.showModal({ name: 'EXPORT_PRIVATE_KEY' })) - }, - hideModal: () => dispatch(actions.hideModal()), - setAccountLabel: (address, label) => dispatch(actions.setAccountLabel(address, label)), -}) - -export default connect(mapStateToProps, mapDispatchToProps)(CreateAccountPage) diff --git a/ui/app/pages/create-account/index.js b/ui/app/pages/create-account/index.js index 165c3b397..a736bfff7 100644 --- a/ui/app/pages/create-account/index.js +++ b/ui/app/pages/create-account/index.js @@ -1 +1 @@ -export { default } from './create-account.container' +export { default } from './create-account.component' diff --git a/ui/app/pages/routes/index.js b/ui/app/pages/routes/index.js index 8ccae97a3..8cb3bdbba 100644 --- a/ui/app/pages/routes/index.js +++ b/ui/app/pages/routes/index.js @@ -205,13 +205,12 @@ class Routes extends Component { network, provider, frequentRpcListDetail, - currentView, setMouseUserState, sidebar, submittedPendingTransactions, isMouseUser, } = this.props - const isLoadingNetwork = network === 'loading' && currentView.name !== 'config' + const isLoadingNetwork = network === 'loading' const loadMessage = loadingMessage || isLoadingNetwork ? this.getConnectingLabel(loadingMessage) : null log.debug('Main ui render function') @@ -366,7 +365,6 @@ Routes.propTypes = { provider: PropTypes.object, selectedAddress: PropTypes.string, frequentRpcListDetail: PropTypes.array, - currentView: PropTypes.object, sidebar: PropTypes.object, alertOpen: PropTypes.bool, hideSidebar: PropTypes.func, @@ -410,7 +408,6 @@ function mapStateToProps (state) { isLoading, loadingMessage, isUnlocked: state.metamask.isUnlocked, - currentView: state.appState.currentView, submittedPendingTransactions: submittedPendingTransactionsSelector(state), network: state.metamask.network, provider: state.metamask.provider, diff --git a/ui/app/pages/send/send.selectors.js b/ui/app/pages/send/send.selectors.js index be0a0bdac..99b941778 100644 --- a/ui/app/pages/send/send.selectors.js +++ b/ui/app/pages/send/send.selectors.js @@ -50,11 +50,6 @@ export function getCurrentNetwork (state) { return state.metamask.network } -export function getCurrentViewContext (state) { - const { currentView = {} } = state.appState - return currentView.context -} - export function getForceGasMin (state) { return state.metamask.send.forceGasMin } diff --git a/ui/app/pages/send/tests/send-selectors.test.js b/ui/app/pages/send/tests/send-selectors.test.js index 2e0b1a3d1..ca06f6524 100644 --- a/ui/app/pages/send/tests/send-selectors.test.js +++ b/ui/app/pages/send/tests/send-selectors.test.js @@ -9,7 +9,6 @@ import { getCurrentAccountWithSendEtherInfo, getCurrentCurrency, getCurrentNetwork, - getCurrentViewContext, getNativeCurrency, getForceGasMin, getGasLimit, @@ -180,15 +179,6 @@ describe('send selectors', () => { }) }) - describe('getCurrentViewContext()', () => { - it('should return the context of the current view', () => { - assert.equal( - getCurrentViewContext(mockState), - '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc' - ) - }) - }) - describe('getForceGasMin()', () => { it('should get the send.forceGasMin property', () => { assert.equal( diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js index 4b79cdf79..410e09520 100644 --- a/ui/app/selectors/selectors.js +++ b/ui/app/selectors/selectors.js @@ -302,11 +302,6 @@ export function getSelectedTokenContract (state) { : null } -export function getCurrentViewContext (state) { - const { currentView = {} } = state.appState - return currentView.context -} - export function getTotalUnapprovedCount ({ metamask }) { const { unapprovedTxs = {}, diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js index 6f1717afe..4ae342a95 100644 --- a/ui/app/store/actions.js +++ b/ui/app/store/actions.js @@ -36,8 +36,6 @@ export const actionConstants = { // remote state UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE', FORGOT_PASSWORD: 'FORGOT_PASSWORD', - SHOW_INFO_PAGE: 'SHOW_INFO_PAGE', - SET_NEW_ACCOUNT_FORM: 'SET_NEW_ACCOUNT_FORM', CLOSE_WELCOME_SCREEN: 'CLOSE_WELCOME_SCREEN', // unlock screen UNLOCK_IN_PROGRESS: 'UNLOCK_IN_PROGRESS', @@ -55,7 +53,6 @@ export const actionConstants = { SHOW_CONF_TX_PAGE: 'SHOW_CONF_TX_PAGE', SET_CURRENT_FIAT: 'SET_CURRENT_FIAT', // account detail screen - SHOW_SEND_PAGE: 'SHOW_SEND_PAGE', SHOW_SEND_TOKEN_PAGE: 'SHOW_SEND_TOKEN_PAGE', SHOW_PRIVATE_KEY: 'SHOW_PRIVATE_KEY', SET_ACCOUNT_LABEL: 'SET_ACCOUNT_LABEL', @@ -82,11 +79,9 @@ export const actionConstants = { UPDATE_SEND_ENS_RESOLUTION: 'UPDATE_SEND_ENS_RESOLUTION', UPDATE_SEND_ENS_RESOLUTION_ERROR: 'UPDATE_SEND_ENS_RESOLUTION_ERROR', // config screen - SHOW_CONFIG_PAGE: 'SHOW_CONFIG_PAGE', SET_RPC_TARGET: 'SET_RPC_TARGET', SET_PROVIDER_TYPE: 'SET_PROVIDER_TYPE', SET_PREVIOUS_PROVIDER: 'SET_PREVIOUS_PROVIDER', - SHOW_ADD_TOKEN_PAGE: 'SHOW_ADD_TOKEN_PAGE', UPDATE_TOKENS: 'UPDATE_TOKENS', SET_HARDWARE_WALLET_DEFAULT_HD_PATH: 'SET_HARDWARE_WALLET_DEFAULT_HD_PATH', // loading overlay @@ -548,12 +543,6 @@ export function unlockHardwareWalletAccount (index, deviceName, hdPath) { } } -export function showInfoPage () { - return { - type: actionConstants.SHOW_INFO_PAGE, - } -} - export function showQrScanner (ROUTE) { return (dispatch) => { return WebcamUtils.checkStatus() @@ -1127,14 +1116,6 @@ export function forgotPassword (forgotPasswordState = true) { } } - -export function setNewAccountForm (formToSelect) { - return { - type: actionConstants.SET_NEW_ACCOUNT_FORM, - formToSelect, - } -} - export function closeWelcomeScreen () { return { type: actionConstants.CLOSE_WELCOME_SCREEN, @@ -1272,20 +1253,6 @@ export function showConfTxPage ({ transForward = true, id }) { } } -export function showConfigPage (transitionForward = true) { - return { - type: actionConstants.SHOW_CONFIG_PAGE, - value: transitionForward, - } -} - -export function showAddTokenPage (transitionForward = true) { - return { - type: actionConstants.SHOW_ADD_TOKEN_PAGE, - value: transitionForward, - } -} - export function addToken (address, symbol, decimals, image) { return (dispatch) => { dispatch(showLoadingIndication()) @@ -1809,12 +1776,6 @@ export function setAccountLabel (account, label) { } } -export function showSendPage () { - return { - type: actionConstants.SHOW_SEND_PAGE, - } -} - export function showSendTokenPage () { return { type: actionConstants.SHOW_SEND_TOKEN_PAGE,