diff --git a/app/soapbox/components/profile_hover_card.js b/app/soapbox/components/profile_hover_card.js index c6319d38b..c62a36422 100644 --- a/app/soapbox/components/profile_hover_card.js +++ b/app/soapbox/components/profile_hover_card.js @@ -11,6 +11,7 @@ import Badge from 'soapbox/components/badge'; import classNames from 'classnames'; import { fetchRelationships } from 'soapbox/actions/accounts'; import { usePopper } from 'react-popper'; +import { clearProfileHoverCard } from 'soapbox/actions/profile_hover_card'; const getAccount = makeGetAccount(); @@ -22,13 +23,19 @@ const getBadges = (account) => { return badges; }; +const handleMouseLeave = (dispatch) => { + return e => { + dispatch(clearProfileHoverCard()); + }; +}; + export const ProfileHoverCard = ({ visible }) => { const dispatch = useDispatch(); const [popperElement, setPopperElement] = useState(null); const accountId = useSelector(state => state.getIn(['profile_hover_card', 'accountId'])); - const account = useSelector(state => accountId && getAccount(state, accountId)); + const account = useSelector(state => accountId && getAccount(state, accountId)); const targetRef = useSelector(state => state.getIn(['profile_hover_card', 'ref'])); const badges = account ? getBadges(account) : []; @@ -36,14 +43,21 @@ export const ProfileHoverCard = ({ visible }) => { if (accountId) dispatch(fetchRelationships([accountId])); }, [dispatch, accountId]); - const { styles, attributes } = usePopper(targetRef, popperElement); + const { styles, attributes } = usePopper(targetRef, popperElement, { + modifiers: [{ + name: 'offset', + options: { + offset: [-100, 0], + }, + }], + }); if (!account) return null; const accountBio = { __html: account.get('note_emojified') }; const followedBy = account.getIn(['relationship', 'followed_by']); return ( -