Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: react action bugs (#5851)
Kilu.He87e950733f3c
diff --git a/frontend/appflowy_web_app/src/components/global-comment/actions/ReactAction.tsx b/frontend/appflowy_web_app/src/components/global-comment/actions/ReactAction.tsxindex 6ab0ff412e..f0726926fc 100644--- a/frontend/appflowy_web_app/src/components/global-comment/actions/ReactAction.tsx+++ b/frontend/appflowy_web_app/src/components/global-comment/actions/ReactAction.tsx@@ -3,15 +3,18 @@ import { EmojiPicker } from '@/components/_shared/emoji-picker';import { EMOJI_SIZE, PER_ROW_EMOJI_COUNT } from '@/components/_shared/emoji-picker/const';import { Popover } from '@/components/_shared/popover';import ComponentLoading from '@/components/_shared/progress/ComponentLoading';+import { AFConfigContext } from '@/components/app/AppConfig';import { useGlobalCommentContext } from '@/components/global-comment/GlobalComment.hooks';import { ReactComponent as AddReactionRounded } from '@/assets/add_reaction.svg';import { IconButton, Tooltip } from '@mui/material';-import React, { memo, Suspense, useCallback } from 'react';+import React, { memo, Suspense, useCallback, useContext } from 'react';import { useTranslation } from 'react-i18next';function ReactAction({ comment }: { comment: GlobalComment }) {const { toggleReaction } = useGlobalCommentContext();const { t } = useTranslation();+ const isAuthenticated = useContext(AFConfigContext)?.isAuthenticated || false;+ const openLoginModal = useContext(AFConfigContext)?.openLoginModal;const ref = React.useRef<HTMLButtonElement>(null);const [open, setOpen] = React.useState(false);const handleClose = useCallback(() => {@@ -19,6 +22,13 @@ function ReactAction({ comment }: { comment: GlobalComment }) {}, []);const handleOpen = () => {+ if (!isAuthenticated && openLoginModal) {+ const url = window.location.href + '#comment-' + comment.commentId;++ openLoginModal(url);+ return;+ }+setOpen(true);};