From eb9d84a65a4d13562dec400acdd6b489649ff80f Mon Sep 17 00:00:00 2001
From: Aaryan Khandelwal
Date: Thu, 14 Nov 2024 20:03:52 +0530
Subject: [PATCH 1/2] feat: issue version history
---
packages/types/src/pages.d.ts | 3 +-
web/core/components/editor/index.ts | 1 +
.../editor/version-history/editors/index.ts | 11 +++
.../editors/issue-version-editor.tsx | 70 ++++++++++++++++
.../editors/page-version-editor.tsx} | 24 ++----
.../version-history}/index.ts | 2 +-
.../version-history}/main-content.tsx | 22 ++---
.../version-history}/root.tsx | 24 +++---
.../version-history}/sidebar-list-item.tsx | 6 +-
.../version-history}/sidebar-list.tsx | 20 ++---
.../version-history}/sidebar-root.tsx | 18 ++--
.../components/issues/issue-detail/index.ts | 3 +-
.../components/issues/issue-detail/root.tsx | 5 +-
.../issues/issue-detail/version-history.tsx | 82 +++++++++++++++++++
.../components/pages/editor/page-root.tsx | 9 +-
web/core/services/issue/index.ts | 1 +
.../services/issue/issue_version.service.ts | 33 ++++++++
.../page/project-page-version.service.ts | 6 +-
18 files changed, 263 insertions(+), 77 deletions(-)
create mode 100644 web/core/components/editor/version-history/editors/index.ts
create mode 100644 web/core/components/editor/version-history/editors/issue-version-editor.tsx
rename web/core/components/{pages/version/editor.tsx => editor/version-history/editors/page-version-editor.tsx} (84%)
rename web/core/components/{pages/version => editor/version-history}/index.ts (85%)
rename web/core/components/{pages/version => editor/version-history}/main-content.tsx (85%)
rename web/core/components/{pages/version => editor/version-history}/root.tsx (69%)
rename web/core/components/{pages/version => editor/version-history}/sidebar-list-item.tsx (89%)
rename web/core/components/{pages/version => editor/version-history}/sidebar-list.tsx (83%)
rename web/core/components/{pages/version => editor/version-history}/sidebar-root.tsx (64%)
create mode 100644 web/core/components/issues/issue-detail/version-history.tsx
create mode 100644 web/core/services/issue/issue_version.service.ts
diff --git a/packages/types/src/pages.d.ts b/packages/types/src/pages.d.ts
index 011f92d69ba..9610a9e3530 100644
--- a/packages/types/src/pages.d.ts
+++ b/packages/types/src/pages.d.ts
@@ -49,7 +49,7 @@ export type TPageFilters = {
export type TPageEmbedType = "mention" | "issue";
-export type TPageVersion = {
+export type TEditorVersion = {
created_at: string;
created_by: string;
deleted_at: string | null;
@@ -59,7 +59,6 @@ export type TPageVersion = {
id: string;
last_saved_at: string;
owned_by: string;
- page: string;
updated_at: string;
updated_by: string;
workspace: string;
diff --git a/web/core/components/editor/index.ts b/web/core/components/editor/index.ts
index 0b14bd13570..d415b23d7fc 100644
--- a/web/core/components/editor/index.ts
+++ b/web/core/components/editor/index.ts
@@ -1,3 +1,4 @@
export * from "./lite-text-editor";
export * from "./pdf";
export * from "./rich-text-editor";
+export * from "./version-history";
diff --git a/web/core/components/editor/version-history/editors/index.ts b/web/core/components/editor/version-history/editors/index.ts
new file mode 100644
index 00000000000..3806d60f1a0
--- /dev/null
+++ b/web/core/components/editor/version-history/editors/index.ts
@@ -0,0 +1,11 @@
+import { TEditorVersion } from "@plane/types";
+
+export type TVersionEditorProps = {
+ activeVersion: string | null;
+ currentVersionDescription: string | null;
+ isCurrentVersionActive: boolean;
+ versionDetails: TEditorVersion | undefined;
+};
+
+export * from "./issue-version-editor";
+export * from "./page-version-editor";
diff --git a/web/core/components/editor/version-history/editors/issue-version-editor.tsx b/web/core/components/editor/version-history/editors/issue-version-editor.tsx
new file mode 100644
index 00000000000..dc02f7c6af3
--- /dev/null
+++ b/web/core/components/editor/version-history/editors/issue-version-editor.tsx
@@ -0,0 +1,70 @@
+import { observer } from "mobx-react";
+import { useParams } from "next/navigation";
+// plane ui
+import { Loader } from "@plane/ui";
+// components
+import { RichTextReadOnlyEditor } from "@/components/editor";
+// local types
+import { TVersionEditorProps } from ".";
+
+export const IssueVersionEditor: React.FC = observer((props) => {
+ const { activeVersion, currentVersionDescription, isCurrentVersionActive, versionDetails } = props;
+ // params
+ const { workspaceSlug, projectId } = useParams();
+
+ if (!isCurrentVersionActive && !versionDetails)
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+
+ const description = isCurrentVersionActive ? currentVersionDescription : versionDetails?.description_html;
+ if (description === undefined || description?.trim() === "") return null;
+
+ return (
+
"}
+ containerClassName="p-0 pb-64 border-none"
+ editorClassName="pl-10"
+ workspaceSlug={workspaceSlug?.toString() ?? ""}
+ projectId={projectId?.toString() ?? ""}
+ />
+ );
+});
diff --git a/web/core/components/pages/version/editor.tsx b/web/core/components/editor/version-history/editors/page-version-editor.tsx
similarity index 84%
rename from web/core/components/pages/version/editor.tsx
rename to web/core/components/editor/version-history/editors/page-version-editor.tsx
index 697af9b1528..ecd6208855a 100644
--- a/web/core/components/pages/version/editor.tsx
+++ b/web/core/components/editor/version-history/editors/page-version-editor.tsx
@@ -1,27 +1,21 @@
import { observer } from "mobx-react";
import { useParams } from "next/navigation";
// plane editor
-import { DocumentReadOnlyEditorWithRef, TDisplayConfig } from "@plane/editor";
+import { DocumentReadOnlyEditorWithRef } from "@plane/editor";
// plane types
-import { IUserLite, TPageVersion } from "@plane/types";
+import { IUserLite } from "@plane/types";
// plane ui
import { Loader } from "@plane/ui";
// helpers
import { getReadOnlyEditorFileHandlers } from "@/helpers/editor.helper";
// hooks
import { useMember, useMention, useUser } from "@/hooks/store";
-import { usePageFilters } from "@/hooks/use-page-filters";
// plane web hooks
import { useIssueEmbed } from "@/plane-web/hooks/use-issue-embed";
+// local types
+import { TVersionEditorProps } from ".";
-export type TVersionEditorProps = {
- activeVersion: string | null;
- currentVersionDescription: string | null;
- isCurrentVersionActive: boolean;
- versionDetails: TPageVersion | undefined;
-};
-
-export const PagesVersionEditor: React.FC = observer((props) => {
+export const PageVersionEditor: React.FC = observer((props) => {
const { activeVersion, currentVersionDescription, isCurrentVersionActive, versionDetails } = props;
// params
const { workspaceSlug, projectId } = useParams();
@@ -43,13 +37,6 @@ export const PagesVersionEditor: React.FC = observer((props
members: projectMemberDetails,
user: currentUser ?? undefined,
});
- // page filters
- const { fontSize, fontStyle } = usePageFilters();
-
- const displayConfig: TDisplayConfig = {
- fontSize,
- fontStyle,
- };
if (!isCurrentVersionActive && !versionDetails)
return (
@@ -101,7 +88,6 @@ export const PagesVersionEditor: React.FC = observer((props
id={activeVersion ?? ""}
initialValue={description ?? ""}
containerClassName="p-0 pb-64 border-none"
- displayConfig={displayConfig}
editorClassName="pl-10"
fileHandler={getReadOnlyEditorFileHandlers({
projectId: projectId?.toString() ?? "",
diff --git a/web/core/components/pages/version/index.ts b/web/core/components/editor/version-history/index.ts
similarity index 85%
rename from web/core/components/pages/version/index.ts
rename to web/core/components/editor/version-history/index.ts
index 8e04e4de9e0..f18712f3527 100644
--- a/web/core/components/pages/version/index.ts
+++ b/web/core/components/editor/version-history/index.ts
@@ -1,4 +1,4 @@
-export * from "./editor";
+export * from "./editors";
export * from "./main-content";
export * from "./root";
export * from "./sidebar-list-item";
diff --git a/web/core/components/pages/version/main-content.tsx b/web/core/components/editor/version-history/main-content.tsx
similarity index 85%
rename from web/core/components/pages/version/main-content.tsx
rename to web/core/components/editor/version-history/main-content.tsx
index b36820fbbf6..6adecb62378 100644
--- a/web/core/components/pages/version/main-content.tsx
+++ b/web/core/components/editor/version-history/main-content.tsx
@@ -3,34 +3,34 @@ import { observer } from "mobx-react";
import useSWR from "swr";
import { TriangleAlert } from "lucide-react";
// plane types
-import { TPageVersion } from "@plane/types";
+import { TEditorVersion } from "@plane/types";
// plane ui
import { Button, setToast, TOAST_TYPE } from "@plane/ui";
-// components
-import { TVersionEditorProps } from "@/components/pages";
// helpers
import { renderFormattedDate, renderFormattedTime } from "@/helpers/date-time.helper";
+// local types
+import { TVersionEditorProps } from ".";
type Props = {
activeVersion: string | null;
currentVersionDescription: string | null;
editorComponent: React.FC;
- fetchVersionDetails: (pageId: string, versionId: string) => Promise;
+ entityId: string;
+ fetchVersionDetails: (entityId: string, versionId: string) => Promise;
handleClose: () => void;
handleRestore: (descriptionHTML: string) => Promise;
- pageId: string;
restoreEnabled: boolean;
};
-export const PageVersionsMainContent: React.FC = observer((props) => {
+export const EditorVersionHistoryMainContent: React.FC = observer((props) => {
const {
activeVersion,
currentVersionDescription,
editorComponent,
+ entityId,
fetchVersionDetails,
handleClose,
handleRestore,
- pageId,
restoreEnabled,
} = props;
// states
@@ -42,8 +42,8 @@ export const PageVersionsMainContent: React.FC = observer((props) => {
error: versionDetailsError,
mutate: mutateVersionDetails,
} = useSWR(
- pageId && activeVersion && activeVersion !== "current" ? `PAGE_VERSION_${activeVersion}` : null,
- pageId && activeVersion && activeVersion !== "current" ? () => fetchVersionDetails(pageId, activeVersion) : null
+ entityId && activeVersion && activeVersion !== "current" ? `EDITOR_VERSION_${activeVersion}` : null,
+ entityId && activeVersion && activeVersion !== "current" ? () => fetchVersionDetails(entityId, activeVersion) : null
);
const isCurrentVersionActive = activeVersion === "current";
@@ -55,14 +55,14 @@ export const PageVersionsMainContent: React.FC = observer((props) => {
.then(() => {
setToast({
type: TOAST_TYPE.SUCCESS,
- title: "Page version restored.",
+ title: "Version restored.",
});
handleClose();
})
.catch(() =>
setToast({
type: TOAST_TYPE.ERROR,
- title: "Failed to restore page version.",
+ title: "Failed to restore version.",
})
)
.finally(() => setIsRestoring(false));
diff --git a/web/core/components/pages/version/root.tsx b/web/core/components/editor/version-history/root.tsx
similarity index 69%
rename from web/core/components/pages/version/root.tsx
rename to web/core/components/editor/version-history/root.tsx
index e44e6320262..628e50a78d1 100644
--- a/web/core/components/pages/version/root.tsx
+++ b/web/core/components/editor/version-history/root.tsx
@@ -1,35 +1,35 @@
import { observer } from "mobx-react";
// plane types
-import { TPageVersion } from "@plane/types";
-// components
-import { PageVersionsMainContent, PageVersionsSidebarRoot, TVersionEditorProps } from "@/components/pages";
+import { TEditorVersion } from "@plane/types";
// helpers
import { cn } from "@/helpers/common.helper";
+// local components
+import { EditorVersionHistoryMainContent, EditorVersionHistorySidebarRoot, TVersionEditorProps } from ".";
type Props = {
activeVersion: string | null;
currentVersionDescription: string | null;
editorComponent: React.FC;
- fetchAllVersions: (pageId: string) => Promise;
- fetchVersionDetails: (pageId: string, versionId: string) => Promise;
+ entityId: string;
+ fetchAllVersions: (entityId: string) => Promise;
+ fetchVersionDetails: (entityId: string, versionId: string) => Promise;
handleRestore: (descriptionHTML: string) => Promise;
isOpen: boolean;
onClose: () => void;
- pageId: string;
restoreEnabled: boolean;
};
-export const PageVersionsOverlay: React.FC = observer((props) => {
+export const EditorVersionHistoryOverlay: React.FC = observer((props) => {
const {
activeVersion,
currentVersionDescription,
editorComponent,
+ entityId,
fetchAllVersions,
fetchVersionDetails,
handleRestore,
isOpen,
onClose,
- pageId,
restoreEnabled,
} = props;
@@ -46,22 +46,22 @@ export const PageVersionsOverlay: React.FC = observer((props) => {
}
)}
>
-
-
);
diff --git a/web/core/components/pages/version/sidebar-list-item.tsx b/web/core/components/editor/version-history/sidebar-list-item.tsx
similarity index 89%
rename from web/core/components/pages/version/sidebar-list-item.tsx
rename to web/core/components/editor/version-history/sidebar-list-item.tsx
index be11f57250c..f64bf7a1ba3 100644
--- a/web/core/components/pages/version/sidebar-list-item.tsx
+++ b/web/core/components/editor/version-history/sidebar-list-item.tsx
@@ -1,7 +1,7 @@
import { observer } from "mobx-react";
import Link from "next/link";
// plane types
-import { TPageVersion } from "@plane/types";
+import { TEditorVersion } from "@plane/types";
// plane ui
import { Avatar } from "@plane/ui";
// helpers
@@ -14,10 +14,10 @@ import { useMember } from "@/hooks/store";
type Props = {
href: string;
isActive: boolean;
- version: TPageVersion;
+ version: TEditorVersion;
};
-export const PlaneVersionsSidebarListItem: React.FC = observer((props) => {
+export const EditorVersionHistorySidebarListItem: React.FC = observer((props) => {
const { href, isActive, version } = props;
// store hooks
const { getUserDetails } = useMember();
diff --git a/web/core/components/pages/version/sidebar-list.tsx b/web/core/components/editor/version-history/sidebar-list.tsx
similarity index 83%
rename from web/core/components/pages/version/sidebar-list.tsx
rename to web/core/components/editor/version-history/sidebar-list.tsx
index cf276742b02..5bdd295d19d 100644
--- a/web/core/components/pages/version/sidebar-list.tsx
+++ b/web/core/components/editor/version-history/sidebar-list.tsx
@@ -3,25 +3,25 @@ import Link from "next/link";
import useSWR from "swr";
import { TriangleAlert } from "lucide-react";
// plane types
-import { TPageVersion } from "@plane/types";
+import { TEditorVersion } from "@plane/types";
// plane ui
import { Button, Loader } from "@plane/ui";
-// components
-import { PlaneVersionsSidebarListItem } from "@/components/pages";
// helpers
import { cn } from "@/helpers/common.helper";
// hooks
import { useQueryParams } from "@/hooks/use-query-params";
+// local components
+import { EditorVersionHistorySidebarListItem } from ".";
type Props = {
activeVersion: string | null;
- fetchAllVersions: (pageId: string) => Promise;
+ entityId: string;
+ fetchAllVersions: (entityId: string) => Promise;
isOpen: boolean;
- pageId: string;
};
-export const PageVersionsSidebarList: React.FC = (props) => {
- const { activeVersion, fetchAllVersions, isOpen, pageId } = props;
+export const EditorVersionHistorySidebarList: React.FC = (props) => {
+ const { activeVersion, entityId, fetchAllVersions, isOpen } = props;
// states
const [isRetrying, setIsRetrying] = useState(false);
// update query params
@@ -32,8 +32,8 @@ export const PageVersionsSidebarList: React.FC = (props) => {
error: versionsListError,
mutate: mutateVersionsList,
} = useSWR(
- pageId && isOpen ? `PAGE_VERSIONS_LIST_${pageId}` : null,
- pageId && isOpen ? () => fetchAllVersions(pageId) : null
+ entityId && isOpen ? `EDITOR_VERSIONS_LIST_${entityId}` : null,
+ entityId && isOpen ? () => fetchAllVersions(entityId) : null
);
const handleRetry = async () => {
@@ -78,7 +78,7 @@ export const PageVersionsSidebarList: React.FC = (props) => {
) : versionsList ? (
versionsList.map((version) => (
- Promise;
+ entityId: string;
+ fetchAllVersions: (entityId: string) => Promise;
handleClose: () => void;
isOpen: boolean;
- pageId: string;
};
-export const PageVersionsSidebarRoot: React.FC = (props) => {
- const { activeVersion, fetchAllVersions, handleClose, isOpen, pageId } = props;
+export const EditorVersionHistorySidebarRoot: React.FC = (props) => {
+ const { activeVersion, entityId, fetchAllVersions, handleClose, isOpen } = props;
return (
@@ -27,11 +27,11 @@ export const PageVersionsSidebarRoot: React.FC
= (props) => {
-
);
diff --git a/web/core/components/issues/issue-detail/index.ts b/web/core/components/issues/issue-detail/index.ts
index 7b85900437b..b2034f7b474 100644
--- a/web/core/components/issues/issue-detail/index.ts
+++ b/web/core/components/issues/issue-detail/index.ts
@@ -4,6 +4,7 @@ export * from "./links";
export * from "./parent";
export * from "./reactions";
export * from "./cycle-select";
+export * from "./issue-detail-quick-actions";
export * from "./main-content";
export * from "./module-select";
export * from "./parent-select";
@@ -11,4 +12,4 @@ export * from "./relation-select";
export * from "./root";
export * from "./sidebar";
export * from "./subscription";
-export * from "./issue-detail-quick-actions";
+export * from "./version-history";
diff --git a/web/core/components/issues/issue-detail/root.tsx b/web/core/components/issues/issue-detail/root.tsx
index 9db4b1ab9e9..c1b2df56f43 100644
--- a/web/core/components/issues/issue-detail/root.tsx
+++ b/web/core/components/issues/issue-detail/root.tsx
@@ -9,7 +9,7 @@ import { TIssue } from "@plane/types";
import { TOAST_TYPE, setPromiseToast, setToast } from "@plane/ui";
// components
import { EmptyState } from "@/components/common";
-import { IssuePeekOverview } from "@/components/issues";
+import { IssuePeekOverview, IssueVersionHistory } from "@/components/issues";
// constants
import { ISSUE_UPDATED, ISSUE_DELETED, ISSUE_ARCHIVED } from "@/constants/event-tracker";
import { EIssuesStoreType } from "@/constants/issue";
@@ -373,9 +373,10 @@ export const IssueDetailRoot: FC = observer((props) => {
)}
-
{/* peek overview */}
+ {/* version history overlay */}
+
>
);
});
diff --git a/web/core/components/issues/issue-detail/version-history.tsx b/web/core/components/issues/issue-detail/version-history.tsx
new file mode 100644
index 00000000000..4da63db8f5c
--- /dev/null
+++ b/web/core/components/issues/issue-detail/version-history.tsx
@@ -0,0 +1,82 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { useParams, useRouter, useSearchParams } from "next/navigation";
+// plane editor
+import { EditorReadOnlyRefApi, EditorRefApi } from "@plane/editor";
+// components
+import { EditorVersionHistoryOverlay, IssueVersionEditor } from "@/components/editor";
+// hooks
+import { useQueryParams } from "@/hooks/use-query-params";
+// services
+import { IssueVersionService } from "@/services/issue";
+const issueVersionService = new IssueVersionService();
+
+type Props = {
+ disabled: boolean;
+ editorRef: EditorRefApi;
+ issueId: string;
+ readOnlyEditorRef: EditorReadOnlyRefApi;
+};
+
+export const IssueVersionHistory: React.FC = (props) => {
+ const { disabled, editorRef, issueId, readOnlyEditorRef } = props;
+ // states
+ const [isVersionsOverlayOpen, setIsVersionsOverlayOpen] = useState(false);
+ // search params
+ const searchParams = useSearchParams();
+ // params
+ const { projectId, workspaceSlug } = useParams();
+ // router
+ const router = useRouter();
+ // update query params
+ const { updateQueryParams } = useQueryParams();
+
+ const version = searchParams.get("version");
+ useEffect(() => {
+ if (!version) {
+ setIsVersionsOverlayOpen(false);
+ return;
+ }
+ setIsVersionsOverlayOpen(true);
+ }, [version]);
+
+ const handleCloseVersionsOverlay = () => {
+ const updatedRoute = updateQueryParams({
+ paramsToRemove: ["version"],
+ });
+ router.push(updatedRoute);
+ };
+
+ const handleRestoreVersion = async (descriptionHTML: string) => {
+ editorRef?.clearEditor();
+ editorRef?.setEditorValue(descriptionHTML);
+ };
+ const currentVersionDescription = disabled ? readOnlyEditorRef?.getDocument().html : editorRef?.getDocument().html;
+
+ return (
+ {
+ if (!workspaceSlug || !projectId) return;
+ return await issueVersionService.fetchAllVersions(workspaceSlug.toString(), projectId.toString(), issueId);
+ }}
+ fetchVersionDetails={async (issueId, versionId) => {
+ if (!workspaceSlug || !projectId) return;
+ return await issueVersionService.fetchVersionById(
+ workspaceSlug.toString(),
+ projectId.toString(),
+ issueId,
+ versionId
+ );
+ }}
+ handleRestore={handleRestoreVersion}
+ isOpen={isVersionsOverlayOpen}
+ onClose={handleCloseVersionsOverlay}
+ restoreEnabled={!disabled}
+ />
+ );
+};
diff --git a/web/core/components/pages/editor/page-root.tsx b/web/core/components/pages/editor/page-root.tsx
index ff1f3519e93..093d6cca5cf 100644
--- a/web/core/components/pages/editor/page-root.tsx
+++ b/web/core/components/pages/editor/page-root.tsx
@@ -8,7 +8,8 @@ import { TPage } from "@plane/types";
// ui
import { setToast, TOAST_TYPE } from "@plane/ui";
// components
-import { PageEditorHeaderRoot, PageEditorBody, PageVersionsOverlay, PagesVersionEditor } from "@/components/pages";
+import { EditorVersionHistoryOverlay, PageVersionEditor } from "@/components/editor";
+import { PageEditorHeaderRoot, PageEditorBody } from "@/components/pages";
// hooks
import { useProjectPages } from "@/hooks/store";
import { useAppRouter } from "@/hooks/use-app-router";
@@ -105,10 +106,11 @@ export const PageRoot = observer((props: TPageRootProps) => {
return (
<>
- {
if (!workspaceSlug || !projectId) return;
return await projectPageVersionService.fetchAllVersions(
@@ -129,7 +131,6 @@ export const PageRoot = observer((props: TPageRootProps) => {
handleRestore={handleRestoreVersion}
isOpen={isVersionsOverlayOpen}
onClose={handleCloseVersionsOverlay}
- pageId={page.id ?? ""}
restoreEnabled={isContentEditable}
/>
{
+ return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/versions/`)
+ .then((response) => response?.data)
+ .catch((error) => {
+ throw error?.response?.data;
+ });
+ }
+
+ async fetchVersionById(
+ workspaceSlug: string,
+ projectId: string,
+ issueId: string,
+ versionId: string
+ ): Promise {
+ return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/issues/${issueId}/versions/${versionId}/`)
+ .then((response) => response?.data)
+ .catch((error) => {
+ throw error?.response?.data;
+ });
+ }
+}
diff --git a/web/core/services/page/project-page-version.service.ts b/web/core/services/page/project-page-version.service.ts
index 05732e3d225..4ee72cb45f4 100644
--- a/web/core/services/page/project-page-version.service.ts
+++ b/web/core/services/page/project-page-version.service.ts
@@ -1,5 +1,5 @@
// plane types
-import { TPageVersion } from "@plane/types";
+import { TEditorVersion } from "@plane/types";
// helpers
import { API_BASE_URL } from "@/helpers/common.helper";
// services
@@ -10,7 +10,7 @@ export class ProjectPageVersionService extends APIService {
super(API_BASE_URL);
}
- async fetchAllVersions(workspaceSlug: string, projectId: string, pageId: string): Promise {
+ async fetchAllVersions(workspaceSlug: string, projectId: string, pageId: string): Promise {
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/versions/`)
.then((response) => response?.data)
.catch((error) => {
@@ -23,7 +23,7 @@ export class ProjectPageVersionService extends APIService {
projectId: string,
pageId: string,
versionId: string
- ): Promise {
+ ): Promise {
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/pages/${pageId}/versions/${versionId}/`)
.then((response) => response?.data)
.catch((error) => {
From afdb3214c5164865d591388eac43e92f470ca3f8 Mon Sep 17 00:00:00 2001
From: Aaryan Khandelwal
Date: Thu, 28 Nov 2024 16:00:50 +0530
Subject: [PATCH 2/2] refactor: issue details root
---
web/core/components/issues/issue-detail/root.tsx | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/web/core/components/issues/issue-detail/root.tsx b/web/core/components/issues/issue-detail/root.tsx
index 24eecd194db..100c99f1a91 100644
--- a/web/core/components/issues/issue-detail/root.tsx
+++ b/web/core/components/issues/issue-detail/root.tsx
@@ -9,7 +9,7 @@ import { TIssue } from "@plane/types";
import { TOAST_TYPE, setPromiseToast, setToast } from "@plane/ui";
// components
import { EmptyState } from "@/components/common";
-import { IssuePeekOverview, IssueVersionHistory } from "@/components/issues";
+import { IssuePeekOverview } from "@/components/issues";
// constants
import { ISSUE_UPDATED, ISSUE_DELETED, ISSUE_ARCHIVED } from "@/constants/event-tracker";
import { EIssuesStoreType } from "@/constants/issue";
@@ -175,7 +175,7 @@ export const IssueDetailRoot: FC = observer((props) => {
},
path: pathname,
});
- } catch (error) {
+ } catch {
setToast({
type: TOAST_TYPE.ERROR,
title: "Error!",
@@ -204,7 +204,7 @@ export const IssueDetailRoot: FC = observer((props) => {
},
path: pathname,
});
- } catch (error) {
+ } catch {
setToast({
type: TOAST_TYPE.ERROR,
title: "Error!",
@@ -245,7 +245,7 @@ export const IssueDetailRoot: FC = observer((props) => {
},
path: pathname,
});
- } catch (error) {
+ } catch {
captureIssueEvent({
eventName: ISSUE_UPDATED,
payload: { state: "FAILED", element: "Issue detail page" },
@@ -281,7 +281,7 @@ export const IssueDetailRoot: FC = observer((props) => {
},
path: pathname,
});
- } catch (error) {
+ } catch {
captureIssueEvent({
eventName: ISSUE_UPDATED,
payload: { id: issueId, state: "FAILED", element: "Issue detail page" },
@@ -375,8 +375,6 @@ export const IssueDetailRoot: FC = observer((props) => {
)}
{/* peek overview */}
- {/* version history overlay */}
-
>
);
});