Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions web/core/hooks/use-page-operations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useMemo } from "react";
import { useParams } from "next/navigation";
// plane editor
import { EditorRefApi } from "@plane/editor";
// plane types
Expand Down Expand Up @@ -34,15 +33,22 @@ export const usePageOperations = (
pageOperations: TPageOperations;
} => {
const { page } = props;
// params
const { workspaceSlug, projectId } = useParams();
// derived values
const { access, addToFavorites, archived_at, duplicate, id, is_favorite, is_locked, removePageFromFavorites } = page;
const {
access,
addToFavorites,
archived_at,
duplicate,
is_favorite,
is_locked,
getRedirectionLink,
removePageFromFavorites,
} = page;
// collaborative actions
const { executeCollaborativeAction } = useCollaborativePageActions(props);
// page operations
const pageOperations: TPageOperations = useMemo(() => {
const pageLink = projectId ? `${workspaceSlug}/projects/${projectId}/pages/${id}` : `${workspaceSlug}/pages/${id}`;
const pageLink = getRedirectionLink();

return {
copyLink: () => {
Expand Down Expand Up @@ -184,12 +190,10 @@ export const usePageOperations = (
archived_at,
duplicate,
executeCollaborativeAction,
id,
getRedirectionLink,
is_favorite,
is_locked,
projectId,
removePageFromFavorites,
workspaceSlug,
]);
return {
pageOperations,
Expand Down
Loading