aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/flash_messages/token_send_completed.tsx
blob: c4977d70b0dd6bfec1192c8ea7523d4243776fca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import * as React from 'react';
import * as _ from 'lodash';
import BigNumber from 'bignumber.js';
import {ZeroEx} from '0x.js';
import {Token} from 'ts/types';
import {utils} from 'ts/utils/utils';

interface TokenSendCompletedProps {
    etherScanLinkIfExists?: string;
    token: Token;
    toAddress: string;
    amountInBaseUnits: BigNumber;
}

interface TokenSendCompletedState {}

export class TokenSendCompleted extends React.Component<TokenSendCompletedProps, TokenSendCompletedState> {
    public render() {
        const etherScanLink = !_.isUndefined(this.props.etherScanLinkIfExists) &&
                            (
                                <a
                                    style={{color: 'white'}}
                                    href={`${this.props.etherScanLinkIfExists}`}
                                    target="_blank"
                                >
                                    Verify on Etherscan
                                </a>
                            );
        const amountInUnits = ZeroEx.toUnitAmount(this.props.amountInBaseUnits, this.props.token.decimals);
        const truncatedAddress = utils.getAddressBeginAndEnd(this.props.toAddress);
        return (
            <div>
                {`Sent ${amountInUnits} ${this.props.token.symbol} to ${truncatedAddress}: `}
                {etherScanLink}
            </div>
        );
    }
}