James Prado 816ce3180f Translation Updates (#1323)
* Update account view routing

* Temporarily add unicode character to translated strings for testing

* Temporarily select add unicode to all untranslated strings

* Format changes

* Add all english translations for /account & /generate

* Add the rest of the english translations

* Add a few more missing translations

* Update en translations

* Get selectedLanguage from localstorage instead of redux sttate

* Update snapshots

* Add missing translation keys & Update translate functs & change variable prefix

* translate all markdown strings & remove old translation strings

* Update snapshot

* Add a few more translation strs

* Move raw strings being translated into json

* All translation keys are now Uppercase

* Fix up the last few translations

* Update snapshot

* Uppercase de translation strings

* Bring back shapeshift logo on swap

* Fix contracts tab translations

* Fix a few more translations

* Fix translations

* remove debugging stuff

* Update snapshots

* Use react.fragment as markdown root renderer

* Seperate markdown translations into their own function

* Clean up translation functions

* Clean up translation functions

* Update snapshot

* Fix some broken translation strings

* Add prettier ignore file
2018-03-21 22:50:25 -05:00

106 lines
3.4 KiB
TypeScript

import React, { Component } from 'react';
import { AmountFieldFactory } from 'components/AmountFieldFactory';
import { AddressFieldFactory } from 'components/AddressFieldFactory';
import { connect } from 'react-redux';
import { AppState } from 'reducers';
import { GenerateTransaction, SendButton, SigningStatus, TXMetaDataPanel } from 'components';
import { resetWallet, TResetWallet } from 'actions/wallet';
import translate from 'translations';
import { getUnit } from 'selectors/transaction';
import { getCurrentBalance } from 'selectors/wallet';
import Spinner from 'components/ui/Spinner';
import { Wei, TokenValue } from 'libs/units';
import { Input } from 'components/ui';
interface StateProps {
unit: string;
resetWallet: TResetWallet;
currentBalance: Wei | TokenValue | null;
}
type Props = StateProps;
class FieldsClass extends Component<Props> {
public render() {
const { currentBalance } = this.props;
return (
<div className="Tab-content-pane">
<div className="row form-group">
<div className="col-xs-12">
<button
className="Deploy-field-reset btn btn-default btn-sm"
onClick={this.changeWallet}
>
<i className="fa fa-refresh" />
{translate('CHANGE_WALLET')}
</button>
</div>
<div className="col-xs-12">
<AddressFieldFactory
withProps={({ currentTo }) => (
<Input type="text" value={currentTo.raw} readOnly={true} />
)}
/>
</div>
<div className="col-xs-1" />
</div>
<div className="row form-group">
<div className="col-xs-12">
<label>{translate('SEND_AMOUNT')}</label>
{currentBalance === null ? (
<div className="row text-center">
<Spinner />
</div>
) : (
<AmountFieldFactory
withProps={({ currentValue, isValid }) => (
<React.Fragment>
{!isValid && (
<h5 style={{ color: 'red' }}>{translate('INSUFFICIENT_FUNDS')}</h5>
)}
{isValid && (
<Input
type="text"
value={`${currentValue.raw} ${this.props.unit}`}
readOnly={true}
/>
)}
</React.Fragment>
)}
/>
)}
</div>
</div>
<div className="row form-group">
<div className="col-xs-12">
<TXMetaDataPanel initialState={'simple'} disableToggle={true} />
</div>
</div>
<SigningStatus />
<div className="row form-group">
<div className="col-xs-12 clearfix">
{currentBalance === null ? (
<div className="row text-center">
<Spinner />
</div>
) : (
<GenerateTransaction />
)}
</div>
</div>
<div className="row form-group">
<SendButton />
</div>
</div>
);
}
private changeWallet = () => {
this.props.resetWallet();
};
}
export const Fields = connect(
(state: AppState) => ({ unit: getUnit(state), currentBalance: getCurrentBalance(state) }),
{ resetWallet }
)(FieldsClass);