Skip to content

Commit 92645c1

Browse files
authored
chore: add page flag hook (#6354)
1 parent ac14d57 commit 92645c1

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

web/ce/constants/page.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

web/ce/hooks/use-page-flag.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export type TPageFlagHookArgs = {
2+
workspaceSlug: string;
3+
};
4+
5+
export type TPageFlagHookReturnType = {
6+
isMovePageEnabled: boolean;
7+
};
8+
9+
export const usePageFlag = (args: TPageFlagHookArgs): TPageFlagHookReturnType => {
10+
const {} = args;
11+
return {
12+
isMovePageEnabled: false,
13+
};
14+
};

web/core/components/pages/dropdowns/actions.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { useMemo, useState } from "react";
44
import { observer } from "mobx-react";
5+
import { useParams } from "next/navigation";
56
import {
67
ArchiveRestoreIcon,
78
Copy,
@@ -28,8 +29,8 @@ import { cn } from "@/helpers/common.helper";
2829
import { usePageOperations } from "@/hooks/use-page-operations";
2930
// plane web components
3031
import { MovePageModal } from "@/plane-web/components/pages";
31-
// plane web constants
32-
import { ENABLE_MOVE_PAGE } from "@/plane-web/constants";
32+
// plane web hooks
33+
import { usePageFlag } from "@/plane-web/hooks/use-page-flag";
3334
// store types
3435
import { TPageInstance } from "@/store/pages/base-page";
3536

@@ -60,6 +61,12 @@ export const PageActions: React.FC<Props> = observer((props) => {
6061
// states
6162
const [deletePageModal, setDeletePageModal] = useState(false);
6263
const [movePageModal, setMovePageModal] = useState(false);
64+
// params
65+
const { workspaceSlug } = useParams();
66+
// page flag
67+
const { isMovePageEnabled } = usePageFlag({
68+
workspaceSlug: workspaceSlug?.toString() ?? "",
69+
});
6370
// page operations
6471
const { pageOperations } = usePageOperations({
6572
editorRef,
@@ -134,7 +141,7 @@ export const PageActions: React.FC<Props> = observer((props) => {
134141
action: () => setMovePageModal(true),
135142
title: "Move",
136143
icon: FileOutput,
137-
shouldRender: canCurrentUserMovePage && ENABLE_MOVE_PAGE,
144+
shouldRender: canCurrentUserMovePage && isMovePageEnabled,
138145
},
139146
];
140147
if (extraOptions) {
@@ -146,6 +153,7 @@ export const PageActions: React.FC<Props> = observer((props) => {
146153
archived_at,
147154
extraOptions,
148155
is_locked,
156+
isMovePageEnabled,
149157
canCurrentUserArchivePage,
150158
canCurrentUserChangeAccess,
151159
canCurrentUserDeletePage,

web/ee/constants/page.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

web/ee/hooks/use-page-flag.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "ce/hooks/use-page-flag";

0 commit comments

Comments
 (0)