forked from github/plane
[WEB-1240] chore: toast messages updates (#4561)
* [WEB-1240] fix: toast messages inconsistency in sub-issues. * [WEB-1241] chore: update draft issue creation toast message. * chore: minor logic improvement.
This commit is contained in:
parent
780caf59a0
commit
7089474c11
@ -13,11 +13,12 @@ type Props = {
|
|||||||
handleClose: () => void;
|
handleClose: () => void;
|
||||||
dataId?: string | null | undefined;
|
dataId?: string | null | undefined;
|
||||||
data?: TIssue;
|
data?: TIssue;
|
||||||
|
isSubIssue?: boolean;
|
||||||
onSubmit?: () => Promise<void>;
|
onSubmit?: () => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DeleteIssueModal: React.FC<Props> = (props) => {
|
export const DeleteIssueModal: React.FC<Props> = (props) => {
|
||||||
const { dataId, data, isOpen, handleClose, onSubmit } = props;
|
const { dataId, data, isOpen, handleClose, isSubIssue = false, onSubmit } = props;
|
||||||
// states
|
// states
|
||||||
const [isDeleting, setIsDeleting] = useState(false);
|
const [isDeleting, setIsDeleting] = useState(false);
|
||||||
// store hooks
|
// store hooks
|
||||||
@ -44,6 +45,11 @@ export const DeleteIssueModal: React.FC<Props> = (props) => {
|
|||||||
if (onSubmit)
|
if (onSubmit)
|
||||||
await onSubmit()
|
await onSubmit()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
setToast({
|
||||||
|
type: TOAST_TYPE.SUCCESS,
|
||||||
|
title: "Success!",
|
||||||
|
message: `${isSubIssue ? "Sub-issue" : "Issue"} deleted successfully`,
|
||||||
|
});
|
||||||
onClose();
|
onClose();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
@ -162,7 +162,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
|
|||||||
setToast({
|
setToast({
|
||||||
type: TOAST_TYPE.SUCCESS,
|
type: TOAST_TYPE.SUCCESS,
|
||||||
title: "Success!",
|
title: "Success!",
|
||||||
message: "Issue created successfully.",
|
message: `${is_draft_issue ? "Draft issue" : "Issue"} created successfully.`,
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
captureIssueEvent({
|
||||||
eventName: ISSUE_CREATED,
|
eventName: ISSUE_CREATED,
|
||||||
@ -178,7 +178,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
|
|||||||
setToast({
|
setToast({
|
||||||
type: TOAST_TYPE.ERROR,
|
type: TOAST_TYPE.ERROR,
|
||||||
title: "Error!",
|
title: "Error!",
|
||||||
message: "Issue could not be created. Please try again.",
|
message: `${is_draft_issue ? "Draft issue" : "Issue"} could not be created. Please try again.`,
|
||||||
});
|
});
|
||||||
captureIssueEvent({
|
captureIssueEvent({
|
||||||
eventName: ISSUE_CREATED,
|
eventName: ISSUE_CREATED,
|
||||||
|
@ -1,20 +1,22 @@
|
|||||||
import { FC, useCallback, useEffect, useMemo, useState } from "react";
|
import { FC, useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
// icons
|
||||||
import { Plus, ChevronRight, Loader, Pencil } from "lucide-react";
|
import { Plus, ChevronRight, Loader, Pencil } from "lucide-react";
|
||||||
|
// types
|
||||||
import { IUser, TIssue } from "@plane/types";
|
import { IUser, TIssue } from "@plane/types";
|
||||||
// hooks
|
// ui
|
||||||
import { CircularProgressIndicator, CustomMenu, LayersIcon, TOAST_TYPE, setToast } from "@plane/ui";
|
import { CircularProgressIndicator, CustomMenu, LayersIcon, TOAST_TYPE, setToast } from "@plane/ui";
|
||||||
|
// components
|
||||||
import { ExistingIssuesListModal } from "@/components/core";
|
import { ExistingIssuesListModal } from "@/components/core";
|
||||||
import { CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues";
|
import { CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues";
|
||||||
|
// helpers
|
||||||
import { cn } from "@/helpers/common.helper";
|
import { cn } from "@/helpers/common.helper";
|
||||||
import { copyTextToClipboard } from "@/helpers/string.helper";
|
import { copyTextToClipboard } from "@/helpers/string.helper";
|
||||||
|
// hooks
|
||||||
import { useEventTracker, useIssueDetail } from "@/hooks/store";
|
import { useEventTracker, useIssueDetail } from "@/hooks/store";
|
||||||
// components
|
// local components
|
||||||
import { IssueList } from "./issues-list";
|
import { IssueList } from "./issues-list";
|
||||||
// ui
|
|
||||||
// helpers
|
|
||||||
// types
|
|
||||||
|
|
||||||
export interface ISubIssuesRoot {
|
export interface ISubIssuesRoot {
|
||||||
workspaceSlug: string;
|
workspaceSlug: string;
|
||||||
@ -248,11 +250,6 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
|
|||||||
try {
|
try {
|
||||||
setSubIssueHelpers(parentIssueId, "issue_loader", issueId);
|
setSubIssueHelpers(parentIssueId, "issue_loader", issueId);
|
||||||
await deleteSubIssue(workspaceSlug, projectId, parentIssueId, issueId);
|
await deleteSubIssue(workspaceSlug, projectId, parentIssueId, issueId);
|
||||||
setToast({
|
|
||||||
type: TOAST_TYPE.SUCCESS,
|
|
||||||
title: "Error!",
|
|
||||||
message: "Issue deleted successfully",
|
|
||||||
});
|
|
||||||
captureIssueEvent({
|
captureIssueEvent({
|
||||||
eventName: "Sub-issue deleted",
|
eventName: "Sub-issue deleted",
|
||||||
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
payload: { id: issueId, state: "SUCCESS", element: "Issue detail page" },
|
||||||
@ -535,6 +532,7 @@ export const SubIssuesRoot: FC<ISubIssuesRoot> = observer((props) => {
|
|||||||
issueCrudState?.delete?.issue?.id as string
|
issueCrudState?.delete?.issue?.id as string
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
isSubIssue
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user