From 32aef44e52ede8b6d3e7d9836ccfb11d2ff4c222 Mon Sep 17 00:00:00 2001 From: anmolsinghbhatia Date: Fri, 28 Apr 2023 12:49:00 +0530 Subject: [PATCH] feat: my issue page alerts --- .../components/issues/my-issues-list-item.tsx | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/apps/app/components/issues/my-issues-list-item.tsx b/apps/app/components/issues/my-issues-list-item.tsx index ebf063719..0fcb2bcfd 100644 --- a/apps/app/components/issues/my-issues-list-item.tsx +++ b/apps/app/components/issues/my-issues-list-item.tsx @@ -57,9 +57,18 @@ export const MyIssuesListItem: React.FC = ({ issue, properties, projectId .patchIssue(workspaceSlug as string, projectId as string, issue.id, formData) .then((res) => { mutate(USER_ISSUE(workspaceSlug as string)); + setToastAlert({ + type: "info", + title: "Issue Updated Successfully", + }); }) .catch((error) => { console.log(error); + setToastAlert({ + type: "error", + title: "Error!", + message: "Something went wrong. Please try again.", + }); }); }, [workspaceSlug, projectId, issue] @@ -68,21 +77,28 @@ export const MyIssuesListItem: React.FC = ({ issue, properties, projectId const handleCopyText = () => { const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; - copyTextToClipboard( - `${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}` - ).then(() => { - setToastAlert({ - type: "success", - title: "Link Copied!", - message: "Issue link copied to clipboard.", + copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}`) + .then(() => { + setToastAlert({ + type: "info", + title: "Link Copied Successfully", + iconType: "copy", + }); + }) + .catch((error) => { + console.log(error); + setToastAlert({ + type: "error", + title: "Error!", + message: "Something went wrong. Please try again.", + }); }); - }); }; const isNotAllowed = false; return ( -
+