1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

prefer locale slice for locale state (#17499)

This commit is contained in:
Brad Decker 2023-02-01 11:53:35 -06:00 committed by GitHub
parent d9275bb1c1
commit 0885c6cd1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 23 deletions

View File

@ -3,7 +3,7 @@ import { useHistory } from 'react-router-dom';
import { useSelector } from 'react-redux';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { getCurrentLocale } from '../../../ducks/metamask/metamask';
import { getCurrentLocale } from '../../../ducks/locale/locale';
import { I18nContext } from '../../../contexts/i18n';
import { useEqualityCheck } from '../../../hooks/useEqualityCheck';
import Button from '../../ui/button';

View File

@ -154,12 +154,6 @@ export default function reduceMetamask(state = {}, action) {
welcomeScreenSeen: true,
};
case actionConstants.SET_CURRENT_LOCALE:
return {
...metamaskState,
currentLocale: action.value.locale,
};
case actionConstants.SET_PENDING_TOKENS:
return {
...metamaskState,
@ -250,8 +244,6 @@ export function updateGasFees({
// Selectors
export const getCurrentLocale = (state) => state.metamask.currentLocale;
export const getAlertEnabledness = (state) => state.metamask.alertEnabledness;
export const getUnconnectedAccountAlertEnabledness = (state) =>

View File

@ -248,18 +248,6 @@ describe('MetaMask Reducers', () => {
expect(state.welcomeScreenSeen).toStrictEqual(true);
});
it('sets current locale', () => {
const state = reduceMetamask(
{},
{
type: actionConstants.SET_CURRENT_LOCALE,
value: { locale: 'ge' },
},
);
expect(state.currentLocale).toStrictEqual('ge');
});
it('sets pending tokens', () => {
const payload = {
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import MetaFoxLogo from '../../../components/ui/metafox-logo';
import Dropdown from '../../../components/ui/dropdown';
import { getCurrentLocale } from '../../../ducks/metamask/metamask';
import { getCurrentLocale } from '../../../ducks/locale/locale';
import { updateCurrentLocale } from '../../../store/actions';
import locales from '../../../../app/_locales/index.json';

View File

@ -37,6 +37,9 @@ describe('Onboarding Flow', () => {
metamask: {
identities: {},
},
localeMessages: {
currentLocale: 'en',
},
};
const store = configureMockStore()(mockState);

View File

@ -18,7 +18,7 @@ import {
import { useI18nContext } from '../../../hooks/useI18nContext';
import { MetaMetricsContext } from '../../../contexts/metametrics';
import { ONBOARDING_REVIEW_SRP_ROUTE } from '../../../helpers/constants/routes';
import { getCurrentLocale } from '../../../ducks/metamask/metamask';
import { getCurrentLocale } from '../../../ducks/locale/locale';
import { EVENT_NAMES, EVENT } from '../../../../shared/constants/metametrics';
import SkipSRPBackup from './skip-srp-backup-popover';

View File

@ -28,6 +28,9 @@ describe('Secure Your Wallet Onboarding View', () => {
type: 'test',
},
},
localeMessages: {
currentLocale: 'en',
},
};
const store = configureMockStore([thunk])(mockStore);