1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00
metamask-extension/ui/pages/routes/routes.container.js
David Walsh ab4843f06b
UX: Multichain: Implement Account Details Popover (#18811)
* UX: Multichain: Implement Account Details Popover

* Styling account details popover

* using ButtonSecondary with variant, removing Text

* adding account-details jest test

* Close popover when outside area clicked

* Move all export functionality into the popover

* Improve jest tests

* Implement new design for export key screens

* Hide warning when popover is closed

* Vertically align the copy button

* Move AccountDetailsDisplay to its own file

* Move authentication to its own file

* Move private key to its own component

* Fix misalignment of avatar on display screen

* Move private key to its own component

* Update ui/components/multichain/account-details/account-details-authenticate.js

Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>

* Update ui/components/multichain/account-details/account-details.test.js

Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>

* Prevent account name overflow, update text size

* Use FormTextField

* Add analytics

* Move location of accountDetailsAddress

* Ensure passsword input is used

---------

Co-authored-by: Victor Thomas <10986371+vthomas13@users.noreply.github.com>
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
2023-05-03 12:09:13 -05:00

85 lines
2.9 KiB
JavaScript

import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { compose } from 'redux';
import {
getAllAccountsOnNetworkAreEmpty,
getIsNetworkUsed,
getNetworkIdentifier,
getPreferences,
isNetworkLoading,
getTheme,
getIsTestnet,
getCurrentChainId,
getShouldShowSeedPhraseReminder,
isCurrentProviderCustom,
} from '../../selectors';
import {
lockMetamask,
setCurrentCurrency,
setLastActiveTime,
setMouseUserState,
toggleAccountMenu,
toggleNetworkMenu,
} from '../../store/actions';
import { pageChanged } from '../../ducks/history/history';
import { prepareToLeaveSwaps } from '../../ducks/swaps/swaps';
import { getSendStage } from '../../ducks/send';
import { getProviderConfig } from '../../ducks/metamask/metamask';
import Routes from './routes.component';
function mapStateToProps(state) {
const { appState } = state;
const { alertOpen, alertMessage, isLoading, loadingMessage } = appState;
const { autoLockTimeLimit = 0 } = getPreferences(state);
const { completedOnboarding } = state.metamask;
return {
alertOpen,
alertMessage,
textDirection: state.metamask.textDirection,
isLoading,
loadingMessage,
isUnlocked: state.metamask.isUnlocked,
isNetworkLoading: isNetworkLoading(state),
currentCurrency: state.metamask.currentCurrency,
isMouseUser: state.appState.isMouseUser,
autoLockTimeLimit,
browserEnvironmentOs: state.metamask.browserEnvironment?.os,
browserEnvironmentContainter: state.metamask.browserEnvironment?.browser,
providerId: getNetworkIdentifier(state),
providerType: getProviderConfig(state).type,
theme: getTheme(state),
sendStage: getSendStage(state),
isNetworkUsed: getIsNetworkUsed(state),
allAccountsOnNetworkAreEmpty: getAllAccountsOnNetworkAreEmpty(state),
isTestNet: getIsTestnet(state),
currentChainId: getCurrentChainId(state),
shouldShowSeedPhraseReminder: getShouldShowSeedPhraseReminder(state),
forgottenPassword: state.metamask.forgottenPassword,
isCurrentProviderCustom: isCurrentProviderCustom(state),
completedOnboarding,
isAccountMenuOpen: state.metamask.isAccountMenuOpen,
isNetworkMenuOpen: state.metamask.isNetworkMenuOpen,
accountDetailsAddress: state.appState.accountDetailsAddress,
};
}
function mapDispatchToProps(dispatch) {
return {
lockMetaMask: () => dispatch(lockMetamask(false)),
setCurrentCurrencyToUSD: () => dispatch(setCurrentCurrency('usd')),
setMouseUserState: (isMouseUser) =>
dispatch(setMouseUserState(isMouseUser)),
setLastActiveTime: () => dispatch(setLastActiveTime()),
pageChanged: (path) => dispatch(pageChanged(path)),
prepareToLeaveSwaps: () => dispatch(prepareToLeaveSwaps()),
toggleAccountMenu: () => dispatch(toggleAccountMenu()),
toggleNetworkMenu: () => dispatch(toggleNetworkMenu()),
};
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
)(Routes);