|
@@ -16,6 +16,7 @@ import TriangleIcon from '~/components/Icons/TriangleIcon';
|
|
|
import {
|
|
import {
|
|
|
IPageHasId, IPageInfoAll, IPageToDeleteWithMeta,
|
|
IPageHasId, IPageInfoAll, IPageToDeleteWithMeta,
|
|
|
} from '~/interfaces/page';
|
|
} from '~/interfaces/page';
|
|
|
|
|
+import { useSWRxCurrentUserBookmarks } from '~/stores/bookmark';
|
|
|
import { IPageForPageDuplicateModal } from '~/stores/modal';
|
|
import { IPageForPageDuplicateModal } from '~/stores/modal';
|
|
|
import { useSWRxPageChildren } from '~/stores/page-listing';
|
|
import { useSWRxPageChildren } from '~/stores/page-listing';
|
|
|
import { usePageTreeDescCountMap } from '~/stores/ui';
|
|
import { usePageTreeDescCountMap } from '~/stores/ui';
|
|
@@ -57,12 +58,6 @@ const markTarget = (children: ItemNode[], targetPathOrId?: string): void => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-const bookmarkMenuItemClickHandler = async(_pageId: string, _newValue: boolean): Promise<void> => {
|
|
|
|
|
- const bookmarkOperation = _newValue ? bookmark : unbookmark;
|
|
|
|
|
- await bookmarkOperation(_pageId);
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* Return new page path after the droppedPagePath is moved under the newParentPagePath
|
|
* Return new page path after the droppedPagePath is moved under the newParentPagePath
|
|
|
* @param droppedPagePath
|
|
* @param droppedPagePath
|
|
@@ -111,6 +106,7 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
const [isCreating, setCreating] = useState(false);
|
|
const [isCreating, setCreating] = useState(false);
|
|
|
|
|
|
|
|
const { data, mutate: mutateChildren } = useSWRxPageChildren(isOpen ? page._id : null);
|
|
const { data, mutate: mutateChildren } = useSWRxPageChildren(isOpen ? page._id : null);
|
|
|
|
|
+ const { mutate: mutateCurrentUserBookmarks } = useSWRxCurrentUserBookmarks();
|
|
|
|
|
|
|
|
// descendantCount
|
|
// descendantCount
|
|
|
const { getDescCount } = usePageTreeDescCountMap();
|
|
const { getDescCount } = usePageTreeDescCountMap();
|
|
@@ -238,6 +234,12 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
|
|
|
}
|
|
}
|
|
|
}, [hasDescendants]);
|
|
}, [hasDescendants]);
|
|
|
|
|
|
|
|
|
|
+ const bookmarkMenuItemClickHandler = async(_pageId: string, _newValue: boolean): Promise<void> => {
|
|
|
|
|
+ const bookmarkOperation = _newValue ? bookmark : unbookmark;
|
|
|
|
|
+ await bookmarkOperation(_pageId);
|
|
|
|
|
+ mutateCurrentUserBookmarks();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
const duplicateMenuItemClickHandler = useCallback((): void => {
|
|
const duplicateMenuItemClickHandler = useCallback((): void => {
|
|
|
if (onClickDuplicateMenuItem == null) {
|
|
if (onClickDuplicateMenuItem == null) {
|
|
|
return;
|
|
return;
|