[WEB-1019] chore: error state for unauthorized pages (#4219)
* chore: private page access * chore: add error state for private pages --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
This commit is contained in:
parent
1080094b01
commit
1880eb7704
7 changed files with 226 additions and 184 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { observer } from "mobx-react";
|
||||
import { Clipboard, Copy, Link, Lock } from "lucide-react";
|
||||
import { ArchiveRestoreIcon, Clipboard, Copy, Link, Lock, LockOpen } from "lucide-react";
|
||||
// document editor
|
||||
import { EditorReadOnlyRefApi, EditorRefApi } from "@plane/document-editor";
|
||||
// ui
|
||||
|
|
@ -21,6 +21,9 @@ export const PageOptionsDropdown: React.FC<Props> = observer((props) => {
|
|||
const { editorRef, handleDuplicatePage, pageStore } = props;
|
||||
// store values
|
||||
const {
|
||||
archived_at,
|
||||
is_locked,
|
||||
id,
|
||||
archive,
|
||||
lock,
|
||||
unlock,
|
||||
|
|
@ -99,7 +102,7 @@ export const PageOptionsDropdown: React.FC<Props> = observer((props) => {
|
|||
{
|
||||
key: "copy-page-link",
|
||||
action: () => {
|
||||
copyUrlToClipboard(`${workspaceSlug}/projects/${projectId}/pages/${pageStore.id}`).then(() =>
|
||||
copyUrlToClipboard(`${workspaceSlug}/projects/${projectId}/pages/${id}`).then(() =>
|
||||
setToast({
|
||||
type: TOAST_TYPE.SUCCESS,
|
||||
title: "Successful!",
|
||||
|
|
@ -119,32 +122,18 @@ export const PageOptionsDropdown: React.FC<Props> = observer((props) => {
|
|||
shouldRender: canCurrentUserDuplicatePage,
|
||||
},
|
||||
{
|
||||
key: "lock-page",
|
||||
action: handleLockPage,
|
||||
label: "Lock page",
|
||||
icon: Lock,
|
||||
shouldRender: !pageStore.is_locked && canCurrentUserLockPage,
|
||||
key: "lock-unlock-page",
|
||||
action: is_locked ? handleUnlockPage : handleLockPage,
|
||||
label: is_locked ? "Unlock page" : "Lock page",
|
||||
icon: is_locked ? LockOpen : Lock,
|
||||
shouldRender: canCurrentUserLockPage,
|
||||
},
|
||||
{
|
||||
key: "unlock-page",
|
||||
action: handleUnlockPage,
|
||||
label: "Unlock page",
|
||||
icon: Lock,
|
||||
shouldRender: pageStore.is_locked && canCurrentUserLockPage,
|
||||
},
|
||||
{
|
||||
key: "archive-page",
|
||||
action: handleArchivePage,
|
||||
label: "Archive page",
|
||||
icon: ArchiveIcon,
|
||||
shouldRender: !pageStore.archived_at && canCurrentUserArchivePage,
|
||||
},
|
||||
{
|
||||
key: "restore-page",
|
||||
action: handleRestorePage,
|
||||
label: "Restore page",
|
||||
icon: ArchiveIcon,
|
||||
shouldRender: !!pageStore.archived_at && canCurrentUserArchivePage,
|
||||
key: "archive-restore-page",
|
||||
action: archived_at ? handleRestorePage : handleArchivePage,
|
||||
label: archived_at ? "Restore page" : "Archive page",
|
||||
icon: archived_at ? ArchiveRestoreIcon : ArchiveIcon,
|
||||
shouldRender: canCurrentUserArchivePage,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
@ -166,7 +155,7 @@ export const PageOptionsDropdown: React.FC<Props> = observer((props) => {
|
|||
return (
|
||||
<CustomMenu.MenuItem key={item.key} onClick={item.action} className="flex items-center gap-2">
|
||||
<item.icon className="h-3 w-3" />
|
||||
<div className="text-custom-text-300">{item.label}</div>
|
||||
{item.label}
|
||||
</CustomMenu.MenuItem>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue