Skip to content

Commit

Permalink
refactor: types and enums added
Browse files Browse the repository at this point in the history
  • Loading branch information
aaryan610 committed Dec 19, 2024
1 parent 63c59df commit 732da3e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions web/core/components/pages/dropdowns/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ export const PageActions: React.FC<Props> = observer((props) => {
{
key: "archive-restore",
action: pageOperations.toggleArchive,
title: !!archived_at ? "Restore" : "Archive",
icon: !!archived_at ? ArchiveRestoreIcon : ArchiveIcon,
title: archived_at ? "Restore" : "Archive",
icon: archived_at ? ArchiveRestoreIcon : ArchiveIcon,
shouldRender: canCurrentUserArchivePage,
},
{
Expand Down
2 changes: 1 addition & 1 deletion web/core/components/pages/editor/header/mobile-root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const PageEditorMobileHeaderRoot: React.FC<Props> = observer((props) => {
<PageExtraOptions editorRef={editorRef} page={page} />
</Header>
<Header variant={EHeaderVariant.TERNARY}>
{isContentEditable && editorRef && <PageToolbar editorRef={editorRef as EditorRefApi} />}
{isContentEditable && editorRef && <PageToolbar editorRef={editorRef} />}
</Header>
</>
);
Expand Down
7 changes: 5 additions & 2 deletions web/core/hooks/use-page-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { useMemo } from "react";
import { useParams } from "next/navigation";
// plane editor
import { EditorRefApi } from "@plane/editor";
// plane types
import { EPageAccess } from "@plane/types/src/enums";
// plane ui
import { setToast, TOAST_TYPE } from "@plane/ui";
// helpers
Expand Down Expand Up @@ -71,9 +73,10 @@ export const usePageOperations = (
move: async () => {},
openInNewTab: () => window.open(`/${pageLink}`, "_blank"),
toggleAccess: async () => {
const changedPageType = access === 0 ? "private" : "public";
const changedPageType = access === EPageAccess.PUBLIC ? "private" : "public";
try {
if (access === 0) await executeCollaborativeAction({ type: "sendMessageToServer", message: "make-private" });
if (access === EPageAccess.PUBLIC)
await executeCollaborativeAction({ type: "sendMessageToServer", message: "make-private" });
else await executeCollaborativeAction({ type: "sendMessageToServer", message: "make-public" });

setToast({
Expand Down

0 comments on commit 732da3e

Please sign in to comment.