diff --git a/app/soapbox/actions/profile_hover_card.js b/app/soapbox/actions/profile_hover_card.js index 83b81d984..90543148d 100644 --- a/app/soapbox/actions/profile_hover_card.js +++ b/app/soapbox/actions/profile_hover_card.js @@ -1,5 +1,6 @@ export const PROFILE_HOVER_CARD_OPEN = 'PROFILE_HOVER_CARD_OPEN'; -export const PROFILE_HOVER_CARD_CLEAR = 'PROFILE_HOVER_CARD_CLEAR'; +export const PROFILE_HOVER_CARD_UPDATE = 'PROFILE_HOVER_CARD_UPDATE'; +export const PROFILE_HOVER_CARD_CLOSE = 'PROFILE_HOVER_CARD_CLOSE'; export function openProfileHoverCard(ref, accountId) { return { @@ -9,8 +10,15 @@ export function openProfileHoverCard(ref, accountId) { }; } -export function clearProfileHoverCard() { +export function updateProfileHoverCard() { return { - type: PROFILE_HOVER_CARD_CLEAR, + type: PROFILE_HOVER_CARD_UPDATE, + }; +} + +export function closeProfileHoverCard(force = false) { + return { + type: PROFILE_HOVER_CARD_CLOSE, + force, }; } diff --git a/app/soapbox/components/profile_hover_card.js b/app/soapbox/components/profile_hover_card.js index c62a36422..ae3f8bc3a 100644 --- a/app/soapbox/components/profile_hover_card.js +++ b/app/soapbox/components/profile_hover_card.js @@ -11,7 +11,10 @@ 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'; +import { + closeProfileHoverCard, + updateProfileHoverCard, +} from 'soapbox/actions/profile_hover_card'; const getAccount = makeGetAccount(); @@ -23,9 +26,15 @@ const getBadges = (account) => { return badges; }; +const handleMouseEnter = (dispatch) => { + return e => { + dispatch(updateProfileHoverCard()); + }; +}; + const handleMouseLeave = (dispatch) => { return e => { - dispatch(clearProfileHoverCard()); + dispatch(closeProfileHoverCard(true)); }; }; @@ -57,7 +66,7 @@ export const ProfileHoverCard = ({ visible }) => { const followedBy = account.getIn(['relationship', 'followed_by']); return ( -