From 1b1bf84613d6157000ab94a1aca1e9e04c7d4bab Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Wed, 4 Dec 2024 15:03:40 +0000 Subject: [PATCH] Address PR review --- .../alert-system/alert-modal/alert-modal.tsx | 5 ++- .../general-alert/general-alert.tsx | 6 ++-- .../banner-base/banner-base.types.ts | 2 +- ui/ducks/confirm-alerts/confirm-alerts.ts | 31 +++++++++++++++---- .../components/confirm/title/title.tsx | 1 + .../usePendingTransactionAlerts.ts | 2 +- 6 files changed, 34 insertions(+), 13 deletions(-) diff --git a/ui/components/app/alert-system/alert-modal/alert-modal.tsx b/ui/components/app/alert-system/alert-modal/alert-modal.tsx index 446b810652cf..2eb78fba44c1 100644 --- a/ui/components/app/alert-system/alert-modal/alert-modal.tsx +++ b/ui/components/app/alert-system/alert-modal/alert-modal.tsx @@ -164,15 +164,14 @@ function AlertDetails({ > {customDetails ?? ( - {typeof selectedAlert.message === 'string' ? ( + {Boolean(selectedAlert.content) && selectedAlert.content} + {Boolean(selectedAlert.message) && ( {selectedAlert.message} - ) : ( - selectedAlert.message )} {selectedAlert.alertDetails?.length ? ( diff --git a/ui/components/app/alert-system/general-alert/general-alert.tsx b/ui/components/app/alert-system/general-alert/general-alert.tsx index 1f37d4babbf0..5c222902b3ab 100644 --- a/ui/components/app/alert-system/general-alert/general-alert.tsx +++ b/ui/components/app/alert-system/general-alert/general-alert.tsx @@ -1,4 +1,4 @@ -import React, { ReactNode } from 'react'; +import React from 'react'; import { BannerAlert, Box, @@ -21,13 +21,14 @@ import { AlertProvider } from '../alert-provider'; import { AlertSeverity } from '../../../../ducks/confirm-alerts/confirm-alerts'; export type GeneralAlertProps = { - description: string | ReactNode; + description?: string; details?: React.ReactNode | string[]; onClickSupportLink?: () => void; provider?: SecurityProvider; reportUrl?: string; severity: AlertSeverity; title?: string; + children?: React.ReactNode; }; function ReportLink({ @@ -119,6 +120,7 @@ function GeneralAlert({ description={description} {...props} > + {props.children} ))} diff --git a/ui/pages/confirmations/hooks/alerts/transactions/usePendingTransactionAlerts.ts b/ui/pages/confirmations/hooks/alerts/transactions/usePendingTransactionAlerts.ts index 5394dcfbcf09..6ef15b5ff41f 100644 --- a/ui/pages/confirmations/hooks/alerts/transactions/usePendingTransactionAlerts.ts +++ b/ui/pages/confirmations/hooks/alerts/transactions/usePendingTransactionAlerts.ts @@ -30,7 +30,7 @@ export function usePendingTransactionAlerts(): Alert[] { { field: RowAlertKey.Speed, key: 'pendingTransactions', - message: PendingTransactionAlertMessage(), + content: PendingTransactionAlertMessage(), reason: t('alertReasonPendingTransactions'), severity: Severity.Warning, },