From a6deb34558655a25a83a77ee16a57d0dcd94b80f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 11 Sep 2024 17:32:59 +0200 Subject: [PATCH] pl-fe: fix status reactions for unauthenticated users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../src/components/status-reactions-bar.tsx | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/packages/pl-fe/src/components/status-reactions-bar.tsx b/packages/pl-fe/src/components/status-reactions-bar.tsx index c897d61544..838068fe27 100644 --- a/packages/pl-fe/src/components/status-reactions-bar.tsx +++ b/packages/pl-fe/src/components/status-reactions-bar.tsx @@ -6,7 +6,7 @@ import { defineMessages, useIntl } from 'react-intl'; import { emojiReact, unEmojiReact } from 'pl-fe/actions/emoji-reacts'; import EmojiPickerDropdown from 'pl-fe/features/emoji/containers/emoji-picker-dropdown-container'; import unicodeMapping from 'pl-fe/features/emoji/mapping'; -import { useAppDispatch, useSettings } from 'pl-fe/hooks'; +import { useAppDispatch, useLoggedIn, useSettings } from 'pl-fe/hooks'; import AnimatedNumber from './animated-number'; import { Emoji, HStack, Icon, Text } from './ui'; @@ -28,9 +28,10 @@ interface IStatusReaction { status: Pick; reaction: EmojiReaction; obfuscate?: boolean; + disabled?: boolean; } -const StatusReaction: React.FC = ({ reaction, status, obfuscate }) => { +const StatusReaction: React.FC = ({ reaction, status, obfuscate, disabled }) => { const dispatch = useAppDispatch(); const intl = useIntl(); @@ -39,6 +40,8 @@ const StatusReaction: React.FC = ({ reaction, status, obfuscate const handleClick: React.MouseEventHandler = (e) => { e.stopPropagation(); + if (disabled) return; + if (reaction.me) { dispatch(unEmojiReact(status, reaction.name)); } else { @@ -57,8 +60,11 @@ const StatusReaction: React.FC = ({ reaction, status, obfuscate return ( - + {me && ( + + + + )} ); };