pl-fe: Use longer wrench on long press
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
fca9db1d67
commit
6c0955f87c
1 changed files with 12 additions and 3 deletions
|
@ -365,6 +365,12 @@ const WrenchButton: React.FC<IActionButton> = ({
|
||||||
const { openModal } = useModalsStore();
|
const { openModal } = useModalsStore();
|
||||||
const { showWrenchButton } = useSettings();
|
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;
|
if (!me || withLabels || !features.emojiReacts || !showWrenchButton) return;
|
||||||
|
|
||||||
const wrenches = showWrenchButton && status.emoji_reactions.find(emoji => emoji.name === '🔧') || undefined;
|
const wrenches = showWrenchButton && status.emoji_reactions.find(emoji => emoji.name === '🔧') || undefined;
|
||||||
|
@ -377,9 +383,12 @@ const WrenchButton: React.FC<IActionButton> = ({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleWrenchLongPress = wrenches?.count ? () => {
|
const handleWrenchLongPress = () => {
|
||||||
openModal('REACTIONS', { statusId: status.id, reaction: wrenches.name });
|
if (hasLongerWrench) dispatch(emojiReact(status, hasLongerWrench.shortcode, hasLongerWrench.url));
|
||||||
} : undefined;
|
else if (wrenches?.count) {
|
||||||
|
openModal('REACTIONS', { statusId: status.id, reaction: wrenches.name });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StatusActionButton
|
<StatusActionButton
|
||||||
|
|
Loading…
Reference in a new issue