diff --git a/src/ui/MentionLabel/index.tsx b/src/ui/MentionLabel/index.tsx index 4e948c0a2..0bb385ceb 100644 --- a/src/ui/MentionLabel/index.tsx +++ b/src/ui/MentionLabel/index.tsx @@ -13,6 +13,7 @@ import Label, { LabelTypography, LabelColors } from '../Label'; import UserProfile from '../UserProfile'; import { classnames } from '../../utils/utils'; import useSendbird from '../../lib/Sendbird/context/hooks/useSendbird'; +import { useUserProfileContext } from '../../lib/UserProfileContext'; interface MentionLabelProps { mentionTemplate: string; @@ -29,6 +30,7 @@ export default function MentionLabel(props: MentionLabelProps): JSX.Element { isByMe, } = props; + const { disableUserProfile, renderUserProfile } = useUserProfileContext(); const mentionRef = useRef(); const { state } = useSendbird(); @@ -62,7 +64,11 @@ export default function MentionLabel(props: MentionLabelProps): JSX.Element { 'sendbird-word__mention', amIBeingMentioned && 'sendbird-word__mention--me', )} - onClick={() => fetchUser(toggleDropdown)} + onClick={() => { + if (!disableUserProfile) { + fetchUser(toggleDropdown); + } + }} ref={mentionRef} data-userid={mentionedUserId} data-nickname={mentionedUserNickname} @@ -76,23 +82,34 @@ export default function MentionLabel(props: MentionLabelProps): JSX.Element { )} - menuItems={(closeDropdown: () => void): ReactElement => ( - - - + menuItems={(closeDropdown) => ( + renderUserProfile + ? ( + renderUserProfile({ + user, + close: closeDropdown, + currentUserId: userId, + avatarRef: mentionRef, + }) + ) + : ( + + + + ) )} /> );