i18n for rewardDesitination options (#3650)
This commit is contained in:
parent
74e7adacf1
commit
731408696a
@ -26,6 +26,7 @@
|
||||
"Changing the key only takes effect at the start of the next session. The input here is generates from the author_rotateKeys command": "Changing the key only takes effect at the start of the next session. The input here is generates from the author_rotateKeys command",
|
||||
"Chilled ({{count}})": "Chilled ({{count}})",
|
||||
"Chilled nominations ({{count}})": "Chilled nominations ({{count}})",
|
||||
"Controller account": "Controller account",
|
||||
"Display overview information for the selected validator, including blocks produced.": "Display overview information for the selected validator, including blocks produced.",
|
||||
"Distinct stash and controller accounts are recommended to ensure fund security. You will be allowed to make the transaction, but take care to not tie up all funds, only use a portion of the available funds during this period.": "Distinct stash and controller accounts are recommended to ensure fund security. You will be allowed to make the transaction, but take care to not tie up all funds, only use a portion of the available funds during this period.",
|
||||
"Ensure that not all funds are locked, funds need to be available for fees.": "Ensure that not all funds are locked, funds need to be available for fees.",
|
||||
@ -69,6 +70,7 @@
|
||||
"Oversubscribed": "Oversubscribed",
|
||||
"Oversubscribed nominations ({{count}})": "Oversubscribed nominations ({{count}})",
|
||||
"Parachains": "Parachains",
|
||||
"Payment account": "Payment account",
|
||||
"Payout": "Payout",
|
||||
"Payout all": "Payout all",
|
||||
"Payout all stakers": "Payout all stakers",
|
||||
@ -95,8 +97,11 @@
|
||||
"Slashed in era {{eras}}": "Slashed in era {{eras}}",
|
||||
"Slashes": "Slashes",
|
||||
"Slashes ({{count}})": "Slashes ({{count}})",
|
||||
"Specific payment account": "Specific payment account",
|
||||
"Staking overview": "Staking overview",
|
||||
"Stash": "Stash",
|
||||
"Stash account (do not increase the amount at stake)": "Stash account (do not increase the amount at stake)",
|
||||
"Stash account (increase the amount at stake)": "Stash account (increase the amount at stake)",
|
||||
"Stop": "Stop",
|
||||
"Submit key": "Submit key",
|
||||
"Targets": "Targets",
|
||||
|
||||
@ -119,6 +119,7 @@
|
||||
"Constants": "",
|
||||
"Continue": "",
|
||||
"Contracts": "",
|
||||
"Controller account": "",
|
||||
"Conviction locks do overlap and is additive, meaning that funds locked during a previous vote can be locked again.": "",
|
||||
"Copy the above string and sign an Ethereum transaction with the account you used during the pre-sale in the wallet of your choice, using the string as the payload, and then paste the transaction signature object below": "",
|
||||
"Council": "",
|
||||
@ -316,6 +317,7 @@
|
||||
"Parachains": "",
|
||||
"Parachains overview": "",
|
||||
"Paste here the address of the contact you want to add to your address book.": "",
|
||||
"Payment account": "",
|
||||
"Payout": "",
|
||||
"Payout all": "",
|
||||
"Payout all stakers": "",
|
||||
@ -437,6 +439,7 @@
|
||||
"Slashed": "",
|
||||
"Society": "",
|
||||
"Society overview": "",
|
||||
"Specific payment account": "",
|
||||
"Specify the user account to use for this contract call. And fees will be deducted from this account.": "",
|
||||
"Specify the user account to use for this deployment. And fees will be deducted from this account.": "",
|
||||
"Specify the user account to use for this deployment. Any fees will be deducted from this account.": "",
|
||||
@ -453,6 +456,8 @@
|
||||
"Start generation": "",
|
||||
"Start recovery": "",
|
||||
"Stash": "",
|
||||
"Stash account (do not increase the amount at stake)": "",
|
||||
"Stash account (increase the amount at stake)": "",
|
||||
"Stop": "",
|
||||
"Stop generation": "",
|
||||
"Storage": "",
|
||||
|
||||
@ -5,11 +5,11 @@
|
||||
import { RewardDestination } from '@polkadot/types/interfaces';
|
||||
import { DestinationType } from '../types';
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { Dropdown, InputAddress, Modal, TxButton } from '@polkadot/react-components';
|
||||
|
||||
import { useTranslation } from '../../translate';
|
||||
import { rewardDestinationOptions, rewardDestinationOptionsPrev } from '../constants';
|
||||
import { createDestCurr, createDestPrev } from '../destOptions';
|
||||
|
||||
interface Props {
|
||||
defaultDestination?: RewardDestination;
|
||||
@ -23,9 +23,13 @@ function SetRewardDestination ({ controllerId, defaultDestination, onClose, stas
|
||||
const [destination, setDestination] = useState<DestinationType>(((defaultDestination?.isAccount ? 'Account' : defaultDestination?.toString()) || 'Staked') as 'Staked');
|
||||
const [destAccount, setDestAccount] = useState<string | null>(defaultDestination?.isAccount ? defaultDestination.asAccount.toString() : null);
|
||||
|
||||
const options = defaultDestination?.isAccount
|
||||
? rewardDestinationOptions
|
||||
: rewardDestinationOptionsPrev;
|
||||
const options = useMemo(
|
||||
() => defaultDestination?.isAccount
|
||||
? createDestCurr(t)
|
||||
: createDestPrev(t),
|
||||
[defaultDestination, t]
|
||||
);
|
||||
|
||||
const isAccount = destination === 'Account';
|
||||
|
||||
return (
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/react-components authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export const rewardDestinationOptionsPrev = [
|
||||
{ text: 'Stash account (increase the amount at stake)', value: 'Staked' },
|
||||
{ text: 'Stash account (do not increase the amount at stake)', value: 'Stash' },
|
||||
{ text: 'Controller account', value: 'Controller' }
|
||||
];
|
||||
|
||||
export const rewardDestinationOptions = [
|
||||
...rewardDestinationOptionsPrev,
|
||||
{ text: 'Payment account', value: 'Account' }
|
||||
];
|
||||
22
packages/page-staking/src/Actions/destOptions.tsx
Normal file
22
packages/page-staking/src/Actions/destOptions.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2017-2020 @polkadot/react-components authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TFunction } from 'i18next';
|
||||
|
||||
interface Option {
|
||||
text: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export function createDestPrev (t: TFunction): Option[] {
|
||||
return [
|
||||
{ text: t('Stash account (increase the amount at stake)'), value: 'Staked' },
|
||||
{ text: t('Stash account (do not increase the amount at stake)'), value: 'Stash' },
|
||||
{ text: t('Controller account'), value: 'Controller' }
|
||||
];
|
||||
}
|
||||
|
||||
export function createDestCurr (t: TFunction): Option[] {
|
||||
return createDestPrev(t).concat({ text: t('Specified payment account'), value: 'Account' });
|
||||
}
|
||||
@ -7,7 +7,7 @@ import { AmountValidateState, DestinationType } from '../types';
|
||||
import { BondInfo } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { Dropdown, InputAddress, InputBalance, Modal, Static } from '@polkadot/react-components';
|
||||
import { BalanceFree, BlockToTime } from '@polkadot/react-query';
|
||||
import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
@ -16,7 +16,7 @@ import { BN_ZERO } from '@polkadot/util';
|
||||
import { useTranslation } from '../../translate';
|
||||
import InputValidateAmount from '../Account/InputValidateAmount';
|
||||
import InputValidationController from '../Account/InputValidationController';
|
||||
import { rewardDestinationOptionsPrev } from '../constants';
|
||||
import { createDestPrev } from '../destOptions';
|
||||
import useUnbondDuration from '../useUnbondDuration';
|
||||
|
||||
interface Props {
|
||||
@ -37,6 +37,11 @@ function Bond ({ className = '', onChange }: Props): React.ReactElement<Props> {
|
||||
const stashBalance = useCall<DeriveBalancesAll>(api.derive.balances.all, [stashId]);
|
||||
const bondedBlocks = useUnbondDuration();
|
||||
|
||||
const options = useMemo(
|
||||
() => createDestPrev(t),
|
||||
[t]
|
||||
);
|
||||
|
||||
const _setError = useCallback(
|
||||
// eslint-disable-next-line handle-callback-err
|
||||
(error: string | null, isFatal: boolean) => setControllerError(isFatal),
|
||||
@ -150,7 +155,7 @@ function Bond ({ className = '', onChange }: Props): React.ReactElement<Props> {
|
||||
help={t<string>('The destination account for any payments as either a nominator or validator')}
|
||||
label={t<string>('payment destination')}
|
||||
onChange={setDestination}
|
||||
options={rewardDestinationOptionsPrev}
|
||||
options={options}
|
||||
value={destination}
|
||||
/>
|
||||
</Modal.Column>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user