William O'Beirne bdaf40a0ce Send Form Style Adjustments (#1368)
* Remove title from account, tighten buttons and subtabs.

* Send everything button in input.

* Request tx to full width, adjust transaction fee spacing.

* Fix token balances button spacing.

* Fix address identicon flying offscreen. Tighten up identicon, show border even when theres no identicon.

* Add isSelfAddress boolean to AddressField, use it on WalletInfo tab.

* Use short amount again.

* Unused
2018-03-22 13:30:51 -05:00

49 lines
1.5 KiB
TypeScript

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Query } from 'components/renderCbs';
import { Tooltip } from 'components/ui';
import { TokenValue, Wei } from 'libs/units';
import translate, { translateRaw } from 'translations';
import { sendEverythingRequested, TSendEverythingRequested } from 'actions/transaction';
import { getCurrentBalance } from 'selectors/wallet';
import { AppState } from 'reducers';
import './SendEverything.scss';
interface DispatchProps {
sendEverythingRequested: TSendEverythingRequested;
}
interface StateProps {
currentBalance: Wei | TokenValue | null;
}
type Props = StateProps & DispatchProps;
class SendEverythingClass extends Component<Props> {
public render() {
const { currentBalance } = this.props;
return (
<Query
params={['readOnly']}
withQuery={({ readOnly }) => (
<button
className="SendEverything"
disabled={!!readOnly || !currentBalance}
onClick={this.onSendEverything}
aria-label={translateRaw('SEND_TRANSFERTOTAL')}
>
<i className="SendEverything-icon fa fa-angle-double-up" />
<Tooltip>{translate('SEND_TRANSFERTOTAL')}</Tooltip>
</button>
)}
/>
);
}
private onSendEverything = () => {
this.props.sendEverythingRequested();
};
}
export const SendEverything = connect(
(state: AppState) => ({ currentBalance: getCurrentBalance(state) }),
{ sendEverythingRequested }
)(SendEverythingClass);