Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

chore: add page flag hook (#6354)

Aaryan Khandelwal92645c1cee6f
diff --git a/web/ce/constants/page.ts b/web/ce/constants/page.ts
deleted file mode 100644
index bd4312fb71..0000000000
--- a/web/ce/constants/page.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const ENABLE_MOVE_PAGE = false;
diff --git a/web/ce/hooks/use-page-flag.ts b/web/ce/hooks/use-page-flag.ts
new file mode 100644
index 0000000000..84dc31c0d2
--- /dev/null
+++ b/web/ce/hooks/use-page-flag.ts
@@ -0,0 +1,14 @@
+export type TPageFlagHookArgs = {
+ workspaceSlug: string;
+};
+
+export type TPageFlagHookReturnType = {
+ isMovePageEnabled: boolean;
+};
+
+export const usePageFlag = (args: TPageFlagHookArgs): TPageFlagHookReturnType => {
+ const {} = args;
+ return {
+ isMovePageEnabled: false,
+ };
+};
diff --git a/web/core/components/pages/dropdowns/actions.tsx b/web/core/components/pages/dropdowns/actions.tsx
index 410dda68df..e4af59abe6 100644
--- a/web/core/components/pages/dropdowns/actions.tsx
+++ b/web/core/components/pages/dropdowns/actions.tsx
@@ -2,6 +2,7 @@
import { useMemo, useState } from "react";
import { observer } from "mobx-react";
+import { useParams } from "next/navigation";
import {
ArchiveRestoreIcon,
Copy,
@@ -28,8 +29,8 @@ import { cn } from "@/helpers/common.helper";
import { usePageOperations } from "@/hooks/use-page-operations";
// plane web components
import { MovePageModal } from "@/plane-web/components/pages";
-// plane web constants
-import { ENABLE_MOVE_PAGE } from "@/plane-web/constants";
+// plane web hooks
+import { usePageFlag } from "@/plane-web/hooks/use-page-flag";
// store types
import { TPageInstance } from "@/store/pages/base-page";
@@ -60,6 +61,12 @@ export const PageActions: React.FC<Props> = observer((props) => {
// states
const [deletePageModal, setDeletePageModal] = useState(false);
const [movePageModal, setMovePageModal] = useState(false);
+ // params
+ const { workspaceSlug } = useParams();
+ // page flag
+ const { isMovePageEnabled } = usePageFlag({
+ workspaceSlug: workspaceSlug?.toString() ?? "",
+ });
// page operations
const { pageOperations } = usePageOperations({
editorRef,
@@ -134,7 +141,7 @@ export const PageActions: React.FC<Props> = observer((props) => {
action: () => setMovePageModal(true),
title: "Move",
icon: FileOutput,
- shouldRender: canCurrentUserMovePage && ENABLE_MOVE_PAGE,
+ shouldRender: canCurrentUserMovePage && isMovePageEnabled,
},
];
if (extraOptions) {
@@ -146,6 +153,7 @@ export const PageActions: React.FC<Props> = observer((props) => {
archived_at,
extraOptions,
is_locked,
+ isMovePageEnabled,
canCurrentUserArchivePage,
canCurrentUserChangeAccess,
canCurrentUserDeletePage,
diff --git a/web/ee/constants/page.ts b/web/ee/constants/page.ts
deleted file mode 100644
index 12e6cb712d..0000000000
--- a/web/ee/constants/page.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "ce/constants/page";
diff --git a/web/ee/hooks/use-page-flag.ts b/web/ee/hooks/use-page-flag.ts
new file mode 100644
index 0000000000..5dbd3aef24
--- /dev/null
+++ b/web/ee/hooks/use-page-flag.ts
@@ -0,0 +1 @@
+export * from "ce/hooks/use-page-flag";