diff --git a/packages/pl-fe/package.json b/packages/pl-fe/package.json index 79ce793719..d17bc97a71 100644 --- a/packages/pl-fe/package.json +++ b/packages/pl-fe/package.json @@ -94,6 +94,7 @@ "@types/redux-mock-store": "^1.0.6", "@types/semver": "^7.3.9", "@types/uuid": "^9.0.0", + "@uidotdev/usehooks": "^2.4.1", "@vitejs/plugin-react": "^4.0.4", "@webbtc/webln-types": "^3.0.0", "autoprefixer": "^10.4.15", diff --git a/packages/pl-fe/src/components/status-reactions-bar.tsx b/packages/pl-fe/src/components/status-reactions-bar.tsx index d045c6a065..fae8ecfe11 100644 --- a/packages/pl-fe/src/components/status-reactions-bar.tsx +++ b/packages/pl-fe/src/components/status-reactions-bar.tsx @@ -1,3 +1,4 @@ +import { useLongPress } from '@uidotdev/usehooks'; import clsx from 'clsx'; import { EmojiReaction } from 'pl-api'; import React from 'react'; @@ -36,6 +37,13 @@ const StatusReaction: React.FC = ({ reaction, status, obfuscate const dispatch = useAppDispatch(); const intl = useIntl(); + const bind = useLongPress((e) => { + if (e.type !== 'touchstart') return; + + e.stopPropagation(); + dispatch(openModal('REACTIONS', { statusId: status.id, reaction: reaction.name })); + }); + if (!reaction.count) return null; const handleClick: React.MouseEventHandler = (e) => { @@ -74,6 +82,7 @@ const StatusReaction: React.FC = ({ reaction, status, obfuscate count: reaction.count, })} disabled={unauthenticated} + {...bind} > diff --git a/packages/pl-fe/yarn.lock b/packages/pl-fe/yarn.lock index 4acd315c8f..9b576a27bd 100644 --- a/packages/pl-fe/yarn.lock +++ b/packages/pl-fe/yarn.lock @@ -3005,6 +3005,11 @@ "@typescript-eslint/types" "7.0.1" eslint-visitor-keys "^3.4.1" +"@uidotdev/usehooks@^2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@uidotdev/usehooks/-/usehooks-2.4.1.tgz#4b733eaeae09a7be143c6c9ca158b56cc1ea75bf" + integrity sha512-1I+RwWyS+kdv3Mv0Vmc+p0dPYH0DTRAo04HLyXReYBL9AeseDWUJyi4THuksBJcu9F0Pih69Ak150VDnqbVnXg== + "@ungap/structured-clone@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406"