From 6c0955f87caa55ff44a6cd4112f945347f8e9d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 30 Oct 2024 16:57:46 +0100 Subject: [PATCH] pl-fe: Use longer wrench on long press MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../pl-fe/src/components/status-action-bar.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/pl-fe/src/components/status-action-bar.tsx b/packages/pl-fe/src/components/status-action-bar.tsx index d56ca7f67..08a72b903 100644 --- a/packages/pl-fe/src/components/status-action-bar.tsx +++ b/packages/pl-fe/src/components/status-action-bar.tsx @@ -365,6 +365,12 @@ const WrenchButton: React.FC = ({ const { openModal } = useModalsStore(); const { showWrenchButton } = useSettings(); + const hasLongerWrench = useAppSelector(({ custom_emojis }) => { + if (!features.customEmojiReacts) return null; + + return (custom_emojis.find(({ shortcode }) => shortcode === 'longestest_wrench') || custom_emojis.find(({ shortcode }) => shortcode === 'longest_wrench')); + }); + if (!me || withLabels || !features.emojiReacts || !showWrenchButton) return; const wrenches = showWrenchButton && status.emoji_reactions.find(emoji => emoji.name === '🔧') || undefined; @@ -377,9 +383,12 @@ const WrenchButton: React.FC = ({ } }; - const handleWrenchLongPress = wrenches?.count ? () => { - openModal('REACTIONS', { statusId: status.id, reaction: wrenches.name }); - } : undefined; + const handleWrenchLongPress = () => { + if (hasLongerWrench) dispatch(emojiReact(status, hasLongerWrench.shortcode, hasLongerWrench.url)); + else if (wrenches?.count) { + openModal('REACTIONS', { statusId: status.id, reaction: wrenches.name }); + } + }; return (