From f168ae57e63e2da571c77b9c703cbd69fb2aa948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 3 Oct 2024 21:22:26 +0200 Subject: [PATCH] pl-fe: do not display reactions bar when not supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-fe/src/components/status-reactions-bar.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/pl-fe/src/components/status-reactions-bar.tsx b/packages/pl-fe/src/components/status-reactions-bar.tsx index e48e1bf64..579f2cf09 100644 --- a/packages/pl-fe/src/components/status-reactions-bar.tsx +++ b/packages/pl-fe/src/components/status-reactions-bar.tsx @@ -1,6 +1,5 @@ import { useLongPress } from '@uidotdev/usehooks'; import clsx from 'clsx'; -import { EmojiReaction } from 'pl-api'; import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; @@ -13,6 +12,7 @@ import { useModalsStore } from 'pl-fe/stores'; import AnimatedNumber from './animated-number'; import { Emoji, HStack, Icon, Text } from './ui'; +import type { EmojiReaction } from 'pl-api'; import type { Emoji as EmojiType } from 'pl-fe/features/emoji'; import type { SelectedStatus } from 'pl-fe/selectors'; @@ -103,12 +103,14 @@ const StatusReactionsBar: React.FC = ({ status, collapsed } const intl = useIntl(); const { me } = useLoggedIn(); const { demetricator } = useSettings(); + const features = useFeatures(); const handlePickEmoji = (emoji: EmojiType) => { dispatch(emojiReact(status, emoji.custom ? emoji.id : emoji.native, emoji.custom ? emoji.imageUrl : undefined)); }; if ((demetricator || status.emoji_reactions.length === 0) && collapsed) return null; + if (status.emoji_reactions.length === 0 && !features.emojiReacts) return null; const sortedReactions = status.emoji_reactions.toSorted((a, b) => (b.count || 0) - (a.count || 0));