1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-27 10:48:22 +00:00

fix intl support for receive address label

This commit is contained in:
slowbackspace 2019-02-26 15:58:59 +01:00
parent 83f7b63d2d
commit b577212c44
4 changed files with 24 additions and 16 deletions

View File

@ -1,13 +1,16 @@
/* @flow */
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import { showAddress } from 'actions/ReceiveActions';
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
import type { State, Dispatch } from 'flowtype';
import Receive from './index';
type OwnProps = { }
type OwnProps = {
intl: any,
}
type StateProps = {
selectedAccount: $ElementType<State, 'selectedAccount'>,
@ -20,7 +23,7 @@ type DispatchProps = {
showAddress: typeof showAddress
};
export type Props = StateProps & DispatchProps;
export type Props = OwnProps & StateProps & DispatchProps;
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: State): StateProps => ({
selectedAccount: state.selectedAccount,
@ -33,4 +36,4 @@ const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps>
showAddress: bindActionCreators(showAddress, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(Receive);
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Receive));

View File

@ -16,10 +16,11 @@ import colors from 'config/colors';
import { CONTEXT_DEVICE } from 'actions/constants/modal';
import Content from 'views/Wallet/components/Content';
import l10nCommonMessages from 'views/common.messages';
import VerifyAddressTooltip from '../components/VerifyAddressTooltip';
import l10nMessages from './index.messages';
import l10nCommonMessages from '../common.messages';
import l10nReceiveMessages from '../common.messages';
import type { Props } from './Container';
@ -131,13 +132,13 @@ const AccountReceive = (props: Props) => {
type="text"
readOnly
autoSelect
topLabel="Address"
topLabel={props.intl.formatMessage(l10nCommonMessages.TR_ADDRESS)}
value={address}
isPartiallyHidden={isAddressHidden}
trezorAction={isAddressVerifying ? (
<React.Fragment>
<DeviceIcon device={device} color={colors.WHITE} />
<FormattedMessage {...l10nCommonMessages.TR_CHECK_ADDRESS_ON_TREZOR} />
<FormattedMessage {...l10nReceiveMessages.TR_CHECK_ADDRESS_ON_TREZOR} />
</React.Fragment>
) : null}
icon={((addressVerified || addressUnverified) && !isAddressVerifying) && (
@ -162,13 +163,13 @@ const AccountReceive = (props: Props) => {
/>
{!(addressVerified || addressUnverified) && (
<ShowAddressButton onClick={() => props.showAddress(account.accountPath)} isDisabled={device.connected && !discovery.completed}>
<ShowAddressIcon icon={ICONS.EYE} color={colors.WHITE} /><FormattedMessage {...l10nCommonMessages.TR_SHOW_FULL_ADDRESS} />
<ShowAddressIcon icon={ICONS.EYE} color={colors.WHITE} /><FormattedMessage {...l10nReceiveMessages.TR_SHOW_FULL_ADDRESS} />
</ShowAddressButton>
)}
</Row>
{(addressVerified || addressUnverified) && !isAddressVerifying && (
<QrWrapper>
<Label><FormattedMessage {...l10nCommonMessages.TR_QR_CODE} /></Label>
<Label><FormattedMessage {...l10nReceiveMessages.TR_QR_CODE} /></Label>
<StyledQRCode
bgColor="#FFFFFF"
fgColor="#000000"

View File

@ -1,13 +1,16 @@
/* @flow */
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import { showAddress } from 'actions/ReceiveActions';
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
import type { State, Dispatch } from 'flowtype';
import Receive from './index';
type OwnProps = { }
type OwnProps = {
intl: any
}
type StateProps = {
selectedAccount: $ElementType<State, 'selectedAccount'>,
@ -20,7 +23,7 @@ type DispatchProps = {
showAddress: typeof showAddress
};
export type Props = StateProps & DispatchProps;
export type Props = OwnProps & StateProps & DispatchProps;
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: State): StateProps => ({
selectedAccount: state.selectedAccount,
@ -33,4 +36,4 @@ const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps>
showAddress: bindActionCreators(showAddress, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(Receive);
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Receive));

View File

@ -16,10 +16,11 @@ import colors from 'config/colors';
import { CONTEXT_DEVICE } from 'actions/constants/modal';
import Content from 'views/Wallet/components/Content';
import l10nCommonMessages from 'views/common.messages';
import VerifyAddressTooltip from '../components/VerifyAddressTooltip';
import l10nMessages from './index.messages';
import l10nCommonMessages from '../common.messages';
import l10nReceiveMessages from '../common.messages';
import type { Props } from './Container';
@ -131,13 +132,13 @@ const AccountReceive = (props: Props) => {
type="text"
readOnly
autoSelect
topLabel="Address"
topLabel={props.intl.formatMessage(l10nCommonMessages.TR_ADDRESS)}
value={address}
isPartiallyHidden={isAddressHidden}
trezorAction={isAddressVerifying ? (
<React.Fragment>
<DeviceIcon device={device} color={colors.WHITE} />
<FormattedMessage {...l10nCommonMessages.TR_CHECK_ADDRESS_ON_TREZOR} />
<FormattedMessage {...l10nReceiveMessages.TR_CHECK_ADDRESS_ON_TREZOR} />
</React.Fragment>
) : null}
icon={((addressVerified || addressUnverified) && !isAddressVerifying) && (
@ -162,13 +163,13 @@ const AccountReceive = (props: Props) => {
/>
{!(addressVerified || addressUnverified) && (
<ShowAddressButton onClick={() => props.showAddress(account.accountPath)} isDisabled={device.connected && !discovery.completed}>
<ShowAddressIcon icon={ICONS.EYE} color={colors.WHITE} /><FormattedMessage {...l10nCommonMessages.TR_SHOW_FULL_ADDRESS} />
<ShowAddressIcon icon={ICONS.EYE} color={colors.WHITE} /><FormattedMessage {...l10nReceiveMessages.TR_SHOW_FULL_ADDRESS} />
</ShowAddressButton>
)}
</Row>
{(addressVerified || addressUnverified) && !isAddressVerifying && (
<QrWrapper>
<Label><FormattedMessage {...l10nCommonMessages.TR_QR_CODE} /></Label>
<Label><FormattedMessage {...l10nReceiveMessages.TR_QR_CODE} /></Label>
<StyledQRCode
bgColor="#FFFFFF"
fgColor="#000000"