pl-fe: open reactions modal on reaction button long press
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
643f5b8936
commit
fe29e692ca
3 changed files with 15 additions and 0 deletions
|
@ -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",
|
||||
|
|
|
@ -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<IStatusReaction> = ({ 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<HTMLButtonElement> = (e) => {
|
||||
|
@ -74,6 +82,7 @@ const StatusReaction: React.FC<IStatusReaction> = ({ reaction, status, obfuscate
|
|||
count: reaction.count,
|
||||
})}
|
||||
disabled={unauthenticated}
|
||||
{...bind}
|
||||
>
|
||||
<Emoji className='h-4 w-4' emoji={reaction.name} src={reaction.url || undefined} />
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue