From 61f992a8233eefe2a71acb14dffe57c26b05e4b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=A0Ja=CC=81n=20Mikla=CC=81s=CC=8C?= Date: Mon, 1 Jul 2024 09:33:37 +0200 Subject: [PATCH] Only render log status info when it's available [MAILPOET-5436] --- .../tabs/_subscribers.scss | 5 +++- .../tabs/subscribers/modal/rows.tsx | 25 ++++++++++++------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/mailpoet/assets/css/src/components-automation-analytics/tabs/_subscribers.scss b/mailpoet/assets/css/src/components-automation-analytics/tabs/_subscribers.scss index 6b6a91abbe..69d03a4458 100644 --- a/mailpoet/assets/css/src/components-automation-analytics/tabs/_subscribers.scss +++ b/mailpoet/assets/css/src/components-automation-analytics/tabs/_subscribers.scss @@ -79,6 +79,9 @@ } .mailpoet-analytics-activity-modal-status-info { - margin-top: 8px; max-width: 220px; + + &:not(:empty) { + margin-top: 8px; + } } diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/subscribers/modal/rows.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/subscribers/modal/rows.tsx index c1763ca991..bfa845e6b4 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/subscribers/modal/rows.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/subscribers/modal/rows.tsx @@ -28,6 +28,15 @@ export const headers = [ }, ]; +function StatusInfo({ info }: { info: string | null }): JSX.Element { + if (!info) { + return null; + } + return ( +
{info}
+ ); +} + export function transformLogsToRows( logs: Log[], steps: Steps, @@ -59,15 +68,18 @@ export function transformLogsToRows( display: ( <> -
- {log.error && log.error.message} -
+ ), }, ]) : []; if (nextStep) { + // translators: "Time left: 1 hour" or "Time left: 1 minute", uses WordPress' human_time_diff() to get the value + const timeLeft = sprintf( + __('Time left: %s', 'mailpoet'), + nextStep.time_left, + ); items.push([ { display: , @@ -85,12 +97,7 @@ export function transformLogsToRows( display: ( <> -
- { - // translators: "Time left: 1 hour" or "Time left: 1 minute", uses WordPress' human_time_diff() to get the value - sprintf(__('Time left: %s', 'mailpoet'), nextStep.time_left) - } -
+ ), },