diff --git a/mailpoet/assets/js/src/help/queue-status.tsx b/mailpoet/assets/js/src/help/queue-status.tsx
index e44d4df9b5..5ae5879fa5 100644
--- a/mailpoet/assets/js/src/help/queue-status.tsx
+++ b/mailpoet/assets/js/src/help/queue-status.tsx
@@ -85,23 +85,25 @@ function QueueStatus({ statusData }: Props): JSX.Element {
/>
{MailPoet.I18n.t('scheduledTasks')}
task.status === 'scheduled')}
/>
{MailPoet.I18n.t('cancelledTasks')}
task.status === 'cancelled')}
/>
{MailPoet.I18n.t('runningTasks')}
task.status === null)}
/>
{MailPoet.I18n.t('completedTasks')}
task.status === 'completed')}
/>
>
diff --git a/mailpoet/assets/js/src/help/tasks-list/tasks-list-data-row.tsx b/mailpoet/assets/js/src/help/tasks-list/tasks-list-data-row.tsx
index a6ea0fe79e..ee9bec7d56 100644
--- a/mailpoet/assets/js/src/help/tasks-list/tasks-list-data-row.tsx
+++ b/mailpoet/assets/js/src/help/tasks-list/tasks-list-data-row.tsx
@@ -3,8 +3,7 @@ import parseDate from 'date-fns/parse';
import { CancelTaskButton, RescheduleTaskButton } from './tasks-list-actions';
export type Props = {
- showScheduledAt: boolean;
- showCancelledAt: boolean;
+ type: string;
task: {
id: number;
type: string;
@@ -23,11 +22,12 @@ export type Props = {
};
};
-function TasksListDataRow({
- showScheduledAt = false,
- showCancelledAt = false,
- task,
-}: Props): JSX.Element {
+function TasksListDataRow({ type, task }: Props): JSX.Element {
+ const showScheduledAt = type === 'scheduled';
+ const showCancelledAt = type === 'cancelled';
+ const canCancelTask = type === 'scheduled' || type === 'running';
+ const canRescheduleTask = type === 'cancelled';
+
let scheduled: Date;
if (showScheduledAt) {
scheduled = parseDate(task.scheduledAt, 'yyyy-MM-dd HH:mm:ss', new Date());
@@ -102,12 +102,12 @@ function TasksListDataRow({
updated,
)}`}
- {showScheduledAt ? (
+ {canCancelTask ? (
|
) : null}
- {showCancelledAt ? (
+ {canRescheduleTask ? (
|
diff --git a/mailpoet/assets/js/src/help/tasks-list/tasks-list-labels-row.tsx b/mailpoet/assets/js/src/help/tasks-list/tasks-list-labels-row.tsx
index e7c1cd6d71..39fdcc6985 100644
--- a/mailpoet/assets/js/src/help/tasks-list/tasks-list-labels-row.tsx
+++ b/mailpoet/assets/js/src/help/tasks-list/tasks-list-labels-row.tsx
@@ -1,28 +1,25 @@
import { MailPoet } from 'mailpoet';
type Props = {
- showScheduledAt?: boolean;
- showCancelledAt?: boolean;
+ type: string;
};
-function TasksListLabelsRow({
- showScheduledAt = false,
- showCancelledAt = false,
-}: Props): JSX.Element {
+function TasksListLabelsRow({ type }: Props): JSX.Element {
+ const hasAction = ['scheduled', 'running', 'cancelled'].includes(type);
return (
Id |
{MailPoet.I18n.t('email')} |
{MailPoet.I18n.t('subscriber')} |
{MailPoet.I18n.t('priority')} |
- {showScheduledAt ? (
+ {type === 'scheduled' ? (
{MailPoet.I18n.t('scheduledAt')} |
) : null}
- {showCancelledAt ? (
+ {type === 'cancelled' ? (
{MailPoet.I18n.t('cancelledAt')} |
) : null}
{MailPoet.I18n.t('updatedAt')} |
- {showScheduledAt || showCancelledAt ? (
+ {hasAction ? (
{MailPoet.I18n.t('action')} |
) : null}
diff --git a/mailpoet/assets/js/src/help/tasks-list/tasks-list.tsx b/mailpoet/assets/js/src/help/tasks-list/tasks-list.tsx
index 1894323c0f..f7b93e908e 100644
--- a/mailpoet/assets/js/src/help/tasks-list/tasks-list.tsx
+++ b/mailpoet/assets/js/src/help/tasks-list/tasks-list.tsx
@@ -6,34 +6,27 @@ import {
import { TasksListLabelsRow } from './tasks-list-labels-row';
type Props = {
- showScheduledAt?: boolean;
- showCancelledAt?: boolean;
tasks: TasksListLabelsRowProps['task'][];
+ type: string;
};
-function TasksList({
- showScheduledAt = false,
- showCancelledAt = false,
- tasks,
-}: Props): JSX.Element {
- const colsCount = showScheduledAt || showCancelledAt ? 7 : 5;
+function TasksList({ tasks, type }: Props): JSX.Element {
+ let colsCount = 5;
+ if (type === 'running') {
+ colsCount += 1;
+ }
+ if (type === 'scheduled' || type === 'cancelled') {
+ colsCount += 2;
+ }
return (
-
+
{tasks.length ? (
tasks.map((task) => (
-
+
))
) : (
@@ -42,10 +35,7 @@ function TasksList({
)}
-
+
);