feat: list and kanban issue alerts

This commit is contained in:
anmolsinghbhatia 2023-04-28 13:23:57 +05:30
parent 32aef44e52
commit 937d04e88c
2 changed files with 51 additions and 16 deletions

View File

@ -173,9 +173,18 @@ export const SingleBoardIssue: React.FC<Props> = ({
mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params));
mutate(MODULE_DETAILS(moduleId as string)); mutate(MODULE_DETAILS(moduleId as string));
} else mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params)); } else mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params));
setToastAlert({
type: "info",
title: "Issue Updated Successfully",
});
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
setToastAlert({
type: "error",
title: "Error!",
message: "Something went wrong. Please try again.",
});
}); });
}, },
[ [
@ -209,15 +218,22 @@ export const SingleBoardIssue: React.FC<Props> = ({
const handleCopyText = () => { const handleCopyText = () => {
const originURL = const originURL =
typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; typeof window !== "undefined" && window.location.origin ? window.location.origin : "";
copyTextToClipboard( copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}`)
`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}` .then(() => {
).then(() => { setToastAlert({
setToastAlert({ type: "info",
type: "success", title: "Link Copied Successfully",
title: "Link Copied!", iconType: "copy",
message: "Issue link copied to clipboard.", });
})
.catch((error) => {
console.log(error);
setToastAlert({
type: "error",
title: "Error!",
message: "Something went wrong. Please try again.",
});
}); });
});
}; };
useEffect(() => { useEffect(() => {

View File

@ -149,6 +149,18 @@ export const SingleListIssue: React.FC<Props> = ({
mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params)); mutate(MODULE_ISSUES_WITH_PARAMS(moduleId as string, params));
mutate(MODULE_DETAILS(moduleId as string)); mutate(MODULE_DETAILS(moduleId as string));
} else mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params)); } else mutate(PROJECT_ISSUES_LIST_WITH_PARAMS(projectId as string, params));
setToastAlert({
type: "info",
title: "Issue Updated Successfully",
});
})
.catch((error) => {
console.log(error);
setToastAlert({
type: "error",
title: "Error!",
message: "Something went wrong. Please try again.",
});
}); });
}, },
[ [
@ -168,15 +180,22 @@ export const SingleListIssue: React.FC<Props> = ({
const handleCopyText = () => { const handleCopyText = () => {
const originURL = const originURL =
typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; typeof window !== "undefined" && window.location.origin ? window.location.origin : "";
copyTextToClipboard( copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}`)
`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}` .then(() => {
).then(() => { setToastAlert({
setToastAlert({ type: "info",
type: "success", title: "Link Copied Successfully",
title: "Link Copied!", iconType: "copy",
message: "Issue link copied to clipboard.", });
})
.catch((error) => {
console.log(error);
setToastAlert({
type: "error",
title: "Error!",
message: "Something went wrong. Please try again.",
});
}); });
});
}; };
const isNotAllowed = userAuth.isGuest || userAuth.isViewer || isCompleted; const isNotAllowed = userAuth.isGuest || userAuth.isViewer || isCompleted;