vega-frontend-monorepo/apps/token/src/routes/claim/complete.tsx
botond 3a27172e04
feat(#175): ui-toolkit links (#453)
* feat: add enviromnemt provider to the ui-toolkit

* chore: replace etherscan links

* chore: wrap trading app into environment provider

* chore: move env provider to react-helpers and wrap every app

* chore: remove more env variables from libs and replace them with the env hook

* fix: lint

* fix: update readme with correct formatting command

* fix: warnings for web3 hook

* fix: wrap warning in conditional, print message only when env keys are missing

* fix: incorrect condition on deposit manager fauceting param

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>

* fix: cleanup token app ethereum config

* chore: add better error handling to the useEnvironment hook

* fix: lint

* fix: formatting

* fix: more lint

* fix: throw error if required env variables are missing

* fix: remove default eth chain id

* fix: add back etherscan testid to withdrawals links

* fix: imports

* fix: try using babel jest for smart contracts test transpilation

* fix: uniform ts syntax

* chore: set resolveJsonModule in base tsconfig

* fix: add missing data-ids for etherscan links

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2022-05-31 17:30:02 -07:00

63 lines
1.7 KiB
TypeScript

import { Callout, Intent, Link, Button } from '@vegaprotocol/ui-toolkit';
import { useEnvironment } from '@vegaprotocol/react-helpers';
import { Trans, useTranslation } from 'react-i18next';
import { Link as RouteLink } from 'react-router-dom';
import type { BigNumber } from '../../lib/bignumber';
import { formatNumber } from '../../lib/format-number';
import { Routes } from '../router-config';
export const Complete = ({
address,
balanceFormatted,
commitTxHash,
claimTxHash,
}: {
address: string;
balanceFormatted: BigNumber;
commitTxHash: string | null;
claimTxHash: string | null;
}) => {
const { ETHERSCAN_URL } = useEnvironment();
const { t } = useTranslation();
return (
<Callout intent={Intent.Success} title="Claim complete" iconName="tick">
<p>
<Trans
i18nKey="claimCompleteMessage"
values={{
address,
balance: formatNumber(balanceFormatted),
}}
/>
</p>
{commitTxHash && (
<p style={{ margin: 0 }}>
{t('Link transaction')}:{' '}
<Link
title={t('View transaction on Etherscan')}
href={`${ETHERSCAN_URL}/tx/${commitTxHash}`}
>
{commitTxHash}
</Link>
</p>
)}
{claimTxHash && (
<p>
{t('Claim transaction')}:{' '}
<Link
title={t('View transaction on Etherscan')}
href={`${ETHERSCAN_URL}/tx/${claimTxHash}`}
>
{claimTxHash}
</Link>
</p>
)}
<RouteLink to={Routes.VESTING}>
<Button className="fill">{t('Check your vesting VEGA tokens')}</Button>
</RouteLink>
</Callout>
);
};