diff --git a/src/api/room/widgets/AvatarInfoName.ts b/src/api/room/widgets/AvatarInfoName.ts index 66a6a7e3..b34ec734 100644 --- a/src/api/room/widgets/AvatarInfoName.ts +++ b/src/api/room/widgets/AvatarInfoName.ts @@ -6,6 +6,7 @@ export class AvatarInfoName public readonly id: number, public readonly name: string, public readonly userType: number, - public readonly isFriend: boolean = false) + public readonly isFriend: boolean = false, + public readonly relationshipStatus: number = 0) {} } diff --git a/src/components/room/widgets/avatar-info/menu/AvatarInfoWidgetNameView.tsx b/src/components/room/widgets/avatar-info/menu/AvatarInfoWidgetNameView.tsx index 00e115bd..c20cab69 100644 --- a/src/components/room/widgets/avatar-info/menu/AvatarInfoWidgetNameView.tsx +++ b/src/components/room/widgets/avatar-info/menu/AvatarInfoWidgetNameView.tsx @@ -1,5 +1,5 @@ import { FC, useMemo } from 'react'; -import { AvatarInfoName, GetSessionDataManager } from '../../../../../api'; +import { AvatarInfoName, GetSessionDataManager, MessengerFriend } from '../../../../../api'; import { ContextMenuView } from '../../context-menu/ContextMenuView'; interface AvatarInfoWidgetNameViewProps @@ -17,12 +17,25 @@ export const AvatarInfoWidgetNameView: FC = props const newClassNames: string[] = [ 'name-only' ]; if(nameInfo.isFriend) newClassNames.push('is-friend'); + switch(nameInfo.relationshipStatus) + { + case MessengerFriend.RELATIONSHIP_HEART: + newClassNames.push('is-heart'); + break; + case MessengerFriend.RELATIONSHIP_SMILE: + newClassNames.push('is-smile'); + break; + case MessengerFriend.RELATIONSHIP_BOBBA: + newClassNames.push('is-bobba'); + break; + } return newClassNames; }, [ nameInfo ]); return ( +
{ nameInfo.name }
diff --git a/src/components/room/widgets/context-menu/ContextMenu.scss b/src/components/room/widgets/context-menu/ContextMenu.scss index 975343a9..04c053a9 100644 --- a/src/components/room/widgets/context-menu/ContextMenu.scss +++ b/src/components/room/widgets/context-menu/ContextMenu.scss @@ -18,10 +18,33 @@ width: unset; text-align: center; font-size: 18px; + display: flex; + align-items: center; &.is-friend { background-color: rgba($green, 0.5); } + + &.is-heart { + .relation-icon { + display: block; + background-position: -5px -67px; + } + } + + &.is-smile { + .relation-icon { + display: block; + background-position: -57px -67px; + } + } + + &.is-bobba { + .relation-icon { + display: block; + background-position: -96px -5px; + } + } } &:not(.name-only):not(.menu-hidden) { @@ -126,4 +149,11 @@ } } } + + .relation-icon { + display: none; + background: url('@/assets/images/friends/friends-spritesheet.png') transparent no-repeat; + width: 16px; height: 14px; + margin-right: 3px; + } } diff --git a/src/hooks/rooms/widgets/useAvatarInfoWidget.ts b/src/hooks/rooms/widgets/useAvatarInfoWidget.ts index 82061e91..6c8f09c1 100644 --- a/src/hooks/rooms/widgets/useAvatarInfoWidget.ts +++ b/src/hooks/rooms/widgets/useAvatarInfoWidget.ts @@ -123,9 +123,10 @@ const useAvatarInfoWidgetState = () => { if(user.webID === GetSessionDataManager().userId) return; - if(friends.find(friend => (friend.id === user.webID))) + const addedNameBubblesUserFriend = friends.find(friend => (friend.id === user.webID)); + if (addedNameBubblesUserFriend) { - addedNameBubbles.push(new AvatarInfoName(user.roomIndex, RoomObjectCategory.UNIT, user.webID, user.name, user.type, true)); + addedNameBubbles.push(new AvatarInfoName(user.roomIndex, RoomObjectCategory.UNIT, user.webID, user.name, user.type, true, addedNameBubblesUserFriend.relationshipStatus)); } });