nostr-fools
Alex Gleason 2023-04-01 14:47:16 -05:00
rodzic 320afaed1c
commit 3d78a1cf16
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 26 dodań i 38 usunięć

Wyświetl plik

@ -4,7 +4,7 @@ import { simpleEmojiReact } from 'soapbox/actions/emoji-reacts';
import { openModal } from 'soapbox/actions/modals';
import { EmojiSelector, Portal } from 'soapbox/components/ui';
import { useAppDispatch, useAppSelector, useOwnAccount, useSoapboxConfig } from 'soapbox/hooks';
import { isUserTouching } from 'soapbox/is-mobile';
// import { isUserTouching } from 'soapbox/is-mobile';
import { getReactForStatus } from 'soapbox/utils/emoji-reacts';
interface IStatusReactionWrapper {
@ -34,31 +34,31 @@ const StatusReactionWrapper: React.FC<IStatusReactionWrapper> = ({ statusId, chi
if (!status) return null;
const handleMouseEnter = () => {
if (timeout.current) {
clearTimeout(timeout.current);
}
// const handleMouseEnter = () => {
// if (timeout.current) {
// clearTimeout(timeout.current);
// }
if (!isUserTouching()) {
setVisible(true);
}
};
// if (!isUserTouching()) {
// setVisible(true);
// }
// };
const handleMouseLeave = () => {
if (timeout.current) {
clearTimeout(timeout.current);
}
// const handleMouseLeave = () => {
// if (timeout.current) {
// clearTimeout(timeout.current);
// }
// Unless the user is touching, delay closing the emoji selector briefly
// so the user can move the mouse diagonally to make a selection.
if (isUserTouching()) {
setVisible(false);
} else {
timeout.current = setTimeout(() => {
setVisible(false);
}, 500);
}
};
// // Unless the user is touching, delay closing the emoji selector briefly
// // so the user can move the mouse diagonally to make a selection.
// if (isUserTouching()) {
// setVisible(false);
// } else {
// timeout.current = setTimeout(() => {
// setVisible(false);
// }, 500);
// }
// };
const handleReact = (emoji: string, custom?: string): void => {
if (ownAccount) {
@ -71,21 +71,9 @@ const StatusReactionWrapper: React.FC<IStatusReactionWrapper> = ({ statusId, chi
};
const handleClick: React.EventHandler<React.MouseEvent> = e => {
const meEmojiReact = getReactForStatus(status, soapboxConfig.allowedEmoji)?.get('name') || '👍';
const meEmojiReact = getReactForStatus(status, soapboxConfig.allowedEmoji)?.get('name') || '';
if (isUserTouching()) {
if (ownAccount) {
if (visible) {
handleReact(meEmojiReact);
} else {
setVisible(true);
}
} else {
handleUnauthorized();
}
} else {
handleReact(meEmojiReact);
}
handleReact(meEmojiReact);
e.preventDefault();
e.stopPropagation();
@ -99,7 +87,7 @@ const StatusReactionWrapper: React.FC<IStatusReactionWrapper> = ({ statusId, chi
};
return (
<div className='relative' onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>
<div className='relative'>
{React.cloneElement(children, {
onClick: handleClick,
ref: setReferenceElement,