|
@@ -1,21 +1,25 @@
|
|
|
import React, { FC, useState } from 'react';
|
|
import React, { FC, useState } from 'react';
|
|
|
|
|
|
|
|
|
|
+import { Types } from 'mongoose';
|
|
|
import { UncontrolledTooltip, Popover, PopoverBody } from 'reactstrap';
|
|
import { UncontrolledTooltip, Popover, PopoverBody } from 'reactstrap';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
import UserPictureList from './User/UserPictureList';
|
|
import UserPictureList from './User/UserPictureList';
|
|
|
import { toastError } from '~/client/util/apiNotification';
|
|
import { toastError } from '~/client/util/apiNotification';
|
|
|
-import { usePageId, useIsGuestUser } from '~/stores/context';
|
|
|
|
|
|
|
+import { useIsGuestUser } from '~/stores/context';
|
|
|
import { useSWRxBookmarksInfo } from '~/stores/bookmarks';
|
|
import { useSWRxBookmarksInfo } from '~/stores/bookmarks';
|
|
|
import { apiv3Put } from '~/client/util/apiv3-client';
|
|
import { apiv3Put } from '~/client/util/apiv3-client';
|
|
|
|
|
|
|
|
|
|
+interface Props {
|
|
|
|
|
+ pageId: Types.ObjectId
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-const BookmarkButton: FC = () => {
|
|
|
|
|
|
|
+const BookmarkButton: FC<Props> = (props: Props) => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
|
|
+ const { pageId } = props;
|
|
|
|
|
|
|
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
|
|
|
|
|
|
- const { data: pageId } = usePageId();
|
|
|
|
|
const { data: isGuestUser } = useIsGuestUser();
|
|
const { data: isGuestUser } = useIsGuestUser();
|
|
|
const { data: bookmarksInfo, mutate } = useSWRxBookmarksInfo(pageId);
|
|
const { data: bookmarksInfo, mutate } = useSWRxBookmarksInfo(pageId);
|
|
|
|
|
|