chore: add page flag hook (#6354)
This commit is contained in:
parent
ac14d57f8b
commit
92645c1cee
5 changed files with 26 additions and 5 deletions
|
|
@ -1 +0,0 @@
|
|||
export const ENABLE_MOVE_PAGE = false;
|
||||
14
web/ce/hooks/use-page-flag.ts
Normal file
14
web/ce/hooks/use-page-flag.ts
Normal file
|
|
@ -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,
|
||||
};
|
||||
};
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
export * from "ce/constants/page";
|
||||
1
web/ee/hooks/use-page-flag.ts
Normal file
1
web/ee/hooks/use-page-flag.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "ce/hooks/use-page-flag";
|
||||
Loading…
Add table
Add a link
Reference in a new issue