From dd204852e281ed001601c3d9b640e33d9a74ac0d Mon Sep 17 00:00:00 2001 From: minnakt Date: Tue, 31 Oct 2023 13:44:01 -0400 Subject: [PATCH 1/2] DEVPROD-945: Fix toast text when clearing subscriptions --- .../notificationTab/ClearSubscriptions.tsx | 8 +++++--- src/pages/taskHistory/ColumnHeaders/index.tsx | 2 +- src/pages/variantHistory/ColumnHeaders.tsx | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pages/preferences/preferencesTabs/notificationTab/ClearSubscriptions.tsx b/src/pages/preferences/preferencesTabs/notificationTab/ClearSubscriptions.tsx index 5d3edc69e6..0ba74b7ee1 100644 --- a/src/pages/preferences/preferencesTabs/notificationTab/ClearSubscriptions.tsx +++ b/src/pages/preferences/preferencesTabs/notificationTab/ClearSubscriptions.tsx @@ -1,6 +1,7 @@ import { useState } from "react"; import { useMutation } from "@apollo/client"; import Button, { Variant } from "@leafygreen-ui/button"; +import pluralize from "pluralize"; import { usePreferencesAnalytics } from "analytics"; import { ConfirmationModal } from "components/ConfirmationModal"; import { useToastContext } from "context/toast"; @@ -23,9 +24,10 @@ export const ClearSubscriptions: React.FC = () => { onCompleted: (result) => { setShowModal(false); dispatchToast.success( - `Successfully cleared ${result.clearMySubscriptions} subscription${ - result.clearMySubscriptions !== 1 && "s" - }!` + `Successfully cleared ${result.clearMySubscriptions} ${pluralize( + "subscription", + result.clearMySubscriptions + )}!` ); }, onError: (err) => { diff --git a/src/pages/taskHistory/ColumnHeaders/index.tsx b/src/pages/taskHistory/ColumnHeaders/index.tsx index e346e415dc..0bcb56ee93 100644 --- a/src/pages/taskHistory/ColumnHeaders/index.tsx +++ b/src/pages/taskHistory/ColumnHeaders/index.tsx @@ -44,7 +44,7 @@ const ColumnHeaders: React.FC = ({ if (!buildVariantsForTaskName) { reportError( new Error("No build variants found for task name") - ).severe(); + ).warning(); dispatchToast.error(`No build variants found for task: ${taskName}`); } }, diff --git a/src/pages/variantHistory/ColumnHeaders.tsx b/src/pages/variantHistory/ColumnHeaders.tsx index aaeba13247..daef5adb46 100644 --- a/src/pages/variantHistory/ColumnHeaders.tsx +++ b/src/pages/variantHistory/ColumnHeaders.tsx @@ -44,7 +44,7 @@ const ColumnHeaders: React.FC = ({ if (!taskNamesForBuildVariant) { reportError( new Error("No task names found for build variant") - ).severe(); + ).warning(); dispatchToast.error(`No tasks found for buildVariant: ${variantName}}`); } }, From 6ba6cdb4a97e5cbd240f4ee1d5934f99a70d9ae6 Mon Sep 17 00:00:00 2001 From: minnakt Date: Wed, 1 Nov 2023 09:38:59 -0400 Subject: [PATCH 2/2] feedback --- .../preferencesTabs/notificationTab/ClearSubscriptions.tsx | 2 +- src/pages/variantHistory/ColumnHeaders.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/preferences/preferencesTabs/notificationTab/ClearSubscriptions.tsx b/src/pages/preferences/preferencesTabs/notificationTab/ClearSubscriptions.tsx index 0ba74b7ee1..2c4d9ec2d3 100644 --- a/src/pages/preferences/preferencesTabs/notificationTab/ClearSubscriptions.tsx +++ b/src/pages/preferences/preferencesTabs/notificationTab/ClearSubscriptions.tsx @@ -27,7 +27,7 @@ export const ClearSubscriptions: React.FC = () => { `Successfully cleared ${result.clearMySubscriptions} ${pluralize( "subscription", result.clearMySubscriptions - )}!` + )}.` ); }, onError: (err) => { diff --git a/src/pages/variantHistory/ColumnHeaders.tsx b/src/pages/variantHistory/ColumnHeaders.tsx index daef5adb46..8319d9aacc 100644 --- a/src/pages/variantHistory/ColumnHeaders.tsx +++ b/src/pages/variantHistory/ColumnHeaders.tsx @@ -45,7 +45,9 @@ const ColumnHeaders: React.FC = ({ reportError( new Error("No task names found for build variant") ).warning(); - dispatchToast.error(`No tasks found for buildVariant: ${variantName}}`); + dispatchToast.error( + `No tasks found for build variant: ${variantName}}` + ); } }, });