Skip to content

Commit af597c5

Browse files
chore: removing error message and adding story for vrt
1 parent a8023a3 commit af597c5

File tree

10 files changed

+110
-157
lines changed

10 files changed

+110
-157
lines changed

ui/components/ui/error-message/__snapshots__/error-message.component.test.js.snap

Lines changed: 0 additions & 37 deletions
This file was deleted.

ui/components/ui/error-message/error-message.component.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

ui/components/ui/error-message/error-message.component.test.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

ui/components/ui/error-message/error-message.stories.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

ui/components/ui/error-message/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

ui/components/ui/error-message/index.scss

Lines changed: 0 additions & 19 deletions
This file was deleted.

ui/components/ui/ui-components.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
@import 'definition-list/definition-list';
1515
@import 'dialog/dialog';
1616
@import 'dropdown/dropdown';
17-
@import 'error-message/index';
1817
@import 'icon-border/icon-border';
1918
@import 'icon-button/icon-button';
2019
@import 'icon-with-fallback/icon-with-fallback';

ui/pages/confirmations/components/edit-gas-fee-popover/edit-gas-fee-popover.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ import {
77
import { useI18nContext } from '../../../../hooks/useI18nContext';
88
import { useTransactionModalContext } from '../../../../contexts/transaction-modal';
99
import Box from '../../../../components/ui/box';
10-
import ErrorMessage from '../../../../components/ui/error-message';
1110
import Popover from '../../../../components/ui/popover';
1211

1312
import {
1413
TextColor,
1514
TextVariant,
1615
} from '../../../../helpers/constants/design-system';
17-
import { INSUFFICIENT_FUNDS_ERROR_KEY } from '../../../../helpers/constants/error-keys';
1816
import { useGasFeeContext } from '../../../../contexts/gasFee';
1917
import AppLoadingSpinner from '../../../../components/app/app-loading-spinner';
2018
import ZENDESK_URLS from '../../../../helpers/constants/zendesk-url';
21-
import { Text } from '../../../../components/component-library';
19+
import {
20+
BannerAlert,
21+
BannerAlertSeverity,
22+
Text,
23+
} from '../../../../components/component-library';
2224
import EditGasItem from './edit-gas-item';
2325
import NetworkStatistics from './network-statistics';
2426

@@ -55,7 +57,11 @@ const EditGasFeePopover = () => {
5557
<div className="edit-gas-fee-popover__content">
5658
<Box>
5759
{balanceError && (
58-
<ErrorMessage errorKey={INSUFFICIENT_FUNDS_ERROR_KEY} />
60+
<BannerAlert
61+
severity={BannerAlertSeverity.Danger}
62+
description={t('insufficientFunds')}
63+
marginBottom={6}
64+
/>
5965
)}
6066
<div className="edit-gas-fee-popover__content__header">
6167
<span className="edit-gas-fee-popover__content__header-option">
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import React from 'react';
2+
import { Provider } from 'react-redux';
3+
import mockState from '../../../../../test/data/mock-state.json';
4+
import configureStore from '../../../../store/store';
5+
import { GasFeeContextProvider } from '../../../../contexts/gasFee';
6+
import { TransactionModalContext } from '../../../../contexts/transaction-modal';
7+
import {
8+
EditGasModes,
9+
PriorityLevels,
10+
} from '../../../../../shared/constants/gas';
11+
import { decGWEIToHexWEI } from '../../../../../shared/modules/conversion.utils';
12+
import EditGasFeePopover from './edit-gas-fee-popover';
13+
14+
const store = configureStore({
15+
...mockState,
16+
metamask: {
17+
...mockState.metamask,
18+
featureFlags: {
19+
...mockState.metamask.featureFlags,
20+
advancedInlineGas: true,
21+
},
22+
},
23+
});
24+
25+
// Custom TransactionModalContextProvider that sets editGasFee as current modal
26+
const MockTransactionModalProvider = ({ children }) => {
27+
return (
28+
<TransactionModalContext.Provider
29+
value={{
30+
closeModal: () => {},
31+
closeAllModals: () => {},
32+
currentModal: 'editGasFee',
33+
openModal: () => {},
34+
openModalCount: 1,
35+
}}
36+
>
37+
{children}
38+
</TransactionModalContext.Provider>
39+
);
40+
};
41+
42+
const createTransaction = (editGasMode = EditGasModes.modifyInPlace) => ({
43+
userFeeLevel: PriorityLevels.medium,
44+
txParams: {
45+
maxFeePerGas: decGWEIToHexWEI('70'),
46+
maxPriorityFeePerGas: decGWEIToHexWEI('7'),
47+
gas: '0x5208',
48+
gasPrice: decGWEIToHexWEI('50'),
49+
type: '0x2',
50+
from: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc',
51+
to: '0xc42edfcc21ed14dda456aa0756c153f7985d8813',
52+
},
53+
chainId: '0x5', // Use Goerli from mock state
54+
editGasMode,
55+
});
56+
57+
export default {
58+
title: 'Pages/Confirmations/Components/EditGasFeePopover',
59+
component: EditGasFeePopover,
60+
decorators: [
61+
(Story, { args }) => (
62+
<Provider store={store}>
63+
<MockTransactionModalProvider>
64+
<GasFeeContextProvider
65+
transaction={createTransaction(args.editGasMode)}
66+
editGasMode={args.editGasMode}
67+
balanceError={args.balanceError}
68+
>
69+
<div style={{ width: '400px', height: '600px' }}>
70+
<Story />
71+
</div>
72+
</GasFeeContextProvider>
73+
</MockTransactionModalProvider>
74+
</Provider>
75+
),
76+
],
77+
argTypes: {
78+
editGasMode: {
79+
control: { type: 'select' },
80+
options: [
81+
EditGasModes.modifyInPlace,
82+
EditGasModes.swaps,
83+
EditGasModes.speedUp,
84+
EditGasModes.cancel,
85+
],
86+
description: 'The mode for editing gas fees',
87+
},
88+
balanceError: {
89+
control: { type: 'boolean' },
90+
description: 'Whether to show insufficient funds error',
91+
},
92+
},
93+
};
94+
95+
export const Default = {
96+
args: {
97+
editGasMode: EditGasModes.modifyInPlace,
98+
balanceError: false,
99+
},
100+
};

ui/pages/confirmations/components/edit-gas-fee-popover/index.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
justify-content: space-between;
1414
padding: 16px 12px;
1515

16-
& .error-message {
17-
margin-top: 0;
18-
margin-bottom: 12px;
19-
}
20-
2116
&__header {
2217
color: var(--color-text-alternative);
2318
font-size: 10px;

0 commit comments

Comments
 (0)