diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index f8840e320..8c8570eda 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -422,6 +422,14 @@ "cancelSpeedUp": { "message": "cancel or speed up a tranaction." }, + "cancelSpeedUpLabel": { + "message": "This gas fee will $1 the original.", + "description": "$1 is text 'replace' in bold" + }, + "cancelSpeedUpTransactionTooltip": { + "message": "To $1 a transaction the gas fee must be increased by at least 10% for it to be recognized by the network.", + "description": "$1 is string 'cancel' or 'speed up'" + }, "cancellationGasFee": { "message": "Cancellation Gas Fee" }, @@ -739,6 +747,10 @@ "directDepositEtherExplainer": { "message": "If you already have some Ether, the quickest way to get Ether in your new wallet by direct deposit." }, + "disabledGasOptionToolTipMessage": { + "message": "“$1” is disabled because it does not meet the minimum of a 10% increase from the original gas fee.", + "description": "$1 is gas estimate type which can be market or aggressive" + }, "disconnect": { "message": "Disconnect" }, @@ -793,6 +805,9 @@ "editAddressNickname": { "message": "Edit address nickname" }, + "editCancellationGasFeeModalTitle": { + "message": "Edit cancellation gas fee" + }, "editContact": { "message": "Edit Contact" }, @@ -921,6 +936,9 @@ "editPermission": { "message": "Edit Permission" }, + "editSpeedUpEditGasFeeModalTitle": { + "message": "Edit speed up gas fee" + }, "enableAutoDetect": { "message": " Enable Autodetect" }, @@ -1157,6 +1175,9 @@ "functionType": { "message": "Function Type" }, + "gas": { + "message": "Gas" + }, "gasDisplayAcknowledgeDappButtonText": { "message": "Edit suggested gas fee" }, @@ -1709,6 +1730,15 @@ "metametricsTitle": { "message": "Join 6M+ users to improve MetaMask" }, + "minimum": { + "message": "minimum" + }, + "minimumCancelSpeedupGasFee": { + "message": "+10%" + }, + "minimumEstimate": { + "message": "10% Minimum" + }, "mismatchedChain": { "message": "The network details for this chain ID do not match our records. We recommend that you $1 before proceeding.", "description": "$1 is a clickable link with text defined by the 'mismatchedChainLinkText' key" @@ -2289,6 +2319,9 @@ "removeNFT": { "message": "Remove NFT" }, + "replace": { + "message": "replace" + }, "requestsAwaitingAcknowledgement": { "message": "requests waiting to be acknowledged" }, @@ -3169,9 +3202,6 @@ "transactionDetailGasHeading": { "message": "Estimated gas fee" }, - "transactionDetailGasHeadingV2": { - "message": "Gas" - }, "transactionDetailGasInfoV2": { "message": "estimated" }, diff --git a/shared/constants/gas.js b/shared/constants/gas.js index 01d490960..1663d6a0d 100644 --- a/shared/constants/gas.js +++ b/shared/constants/gas.js @@ -34,6 +34,7 @@ export const GAS_RECOMMENDATIONS = { * These represent types of gas estimation */ export const PRIORITY_LEVELS = { + MINIMUM: 'minimum', LOW: 'low', MEDIUM: 'medium', HIGH: 'high', diff --git a/shared/modules/conversion.utils.js b/shared/modules/conversion.utils.js index 1fdc87e60..1663712d9 100644 --- a/shared/modules/conversion.utils.js +++ b/shared/modules/conversion.utils.js @@ -120,7 +120,7 @@ const converter = ({ convertedValue = toSpecifiedDenomination[toDenomination](convertedValue); } - if (numberOfDecimals) { + if (numberOfDecimals !== undefined && numberOfDecimals !== null) { convertedValue = convertedValue.round( numberOfDecimals, BigNumber.ROUND_HALF_DOWN, diff --git a/test/data/mock-state.json b/test/data/mock-state.json index 9adeaea9b..cc5bfc51b 100644 --- a/test/data/mock-state.json +++ b/test/data/mock-state.json @@ -1,5 +1,6 @@ { "appState": { + "isLoading": false, "gasIsLoading": false, "currentView": { "name": "accountDetail", diff --git a/ui/components/app/advanced-gas-fee-popover/advanced-gas-fee-popover.js b/ui/components/app/advanced-gas-fee-popover/advanced-gas-fee-popover.js index 65eae89a3..b49954db2 100644 --- a/ui/components/app/advanced-gas-fee-popover/advanced-gas-fee-popover.js +++ b/ui/components/app/advanced-gas-fee-popover/advanced-gas-fee-popover.js @@ -14,8 +14,8 @@ import AdvancedGasFeeDefaults from './advanced-gas-fee-defaults'; const AdvancedGasFeePopover = () => { const t = useI18nContext(); const { - closeModal, closeAllModals, + closeModal, currentModal, } = useTransactionModalContext(); diff --git a/ui/components/app/app-components.scss b/ui/components/app/app-components.scss index 079337c45..87e0b8921 100644 --- a/ui/components/app/app-components.scss +++ b/ui/components/app/app-components.scss @@ -1,11 +1,13 @@ /** Please import your files in alphabetical order **/ @import 'account-list-item/index'; @import 'account-menu/index'; +@import 'app-loading-spinner/index'; @import 'import-token-link/index'; @import 'advanced-gas-controls/index'; @import 'alerts/alerts'; @import 'app-header/index'; @import 'asset-list-item/asset-list-item'; +@import 'cancel-speedup-popover/index'; @import 'confirm-page-container/index'; @import 'collectibles-items/index'; @import 'collectibles-tab/index'; @@ -28,6 +30,8 @@ @import 'gas-customization/gas-modal-page-container/index'; @import 'gas-customization/gas-price-button-group/index'; @import 'gas-customization/index'; +@import 'gas-details-item/index'; +@import 'gas-details-item/gas-details-item-title/index'; @import 'gas-timing/index'; @import 'home-notification/index'; @import 'info-box/index'; diff --git a/ui/components/app/app-loading-spinner/app-loading-spinner.js b/ui/components/app/app-loading-spinner/app-loading-spinner.js new file mode 100644 index 000000000..e40ed3a5b --- /dev/null +++ b/ui/components/app/app-loading-spinner/app-loading-spinner.js @@ -0,0 +1,30 @@ +import { useSelector } from 'react-redux'; +import PropTypes from 'prop-types'; +import React from 'react'; + +import { getAppIsLoading } from '../../../selectors'; +import Spinner from '../../ui/spinner'; + +const AppLoadingSpinner = ({ className }) => { + const appIsLoading = useSelector(getAppIsLoading); + + if (!appIsLoading) { + return null; + } + + return ( +