Skip to content

Commit

Permalink
fix: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaryatrh committed Nov 25, 2024
1 parent 8bcd777 commit 6bf88e9
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 21 deletions.
2 changes: 1 addition & 1 deletion ui/components/app/app-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
@import 'name/index';
@import 'name/name-details/index';
@import 'confirm/info/row/index';
// @import 'transaction-failed-modal/index';
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
@import '../institutional/interactive-replacement-token-notification/index';
@import '../institutional/confirm-remove-jwt-modal/index';
@import '../institutional/custody-confirm-link-modal/index';
@import '../institutional/transaction-failed-modal/index';
///: END:ONLY_INCLUDE_IF
@import 'snaps/snap-insight/index';
2 changes: 1 addition & 1 deletion ui/components/app/modals/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
@import 'transaction-confirmed/index';
@import 'customize-nonce/index';
@import 'convert-token-to-nft-modal/index';
@import 'transaction-failed-modal/index';
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
@import '../../institutional/confirm-remove-jwt-modal/index';
@import '../../institutional/custody-confirm-link-modal/index';
@import '../../institutional/transaction-failed-modal/index';
///: END:ONLY_INCLUDE_IF

.modal {
Expand Down
15 changes: 8 additions & 7 deletions ui/components/app/modals/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { mmiActionsFactory } from '../../../store/institutional/institution-back
import ConfirmRemoveJWT from '../../institutional/confirm-remove-jwt-modal';
import CustodyConfirmLink from '../../institutional/custody-confirm-link-modal';
import InteractiveReplacementTokenModal from '../../institutional/interactive-replacement-token-modal';
import TransactionFailed from '../../institutional/transaction-failed-modal';
///: END:ONLY_INCLUDE_IF
import TransactionFailed from './transaction-failed-modal';
import HideTokenConfirmationModal from './hide-token-confirmation-modal';
import QRScanner from './qr-scanner';

Expand Down Expand Up @@ -274,9 +274,9 @@ const MODALS = {
},
},

///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
CONFIRM_REMOVE_JWT: {
contents: <ConfirmRemoveJWT />,
TRANSACTION_FAILED: {
disableBackdropClick: true,
contents: <TransactionFailed />,
mobileModalStyle: {
...modalContainerMobileStyle,
},
Expand All @@ -288,9 +288,9 @@ const MODALS = {
},
},

TRANSACTION_FAILED: {
disableBackdropClick: true,
contents: <TransactionFailed />,
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
CONFIRM_REMOVE_JWT: {
contents: <ConfirmRemoveJWT />,
mobileModalStyle: {
...modalContainerMobileStyle,
},
Expand Down Expand Up @@ -422,6 +422,7 @@ class Modal extends Component {

render() {
const modal = MODALS[this.props.modalState.name || 'DEFAULT'];
debugger;
const { contents: children, disableBackdropClick = false, testId } = modal;
const modalStyle =
modal[isMobileView() ? 'mobileModalStyle' : 'laptopModalStyle'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import { screen, fireEvent } from '@testing-library/react';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { renderWithProvider } from '../../../../test/lib/render-helpers';
import testData from '../../../../.storybook/test-data';
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
import testData from '../../../../../.storybook/test-data';
import TransactionFailed from '.';

const mockErrorMessage = 'Something went wrong';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { memo } from 'react';
import withModalProps from '../../../helpers/higher-order-components/with-modal-props';
import { useI18nContext } from '../../../hooks/useI18nContext';
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props';
import { useI18nContext } from '../../../../hooks/useI18nContext';
import {
AlignItems,
BorderRadius,
Display,
FlexDirection,
TextAlign,
TextVariant,
} from '../../../helpers/constants/design-system';
} from '../../../../helpers/constants/design-system';
import {
Icon,
IconName,
Expand All @@ -22,7 +22,7 @@ import {
ButtonSize,
ModalContent,
ModalHeader,
} from '../../component-library';
} from '../../../component-library';

type TransactionFailedModalProps = {
hideModal: () => void;
Expand All @@ -37,6 +37,7 @@ const TransactionFailedModal: React.FC<TransactionFailedModalProps> = ({
operationFailed,
errorMessage,
}) => {
debugger;
const t = useI18nContext();

const handleSubmit = () => {
Expand Down
24 changes: 18 additions & 6 deletions ui/pages/confirmations/hooks/useTransactionFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import {
createCancelTransaction,
createSpeedUpTransaction,
showModal,
updateCustomSwapsEIP1559GasParams,
updatePreviousGasParams,
updateSwapsUserFeeLevel,
Expand Down Expand Up @@ -153,12 +154,23 @@ export const useTransactionFunctions = ({
);
}, [dispatch, estimatedBaseFee, transaction]);

const speedUpTransaction = useCallback(() => {
dispatch(
createSpeedUpTransaction(transaction.id, transaction.txParams, {
estimatedBaseFee,
}),
);
const speedUpTransaction = useCallback(async () => {
try {
await dispatch(
createSpeedUpTransaction(transaction.id, transaction.txParams, {
estimatedBaseFee,
}),
);
} catch (error) {
dispatch(
showModal({
name: 'TRANSACTION_FAILED',
errorMessage: error?.message,
closeNotification: true,
}),
);
console.log('================> error inside speedUpTransaction', error);
}
}, [dispatch, estimatedBaseFee, transaction]);

const updateTransactionToTenPercentIncreasedGasFee = useCallback(
Expand Down

0 comments on commit 6bf88e9

Please sign in to comment.