feat: my issue page alerts

This commit is contained in:
anmolsinghbhatia 2023-04-28 12:49:00 +05:30
parent c568a26164
commit 32aef44e52

View File

@ -57,9 +57,18 @@ export const MyIssuesListItem: React.FC<Props> = ({ issue, properties, projectId
.patchIssue(workspaceSlug as string, projectId as string, issue.id, formData) .patchIssue(workspaceSlug as string, projectId as string, issue.id, formData)
.then((res) => { .then((res) => {
mutate(USER_ISSUE(workspaceSlug as string)); mutate(USER_ISSUE(workspaceSlug as string));
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.",
});
}); });
}, },
[workspaceSlug, projectId, issue] [workspaceSlug, projectId, issue]
@ -68,13 +77,20 @@ export const MyIssuesListItem: React.FC<Props> = ({ issue, properties, projectId
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: "success", type: "info",
title: "Link Copied!", title: "Link Copied Successfully",
message: "Issue link copied to clipboard.", iconType: "copy",
});
})
.catch((error) => {
console.log(error);
setToastAlert({
type: "error",
title: "Error!",
message: "Something went wrong. Please try again.",
}); });
}); });
}; };
@ -82,7 +98,7 @@ export const MyIssuesListItem: React.FC<Props> = ({ issue, properties, projectId
const isNotAllowed = false; const isNotAllowed = false;
return ( return (
<div className="border-b border-brand-base last:border-b-0 mx-6"> <div className="mx-6 border-b border-brand-base last:border-b-0">
<div key={issue.id} className="flex items-center justify-between gap-2 py-3"> <div key={issue.id} className="flex items-center justify-between gap-2 py-3">
<Link href={`/${workspaceSlug}/projects/${issue?.project_detail?.id}/issues/${issue.id}`}> <Link href={`/${workspaceSlug}/projects/${issue?.project_detail?.id}/issues/${issue.id}`}>
<a className="group relative flex items-center gap-2"> <a className="group relative flex items-center gap-2">
@ -171,7 +187,7 @@ export const MyIssuesListItem: React.FC<Props> = ({ issue, properties, projectId
</Tooltip> </Tooltip>
)} )}
{properties.link && ( {properties.link && (
<div className="flex items-center rounded-md shadow-sm px-2.5 py-1 cursor-default text-xs border border-gray-200"> <div className="flex cursor-default items-center rounded-md border border-gray-200 px-2.5 py-1 text-xs shadow-sm">
<Tooltip tooltipHeading="Link" tooltipContent={`${issue.link_count}`}> <Tooltip tooltipHeading="Link" tooltipContent={`${issue.link_count}`}>
<div className="flex items-center gap-1 text-gray-500"> <div className="flex items-center gap-1 text-gray-500">
<LinkIcon className="h-3.5 w-3.5 text-gray-500" /> <LinkIcon className="h-3.5 w-3.5 text-gray-500" />
@ -181,10 +197,10 @@ export const MyIssuesListItem: React.FC<Props> = ({ issue, properties, projectId
</div> </div>
)} )}
{properties.attachment_count && ( {properties.attachment_count && (
<div className="flex items-center rounded-md shadow-sm px-2.5 py-1 cursor-default text-xs border border-gray-200"> <div className="flex cursor-default items-center rounded-md border border-gray-200 px-2.5 py-1 text-xs shadow-sm">
<Tooltip tooltipHeading="Attachment" tooltipContent={`${issue.attachment_count}`}> <Tooltip tooltipHeading="Attachment" tooltipContent={`${issue.attachment_count}`}>
<div className="flex items-center gap-1 text-gray-500"> <div className="flex items-center gap-1 text-gray-500">
<PaperClipIcon className="h-3.5 w-3.5 text-gray-500 -rotate-45" /> <PaperClipIcon className="h-3.5 w-3.5 -rotate-45 text-gray-500" />
{issue.attachment_count} {issue.attachment_count}
</div> </div>
</Tooltip> </Tooltip>