diff --git a/ui/components/app/app-components.scss b/ui/components/app/app-components.scss index b59623b29279..01ebea13aeba 100644 --- a/ui/components/app/app-components.scss +++ b/ui/components/app/app-components.scss @@ -103,4 +103,5 @@ @import 'detected-token/detected-token-selection-popover/index'; @import 'network-account-balance-header/index'; @import 'approve-content-card/index'; -@import 'transaction-alerts/transaction-alerts' +@import 'transaction-alerts/transaction-alerts'; +@import 'navigation/index'; diff --git a/ui/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js b/ui/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js index c9905efc8e79..4acb8f2c70f4 100755 --- a/ui/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js +++ b/ui/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js @@ -1,31 +1,23 @@ -import React, { useContext } from 'react'; +import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { useHistory, useParams } from 'react-router-dom'; +import { useHistory } from 'react-router-dom'; import { getCurrentChainId, getUnapprovedTransactions, - unconfirmedMessagesHashSelector, } from '../../../../selectors'; import { transactionMatchesNetwork } from '../../../../../shared/modules/transaction.utils'; -import { I18nContext } from '../../../../contexts/i18n'; -import { - CONFIRM_TRANSACTION_ROUTE, - SIGNATURE_REQUEST_PATH, -} from '../../../../helpers/constants/routes'; +import { CONFIRM_TRANSACTION_ROUTE } from '../../../../helpers/constants/routes'; import { clearConfirmTransaction } from '../../../../ducks/confirm-transaction/confirm-transaction.duck'; import { hexToDecimal } from '../../../../../shared/lib/metamask-controller-utils'; +import Navigation from '../../navigation'; const ConfirmPageContainerNavigation = () => { - const t = useContext(I18nContext); const dispatch = useDispatch(); const history = useHistory(); - const { id } = useParams(); const unapprovedTxs = useSelector(getUnapprovedTransactions); - const unconfirmedMessages = useSelector(unconfirmedMessagesHashSelector); const currentChainId = useSelector(getCurrentChainId); const network = hexToDecimal(currentChainId); - const isUnapprovedTxsEmpty = Object.keys(unapprovedTxs).length === 0; const currentNetworkUnapprovedTxs = Object.keys(unapprovedTxs) .filter((key) => @@ -33,90 +25,20 @@ const ConfirmPageContainerNavigation = () => { ) .reduce((acc, key) => ({ ...acc, [key]: unapprovedTxs[key] }), {}); - const enumUnapprovedTxs = Object.keys( - isUnapprovedTxsEmpty ? unconfirmedMessages : currentNetworkUnapprovedTxs, - ); - - const currentPosition = enumUnapprovedTxs.indexOf(id); - - const totalTx = enumUnapprovedTxs.length; - const positionOfCurrentTx = currentPosition + 1; - const nextTxId = enumUnapprovedTxs[currentPosition + 1]; - const prevTxId = enumUnapprovedTxs[currentPosition - 1]; - const showNavigation = enumUnapprovedTxs.length > 1; - const firstTx = enumUnapprovedTxs[0]; - const lastTx = enumUnapprovedTxs[enumUnapprovedTxs.length - 1]; + const enumUnapprovedTxs = Object.keys(currentNetworkUnapprovedTxs); const onNextTx = (txId) => { if (txId) { dispatch(clearConfirmTransaction()); - history.push( - isUnapprovedTxsEmpty - ? `${CONFIRM_TRANSACTION_ROUTE}/${txId}${SIGNATURE_REQUEST_PATH}` - : `${CONFIRM_TRANSACTION_ROUTE}/${txId}`, - ); + history.push(`${CONFIRM_TRANSACTION_ROUTE}/${txId}`); } }; return ( -