feat: info about test network in transaction dialogs (#1830)
* feat: info about test network in transaction dialogs * feat: info about test network in transaction dialogs * feat: info about test network in transaction dialogs * feat: info about test network in transaction dialogs - add unit test * feat: info about test network in transaction dialogs - add unit test * feat: info about test network in transaction dialogs - add unit test * feat: info about test network in transaction dialogs - add unit test Co-authored-by: maciek <maciek@vegaprotocol.io>
This commit is contained in:
parent
6dded8c2d2
commit
da726ea439
@ -7,7 +7,12 @@ import { VegaTransactionDialog } from './vega-transaction-dialog';
|
||||
jest.mock('@vegaprotocol/environment', () => ({
|
||||
useEnvironment: () => ({
|
||||
VEGA_EXPLORER_URL: 'https://test.explorer.vega.network',
|
||||
VEGA_ENV: 'TESTNET',
|
||||
}),
|
||||
Networks: {
|
||||
MAINNET: 'MAINNET',
|
||||
TESTNET: 'TESTNET',
|
||||
},
|
||||
}));
|
||||
|
||||
describe('VegaTransactionDialog', () => {
|
||||
@ -33,6 +38,9 @@ describe('VegaTransactionDialog', () => {
|
||||
expect(screen.getByTestId(VegaTxStatus.Requested)).toHaveTextContent(
|
||||
/please open your wallet/i
|
||||
);
|
||||
expect(screen.getByTestId('testnet-transaction-info')).toHaveTextContent(
|
||||
/^\[This is TESTNET transaction only\]$/
|
||||
);
|
||||
});
|
||||
|
||||
it('pending', () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useEnvironment } from '@vegaprotocol/environment';
|
||||
import { Networks, useEnvironment } from '@vegaprotocol/environment';
|
||||
import { t } from '@vegaprotocol/react-helpers';
|
||||
import { Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit';
|
||||
import type { ReactNode } from 'react';
|
||||
@ -58,16 +58,23 @@ interface VegaDialogProps {
|
||||
* Default dialog content
|
||||
*/
|
||||
export const VegaDialog = ({ transaction }: VegaDialogProps) => {
|
||||
const { VEGA_EXPLORER_URL } = useEnvironment();
|
||||
const { VEGA_EXPLORER_URL, VEGA_ENV } = useEnvironment();
|
||||
|
||||
let content = null;
|
||||
if (transaction.status === VegaTxStatus.Requested) {
|
||||
content = (
|
||||
<p data-testid={transaction.status}>
|
||||
{t(
|
||||
'Please open your wallet application and confirm or reject the transaction'
|
||||
<>
|
||||
<p data-testid={transaction.status}>
|
||||
{t(
|
||||
'Please open your wallet application and confirm or reject the transaction'
|
||||
)}
|
||||
</p>
|
||||
{VEGA_ENV !== Networks.MAINNET && (
|
||||
<p data-testid="testnet-transaction-info">
|
||||
{t('[This is %s transaction only]').replace('%s', VEGA_ENV)}
|
||||
</p>
|
||||
)}
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user