mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
* updating controllers with conversionRate change with minimal required changes in extension * swapping showFiat selector in places where possible * adding invalid conversion protection * lint fixes * adjusting list-item styling logic
33 lines
849 B
JavaScript
33 lines
849 B
JavaScript
import { connect } from 'react-redux';
|
|
import { ETH } from '../../../helpers/constants/common';
|
|
import { getShouldShowFiat } from '../../../selectors';
|
|
import CurrencyInput from './currency-input.component';
|
|
|
|
const mapStateToProps = (state) => {
|
|
const {
|
|
metamask: { nativeCurrency, currentCurrency, conversionRate },
|
|
} = state;
|
|
const showFiat = getShouldShowFiat(state);
|
|
|
|
return {
|
|
nativeCurrency,
|
|
currentCurrency,
|
|
conversionRate,
|
|
hideFiat: !showFiat,
|
|
};
|
|
};
|
|
|
|
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
|
const { nativeCurrency, currentCurrency } = stateProps;
|
|
|
|
return {
|
|
...stateProps,
|
|
...dispatchProps,
|
|
...ownProps,
|
|
nativeSuffix: nativeCurrency || ETH,
|
|
fiatSuffix: currentCurrency.toUpperCase(),
|
|
};
|
|
};
|
|
|
|
export default connect(mapStateToProps, null, mergeProps)(CurrencyInput);
|