diff --git a/web/components/cycles/archived-cycles/modal.tsx b/web/components/cycles/archived-cycles/modal.tsx index 6e0ddef35..b613d0de9 100644 --- a/web/components/cycles/archived-cycles/modal.tsx +++ b/web/components/cycles/archived-cycles/modal.tsx @@ -41,7 +41,7 @@ export const ArchiveCycleModal: React.FC = (props) => { message: "Your archives can be found in project archives.", }); onClose(); - router.push(`/${workspaceSlug}/projects/${projectId}/archives/cycles?peekCycle=${cycleId}`); + router.push(`/${workspaceSlug}/projects/${projectId}/cycles`); }) .catch(() => setToast({ diff --git a/web/components/cycles/quick-actions.tsx b/web/components/cycles/quick-actions.tsx index 215f07bef..bf9aefc87 100644 --- a/web/components/cycles/quick-actions.tsx +++ b/web/components/cycles/quick-actions.tsx @@ -78,7 +78,7 @@ export const CycleQuickActions: React.FC = observer((props) => { title: "Restore success", message: "Your cycle can be found in project cycles.", }); - router.push(`/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}`); + router.push(`/${workspaceSlug}/projects/${projectId}/archives/cycles`); }) .catch(() => setToast({ diff --git a/web/components/cycles/sidebar.tsx b/web/components/cycles/sidebar.tsx index e333564ee..b72f9fd0d 100644 --- a/web/components/cycles/sidebar.tsx +++ b/web/components/cycles/sidebar.tsx @@ -129,7 +129,7 @@ export const CycleDetailsSidebar: React.FC = observer((props) => { title: "Restore success", message: "Your cycle can be found in project cycles.", }); - router.push(`/${workspaceSlug.toString()}/projects/${projectId.toString()}/cycles/${cycleId}`); + router.push(`/${workspaceSlug.toString()}/projects/${projectId.toString()}/archives/cycles`); }) .catch(() => setToast({ diff --git a/web/components/issues/archive-issue-modal.tsx b/web/components/issues/archive-issue-modal.tsx index 8ea747ffc..92bbdc677 100644 --- a/web/components/issues/archive-issue-modal.tsx +++ b/web/components/issues/archive-issue-modal.tsx @@ -39,7 +39,14 @@ export const ArchiveIssueModal: React.FC = (props) => { setIsArchiving(true); await onSubmit() - .then(() => onClose()) + .then(() => { + setToast({ + type: TOAST_TYPE.SUCCESS, + title: "Archive success", + message: "Your archives can be found in project archives.", + }); + onClose(); + }) .catch(() => setToast({ type: TOAST_TYPE.ERROR, diff --git a/web/components/issues/issue-detail/root.tsx b/web/components/issues/issue-detail/root.tsx index 53e8d8707..fdd848a2d 100644 --- a/web/components/issues/issue-detail/root.tsx +++ b/web/components/issues/issue-detail/root.tsx @@ -144,22 +144,12 @@ export const IssueDetailRoot: FC = observer((props) => { archive: async (workspaceSlug: string, projectId: string, issueId: string) => { try { await archiveIssue(workspaceSlug, projectId, issueId); - setToast({ - type: TOAST_TYPE.SUCCESS, - title: "Success!", - message: "Issue archived successfully.", - }); captureIssueEvent({ eventName: ISSUE_ARCHIVED, payload: { id: issueId, state: "SUCCESS", element: "Issue details page" }, path: router.asPath, }); } catch (error) { - setToast({ - type: TOAST_TYPE.ERROR, - title: "Error!", - message: "Issue could not be archived. Please try again.", - }); captureIssueEvent({ eventName: ISSUE_ARCHIVED, payload: { id: issueId, state: "FAILED", element: "Issue details page" }, diff --git a/web/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx b/web/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx index d996ee598..8a49ec9b4 100644 --- a/web/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx +++ b/web/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx @@ -1,22 +1,23 @@ import { useState } from "react"; +import { observer } from "mobx-react"; import { useRouter } from "next/router"; +// icons import { ArchiveRestoreIcon, ExternalLink, Link, Trash2 } from "lucide-react"; -// hooks -import { CustomMenu, TOAST_TYPE, setToast } from "@plane/ui"; - -import { DeleteIssueModal } from "@/components/issues"; // ui +import { CustomMenu, TOAST_TYPE, setToast } from "@plane/ui"; // components +import { DeleteIssueModal } from "@/components/issues"; +// constants import { EIssuesStoreType } from "@/constants/issue"; import { EUserProjectRoles } from "@/constants/project"; -import { copyUrlToClipboard } from "@/helpers/string.helper"; -import { useEventTracker, useIssues, useUser } from "@/hooks/store"; -// components // helpers +import { copyUrlToClipboard } from "@/helpers/string.helper"; +// hooks +import { useEventTracker, useIssues, useUser } from "@/hooks/store"; // types import { IQuickActionProps } from "../list/list-view-types"; -export const ArchivedIssueQuickActions: React.FC = (props) => { +export const ArchivedIssueQuickActions: React.FC = observer((props) => { const { issue, handleDelete, handleRestore, customActionButton, portalElement, readOnly = false } = props; // states const [deleteIssueModal, setDeleteIssueModal] = useState(false); @@ -46,6 +47,24 @@ export const ArchivedIssueQuickActions: React.FC = (props) => message: "Issue link copied to clipboard", }) ); + const handleIssueRestore = async () => { + if (!handleRestore) return; + await handleRestore() + .then(() => { + setToast({ + type: TOAST_TYPE.SUCCESS, + title: "Restore success", + message: "Your issue can be found in project issues.", + }); + }) + .catch(() => { + setToast({ + type: TOAST_TYPE.ERROR, + title: "Error!", + message: "Issue could not be restored. Please try again.", + }); + }); + }; return ( <> @@ -65,7 +84,7 @@ export const ArchivedIssueQuickActions: React.FC = (props) => ellipsis > {isRestoringAllowed && ( - +
Restore @@ -100,4 +119,4 @@ export const ArchivedIssueQuickActions: React.FC = (props) => ); -}; +}); diff --git a/web/components/issues/peek-overview/root.tsx b/web/components/issues/peek-overview/root.tsx index a7f7b23d7..4d85bd73c 100644 --- a/web/components/issues/peek-overview/root.tsx +++ b/web/components/issues/peek-overview/root.tsx @@ -135,22 +135,12 @@ export const IssuePeekOverview: FC = observer((props) => { archive: async (workspaceSlug: string, projectId: string, issueId: string) => { try { await archiveIssue(workspaceSlug, projectId, issueId); - setToast({ - type: TOAST_TYPE.SUCCESS, - title: "Success!", - message: "Issue archived successfully.", - }); captureIssueEvent({ eventName: ISSUE_ARCHIVED, payload: { id: issueId, state: "SUCCESS", element: "Issue peek-overview" }, path: router.asPath, }); } catch (error) { - setToast({ - type: TOAST_TYPE.ERROR, - title: "Error!", - message: "Issue could not be archived. Please try again.", - }); captureIssueEvent({ eventName: ISSUE_ARCHIVED, payload: { id: issueId, state: "FAILED", element: "Issue peek-overview" }, @@ -163,8 +153,8 @@ export const IssuePeekOverview: FC = observer((props) => { await restoreIssue(workspaceSlug, projectId, issueId); setToast({ type: TOAST_TYPE.SUCCESS, - title: "Success!", - message: "Issue restored successfully.", + title: "Restore success", + message: "Your issue can be found in project issues.", }); captureIssueEvent({ eventName: ISSUE_RESTORED, diff --git a/web/components/modules/archived-modules/modal.tsx b/web/components/modules/archived-modules/modal.tsx index f922e0ba9..abfb084f0 100644 --- a/web/components/modules/archived-modules/modal.tsx +++ b/web/components/modules/archived-modules/modal.tsx @@ -41,7 +41,7 @@ export const ArchiveModuleModal: React.FC = (props) => { message: "Your archives can be found in project archives.", }); onClose(); - router.push(`/${workspaceSlug}/projects/${projectId}/archives/modules?peekModule=${moduleId}`); + router.push(`/${workspaceSlug}/projects/${projectId}/modules`); }) .catch(() => setToast({ diff --git a/web/components/modules/quick-actions.tsx b/web/components/modules/quick-actions.tsx index b7972d612..5decec4ec 100644 --- a/web/components/modules/quick-actions.tsx +++ b/web/components/modules/quick-actions.tsx @@ -79,7 +79,7 @@ export const ModuleQuickActions: React.FC = observer((props) => { title: "Restore success", message: "Your module can be found in project modules.", }); - router.push(`/${workspaceSlug}/projects/${projectId}/modules/${moduleId}`); + router.push(`/${workspaceSlug}/projects/${projectId}/archives/modules`); }) .catch(() => setToast({ diff --git a/web/components/modules/sidebar.tsx b/web/components/modules/sidebar.tsx index 38618023d..de6e3d02f 100644 --- a/web/components/modules/sidebar.tsx +++ b/web/components/modules/sidebar.tsx @@ -227,7 +227,7 @@ export const ModuleDetailsSidebar: React.FC = observer((props) => { title: "Restore success", message: "Your module can be found in project modules.", }); - router.push(`/${workspaceSlug}/projects/${projectId}/modules/${moduleId}`); + router.push(`/${workspaceSlug}/projects/${projectId}/archives/modules`); }) .catch(() => setToast({ diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/archives/issues/[archivedIssueId].tsx b/web/pages/[workspaceSlug]/projects/[projectId]/archives/issues/[archivedIssueId].tsx index 12b0c8391..0ff7d7fc5 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/archives/issues/[archivedIssueId].tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/archives/issues/[archivedIssueId].tsx @@ -66,13 +66,8 @@ const ArchivedIssueDetailsPage: NextPageWithLayout = observer(() => { .then(() => { setToast({ type: TOAST_TYPE.SUCCESS, - title: "Success", - message: - issue && - `${getProjectById(issue.project_id) - ?.identifier}-${issue?.sequence_id} is restored successfully under the project ${getProjectById( - issue.project_id - )?.name}`, + title: "Restore success", + message: "Your issue can be found in project issues.", }); router.push(`/${workspaceSlug}/projects/${projectId}/issues/${archivedIssueId}`); }) @@ -80,7 +75,7 @@ const ArchivedIssueDetailsPage: NextPageWithLayout = observer(() => { setToast({ type: TOAST_TYPE.ERROR, title: "Error!", - message: "Something went wrong. Please try again.", + message: "Issue could not be restored. Please try again.", }); }) .finally(() => setIsRestoring(false));