mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 03:20:23 +01:00
4c37448c97
* added ipfs toggle * added placeholder valur * fixed snapshot * updated tests * updated spec file * hide input if toggle is disabled * updated e2e tests for nft image * fixed view-ercc-1155 spec * updated e2e tests for nfts * added ipfs toggle modal * updated UI for ipfs * updated tests * updated classname * added placeholder image * lint fix * removed prop ipfsEnabled and used with selector * fixed ui for ipfs toggle * updated test * updated test to handle cases * nit fix * ensure default image height match nft image
93 lines
3.3 KiB
JavaScript
93 lines
3.3 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,
|
|
hideImportNftsModal,
|
|
hideIpfsModal,
|
|
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 { DEFAULT_AUTO_LOCK_TIME_LIMIT } from '../../../shared/constants/preferences';
|
|
import Routes from './routes.component';
|
|
|
|
function mapStateToProps(state) {
|
|
const { appState } = state;
|
|
const { alertOpen, alertMessage, isLoading, loadingMessage } = appState;
|
|
const { autoLockTimeLimit = DEFAULT_AUTO_LOCK_TIME_LIMIT } =
|
|
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,
|
|
isImportNftsModalOpen: state.appState.importNftsModalOpen,
|
|
isIpfsModalOpen: state.appState.showIpfsModalOpen,
|
|
};
|
|
}
|
|
|
|
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()),
|
|
hideImportNftsModal: () => dispatch(hideImportNftsModal()),
|
|
hideIpfsModal: () => dispatch(hideIpfsModal()),
|
|
};
|
|
}
|
|
|
|
export default compose(
|
|
withRouter,
|
|
connect(mapStateToProps, mapDispatchToProps),
|
|
)(Routes);
|