2021-02-04 19:15:23 +01:00
|
|
|
import { connect } from 'react-redux';
|
2018-09-12 02:32:37 +02:00
|
|
|
import {
|
|
|
|
setCurrentCurrency,
|
|
|
|
setUseBlockie,
|
|
|
|
updateCurrentLocale,
|
2018-10-26 10:26:43 +02:00
|
|
|
setUseNativeCurrencyAsPrimaryCurrencyPreference,
|
2021-03-09 20:35:55 +01:00
|
|
|
setHideZeroBalanceTokens,
|
2019-03-05 16:45:01 +01:00
|
|
|
setParticipateInMetaMetrics,
|
2021-02-04 19:15:23 +01:00
|
|
|
} from '../../../store/actions';
|
|
|
|
import { getPreferences } from '../../../selectors';
|
|
|
|
import SettingsTab from './settings-tab.component';
|
2018-09-12 02:32:37 +02:00
|
|
|
|
2021-12-02 13:18:09 +01:00
|
|
|
const mapStateToProps = (state, ownProps) => {
|
2020-11-03 00:41:28 +01:00
|
|
|
const {
|
|
|
|
appState: { warning },
|
|
|
|
metamask,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = state;
|
2018-09-12 02:32:37 +02:00
|
|
|
const {
|
|
|
|
currentCurrency,
|
2018-10-26 10:26:43 +02:00
|
|
|
nativeCurrency,
|
2018-09-12 02:32:37 +02:00
|
|
|
useBlockie,
|
|
|
|
currentLocale,
|
2022-02-16 18:03:17 +01:00
|
|
|
selectedAddress,
|
|
|
|
useTokenDetection,
|
|
|
|
tokenList,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = metamask;
|
2021-03-09 20:35:55 +01:00
|
|
|
const {
|
|
|
|
useNativeCurrencyAsPrimaryCurrency,
|
|
|
|
hideZeroBalanceTokens,
|
|
|
|
} = getPreferences(state);
|
2018-09-12 02:32:37 +02:00
|
|
|
|
2021-12-02 13:18:09 +01:00
|
|
|
const { lastFetchedConversionDate } = ownProps;
|
|
|
|
|
2018-09-12 02:32:37 +02:00
|
|
|
return {
|
|
|
|
warning,
|
|
|
|
currentLocale,
|
|
|
|
currentCurrency,
|
2018-10-26 10:26:43 +02:00
|
|
|
nativeCurrency,
|
2018-09-12 02:32:37 +02:00
|
|
|
useBlockie,
|
2018-10-26 10:26:43 +02:00
|
|
|
useNativeCurrencyAsPrimaryCurrency,
|
2021-03-09 20:35:55 +01:00
|
|
|
hideZeroBalanceTokens,
|
2021-12-02 13:18:09 +01:00
|
|
|
lastFetchedConversionDate,
|
2022-02-16 18:03:17 +01:00
|
|
|
selectedAddress,
|
|
|
|
useTokenDetection,
|
|
|
|
tokenList,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2018-09-12 02:32:37 +02:00
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const mapDispatchToProps = (dispatch) => {
|
2018-09-12 02:32:37 +02:00
|
|
|
return {
|
2020-02-15 21:34:12 +01:00
|
|
|
setCurrentCurrency: (currency) => dispatch(setCurrentCurrency(currency)),
|
|
|
|
setUseBlockie: (value) => dispatch(setUseBlockie(value)),
|
|
|
|
updateCurrentLocale: (key) => dispatch(updateCurrentLocale(key)),
|
|
|
|
setUseNativeCurrencyAsPrimaryCurrencyPreference: (value) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
return dispatch(setUseNativeCurrencyAsPrimaryCurrencyPreference(value));
|
2018-10-17 01:03:29 +02:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
setParticipateInMetaMetrics: (val) =>
|
|
|
|
dispatch(setParticipateInMetaMetrics(val)),
|
2021-03-09 20:35:55 +01:00
|
|
|
setHideZeroBalanceTokens: (value) =>
|
|
|
|
dispatch(setHideZeroBalanceTokens(value)),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2018-09-12 02:32:37 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(SettingsTab);
|