diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 8d1ed215aa92..d24ffacd5792 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "Anmelden mit" }, - "simulationDetailsFailed": { - "message": "Es ist ein Fehler beim Laden Ihrer Schätzung aufgetreten." - }, "simulationDetailsFiatNotAvailable": { "message": "Nicht verfügbar" }, "simulationDetailsIncomingHeading": { "message": "Sie erhalten" }, - "simulationDetailsNoBalanceChanges": { - "message": "Keine Änderungen für Ihre Wallet prognostiziert." - }, "simulationDetailsOutgoingHeading": { "message": "Sie senden" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index 7ccc23b123bb..8c66f5386359 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "Σύνδεση με" }, - "simulationDetailsFailed": { - "message": "Υπήρξε σφάλμα στη φόρτωση της εκτίμησής σας." - }, "simulationDetailsFiatNotAvailable": { "message": "Μη διαθέσιμο" }, "simulationDetailsIncomingHeading": { "message": "Λαμβάνετε" }, - "simulationDetailsNoBalanceChanges": { - "message": "Δεν προβλέπονται αλλαγές για το πορτοφόλι σας" - }, "simulationDetailsOutgoingHeading": { "message": "Στέλνετε" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index b36f3ffcdb4e..788a08991e0c 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -4939,17 +4939,14 @@ "simulationDetailsERC20ApproveDesc": { "message": "You're giving someone else permission to spend this amount from your account." }, - "simulationDetailsFailed": { - "message": "There was an error loading your estimation." - }, "simulationDetailsFiatNotAvailable": { "message": "Not Available" }, "simulationDetailsIncomingHeading": { "message": "You receive" }, - "simulationDetailsNoBalanceChanges": { - "message": "No changes predicted for your wallet" + "simulationDetailsNoChanges": { + "message": "No changes" }, "simulationDetailsOutgoingHeading": { "message": "You send" @@ -4973,6 +4970,9 @@ "simulationDetailsTransactionReverted": { "message": "This transaction is likely to fail" }, + "simulationDetailsUnavailable": { + "message": "Unavailable" + }, "simulationErrorMessageV2": { "message": "We were not able to estimate gas. There might be an error in the contract and this transaction may fail." }, diff --git a/app/_locales/en_GB/messages.json b/app/_locales/en_GB/messages.json index fc635e33a708..015482467b7d 100644 --- a/app/_locales/en_GB/messages.json +++ b/app/_locales/en_GB/messages.json @@ -4714,18 +4714,12 @@ "signingInWith": { "message": "Signing in with" }, - "simulationDetailsFailed": { - "message": "There was an error loading your estimation." - }, "simulationDetailsFiatNotAvailable": { "message": "Not Available" }, "simulationDetailsIncomingHeading": { "message": "You receive" }, - "simulationDetailsNoBalanceChanges": { - "message": "No changes predicted for your wallet" - }, "simulationDetailsOutgoingHeading": { "message": "You send" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index a2578d1f4137..01b2d5caf18f 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -4559,18 +4559,12 @@ "signingInWith": { "message": "Iniciar sesión con" }, - "simulationDetailsFailed": { - "message": "Se produjo un error al cargar su estimación." - }, "simulationDetailsFiatNotAvailable": { "message": "No disponible" }, "simulationDetailsIncomingHeading": { "message": "Usted recibe" }, - "simulationDetailsNoBalanceChanges": { - "message": "No se prevén cambios para su monedero" - }, "simulationDetailsOutgoingHeading": { "message": "Envía" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index c3151d3ca53f..ced856ed9b71 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "Se connecter avec" }, - "simulationDetailsFailed": { - "message": "Une erreur s’est produite lors du chargement de l’estimation." - }, "simulationDetailsFiatNotAvailable": { "message": "Non disponible" }, "simulationDetailsIncomingHeading": { "message": "Vous recevez" }, - "simulationDetailsNoBalanceChanges": { - "message": "Aucun changement prévu pour votre portefeuille" - }, "simulationDetailsOutgoingHeading": { "message": "Vous envoyez" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index c69c7117d4d0..78dcaf5d0044 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "के साथ साइन इन करना" }, - "simulationDetailsFailed": { - "message": "आपका एस्टीमेशन लोड करने में गड़बड़ी हुई।" - }, "simulationDetailsFiatNotAvailable": { "message": "उपलब्ध नहीं है" }, "simulationDetailsIncomingHeading": { "message": "आप पाते हैं" }, - "simulationDetailsNoBalanceChanges": { - "message": "आपके वॉलेट के लिए किसी बदलाव का प्रेडिक्शन नहीं किया गया है" - }, "simulationDetailsOutgoingHeading": { "message": "आप भेजते हैं" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 53e7fd923fda..9f7ff15b4039 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "Masuk dengan" }, - "simulationDetailsFailed": { - "message": "Terjadi kesalahan saat memuat estimasi Anda." - }, "simulationDetailsFiatNotAvailable": { "message": "Tidak Tersedia" }, "simulationDetailsIncomingHeading": { "message": "Anda menerima" }, - "simulationDetailsNoBalanceChanges": { - "message": "Tidak ada perubahan yang terprediksi untuk dompet Anda" - }, "simulationDetailsOutgoingHeading": { "message": "Anda mengirim" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index c26ec67990b2..2f8fdc27874c 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "サインイン方法:" }, - "simulationDetailsFailed": { - "message": "予測結果の読み込み中にエラーが発生しました。" - }, "simulationDetailsFiatNotAvailable": { "message": "利用できません" }, "simulationDetailsIncomingHeading": { "message": "受取額" }, - "simulationDetailsNoBalanceChanges": { - "message": "ウォレット残高の増減は予測されていません" - }, "simulationDetailsOutgoingHeading": { "message": "送金額" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index ad4959a459b9..ef79fcd1d33b 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "다음으로 로그인:" }, - "simulationDetailsFailed": { - "message": "추정치를 불러오는 동안 오류가 발생했습니다." - }, "simulationDetailsFiatNotAvailable": { "message": "이용할 수 없음" }, "simulationDetailsIncomingHeading": { "message": "받음:" }, - "simulationDetailsNoBalanceChanges": { - "message": "지갑에 예상 변동 사항 없음" - }, "simulationDetailsOutgoingHeading": { "message": "보냄:" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index 7831e080500b..8755cf58219c 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "Assinando com" }, - "simulationDetailsFailed": { - "message": "Houve um erro ao carregar sua estimativa." - }, "simulationDetailsFiatNotAvailable": { "message": "Não disponível" }, "simulationDetailsIncomingHeading": { "message": "Você recebe" }, - "simulationDetailsNoBalanceChanges": { - "message": "Nenhuma alteração prevista para sua carteira" - }, "simulationDetailsOutgoingHeading": { "message": "Você envia" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index d32a603b367b..3fe6e377916e 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "Вход с помощью" }, - "simulationDetailsFailed": { - "message": "Не удалось загрузить прогноз." - }, "simulationDetailsFiatNotAvailable": { "message": "Недоступно" }, "simulationDetailsIncomingHeading": { "message": "Вы получаете" }, - "simulationDetailsNoBalanceChanges": { - "message": "Никаких изменений в вашем кошельке не прогнозируется" - }, "simulationDetailsOutgoingHeading": { "message": "Вы отправляете" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index 0c3675d78754..66b37bc3a770 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "Nagsa-sign in gamit ang" }, - "simulationDetailsFailed": { - "message": "Mayroong error sa pag-load ng iyong pagtataya." - }, "simulationDetailsFiatNotAvailable": { "message": "Hindi Available" }, "simulationDetailsIncomingHeading": { "message": "Natanggap mo" }, - "simulationDetailsNoBalanceChanges": { - "message": "Walang pagbabagong nahulaan para sa iyong wallet" - }, "simulationDetailsOutgoingHeading": { "message": "Nagpadala ka" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 253e00845388..fa0611c494d3 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "Şununla giriş yap:" }, - "simulationDetailsFailed": { - "message": "Tahmininiz yüklenirken bir hata oldu." - }, "simulationDetailsFiatNotAvailable": { "message": "Mevcut Değil" }, "simulationDetailsIncomingHeading": { "message": "Aldığınız" }, - "simulationDetailsNoBalanceChanges": { - "message": "Cüzdanınız için değişiklik öngörülmüyor" - }, "simulationDetailsOutgoingHeading": { "message": "Gönderdiğiniz" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 538108c0677d..d3ac6e695b5f 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "Đăng nhập bằng" }, - "simulationDetailsFailed": { - "message": "Đã xảy ra lỗi khi tải kết quả ước tính." - }, "simulationDetailsFiatNotAvailable": { "message": "Không có sẵn" }, "simulationDetailsIncomingHeading": { "message": "Bạn nhận được" }, - "simulationDetailsNoBalanceChanges": { - "message": "Ví của bạn dự kiến không có thay đổi nào" - }, "simulationDetailsOutgoingHeading": { "message": "Bạn gửi" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index d3a4af11220a..a93579debf0a 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -4562,18 +4562,12 @@ "signingInWith": { "message": "使用以下登录方式" }, - "simulationDetailsFailed": { - "message": "加载估算时出错。" - }, "simulationDetailsFiatNotAvailable": { "message": "不可用" }, "simulationDetailsIncomingHeading": { "message": "您收到" }, - "simulationDetailsNoBalanceChanges": { - "message": "预计您的钱包不会发生变化" - }, "simulationDetailsOutgoingHeading": { "message": "您发送" }, diff --git a/test/e2e/tests/simulation-details/simulation-details.spec.ts b/test/e2e/tests/simulation-details/simulation-details.spec.ts index 46f4cdb5860a..bbac41b5a1a1 100644 --- a/test/e2e/tests/simulation-details/simulation-details.spec.ts +++ b/test/e2e/tests/simulation-details/simulation-details.spec.ts @@ -215,7 +215,7 @@ describe('Simulation Details', () => { await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); await driver.findElement({ css: '[data-testid="simulation-details-layout"]', - text: 'No changes predicted for your wallet', + text: 'No changes', }); }, ); @@ -276,7 +276,7 @@ describe('Simulation Details', () => { await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); await driver.findElement({ css: '[data-testid="simulation-details-layout"]', - text: 'There was an error loading your estimation', + text: 'Unavailable', }); }, ); diff --git a/ui/pages/confirmations/components/confirm/info/personal-sign/personal-sign.tsx b/ui/pages/confirmations/components/confirm/info/personal-sign/personal-sign.tsx index 3199c3d108e0..45d14dcd3844 100644 --- a/ui/pages/confirmations/components/confirm/info/personal-sign/personal-sign.tsx +++ b/ui/pages/confirmations/components/confirm/info/personal-sign/personal-sign.tsx @@ -2,23 +2,41 @@ import React from 'react'; import { useSelector } from 'react-redux'; import { - ConfirmInfoRow, ConfirmInfoRowAddress, ConfirmInfoRowText, ConfirmInfoRowUrl, } from '../../../../../../components/app/confirm/info/row'; +import { ConfirmInfoAlertRow } from '../../../../../../components/app/confirm/info/row/alert-row/alert-row'; import { RowAlertKey } from '../../../../../../components/app/confirm/info/row/constants'; -import { useI18nContext } from '../../../../../../hooks/useI18nContext'; -import { useConfirmContext } from '../../../../context/confirm'; +import { ConfirmInfoSection } from '../../../../../../components/app/confirm/info/row/section'; +import { + Box, + Icon, + IconName, + IconSize, + Text, +} from '../../../../../../components/component-library'; +import Tooltip from '../../../../../../components/ui/tooltip'; +import { + AlignItems, + BorderColor, + BorderRadius, + Display, + FlexDirection, + IconColor, + JustifyContent, + TextColor, + TextVariant, +} from '../../../../../../helpers/constants/design-system'; import { hexToText, sanitizeString, } from '../../../../../../helpers/utils/util'; -import { SignatureRequestType } from '../../../../types/confirm'; +import { useI18nContext } from '../../../../../../hooks/useI18nContext'; +import { useConfirmContext } from '../../../../context/confirm'; import { selectUseTransactionSimulations } from '../../../../selectors/preferences'; +import { SignatureRequestType } from '../../../../types/confirm'; import { isSIWESignatureRequest } from '../../../../utils'; -import { ConfirmInfoAlertRow } from '../../../../../../components/app/confirm/info/row/alert-row/alert-row'; -import { ConfirmInfoSection } from '../../../../../../components/app/confirm/info/row/section'; import { SIWESignInfo } from './siwe-sign'; const PersonalSignInfo: React.FC = () => { @@ -43,12 +61,57 @@ const PersonalSignInfo: React.FC = () => { <> {isSIWE && useTransactionSimulations && ( - - - + + + + {t('simulationDetailsTitle')} + + + + + + + {t('simulationDetailsNoChanges')} + + + )} diff --git a/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx b/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx index 922a2e414916..7a91ba129d6b 100644 --- a/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx @@ -58,7 +58,6 @@ describe('FiatDisplay', () => { describe('IndividualFiatDisplay', () => { // @ts-expect-error This is missing from the Mocha type definitions it.each([ - [FIAT_UNAVAILABLE, 'Not Available'], [100, '$100'], [-100, '$100'], ])( @@ -84,8 +83,6 @@ describe('FiatDisplay', () => { describe('TotalFiatDisplay', () => { // @ts-expect-error This is missing from the Mocha type definitions it.each([ - [[FIAT_UNAVAILABLE, FIAT_UNAVAILABLE], 'Not Available'], - [[], 'Not Available'], [[100, 200, FIAT_UNAVAILABLE, 300], 'Total = $600'], [[-100, -200, FIAT_UNAVAILABLE, -300], 'Total = $600'], ])( diff --git a/ui/pages/confirmations/components/simulation-details/fiat-display.tsx b/ui/pages/confirmations/components/simulation-details/fiat-display.tsx index ac3fcebcc159..d7ec958f2a5b 100644 --- a/ui/pages/confirmations/components/simulation-details/fiat-display.tsx +++ b/ui/pages/confirmations/components/simulation-details/fiat-display.tsx @@ -50,7 +50,7 @@ export const IndividualFiatDisplay: React.FC<{ } if (fiatAmount === FIAT_UNAVAILABLE) { - return ; + return null; } const absFiat = Math.abs(fiatAmount); const fiatDisplayValue = fiatFormatter(absFiat, { shorten }); diff --git a/ui/pages/confirmations/components/simulation-details/simulation-details.test.tsx b/ui/pages/confirmations/components/simulation-details/simulation-details.test.tsx index 5971e513e3a1..1ee2941f1fd9 100644 --- a/ui/pages/confirmations/components/simulation-details/simulation-details.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/simulation-details.test.tsx @@ -84,17 +84,13 @@ describe('SimulationDetails', () => { renderSimulationDetails({ error: { message: 'Unknown error' }, }); - expect( - screen.getByText(/error loading your estimation/u), - ).toBeInTheDocument(); + expect(screen.getByText(/Unavailable/u)).toBeInTheDocument(); }); it('renders empty content when there are no balance changes', () => { renderSimulationDetails({}); - expect( - screen.getByText(/No changes predicted for your wallet/u), - ).toBeInTheDocument(); + expect(screen.getByText(/No changes/u)).toBeInTheDocument(); }); it('passes the correct properties to BalanceChangeList components', () => { diff --git a/ui/pages/confirmations/components/simulation-details/simulation-details.tsx b/ui/pages/confirmations/components/simulation-details/simulation-details.tsx index 79d5c2105a9c..dca32c77c3b1 100644 --- a/ui/pages/confirmations/components/simulation-details/simulation-details.tsx +++ b/ui/pages/confirmations/components/simulation-details/simulation-details.tsx @@ -61,17 +61,23 @@ const ErrorContent: React.FC<{ error: SimulationError }> = ({ error }) => { function getMessage() { return error.code === SimulationErrorCode.Reverted ? t('simulationDetailsTransactionReverted') - : t('simulationDetailsFailed'); + : t('simulationDetailsUnavailable'); } return ( - + {error.code === SimulationErrorCode.Reverted && ( + + )} {getMessage()} ); @@ -84,7 +90,7 @@ const EmptyContent: React.FC = () => { const t = useI18nContext(); return ( - {t('simulationDetailsNoBalanceChanges')} + {t('simulationDetailsNoChanges')} ); }; @@ -217,9 +223,18 @@ export const SimulationDetails: React.FC = ({ } if (error) { + const inHeaderProp = error.code !== SimulationErrorCode.Reverted && { + inHeader: , + }; + return ( - - + + {error.code === SimulationErrorCode.Reverted && ( + + )} ); } @@ -228,9 +243,10 @@ export const SimulationDetails: React.FC = ({ const empty = balanceChanges.length === 0; if (empty) { return ( - - - + } + /> ); } diff --git a/ui/pages/confirmations/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap b/ui/pages/confirmations/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap index c89fa090cd3d..09d2949e968e 100644 --- a/ui/pages/confirmations/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap +++ b/ui/pages/confirmations/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap @@ -336,12 +336,12 @@ exports[`Confirm Transaction Base should match snapshot 1`] = ` +

+ No changes +

-

- No changes predicted for your wallet -