diff --git a/src/api/nitro/room/widgets/handlers/RoomWidgetAvatarInfoHandler.ts b/src/api/nitro/room/widgets/handlers/RoomWidgetAvatarInfoHandler.ts index 6cbd73af..5ec47a95 100644 --- a/src/api/nitro/room/widgets/handlers/RoomWidgetAvatarInfoHandler.ts +++ b/src/api/nitro/room/widgets/handlers/RoomWidgetAvatarInfoHandler.ts @@ -1,5 +1,7 @@ -import { NitroEvent, RoomEngineUseProductEvent, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomSessionDanceEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserDataUpdateEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer'; +import { NitroEvent, RoomEngineUseProductEvent, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomSessionDanceEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserDataUpdateEvent, RoomWidgetEnum, SetRelationshipStatusComposer } from '@nitrots/nitro-renderer'; +import { SendMessageComposer } from '../../..'; import { GetRoomEngine, GetSessionDataManager, IsOwnerOfFurniture } from '../../../..'; +import { MessengerFriend } from '../../../../../components/friends/common/MessengerFriend'; import { FurniCategory } from '../../../../../components/inventory/common/FurniCategory'; import { RoomWidgetAvatarInfoEvent, RoomWidgetUpdateDanceStatusEvent, RoomWidgetUpdateEvent, RoomWidgetUpdateUserDataEvent, RoomWidgetUseProductBubbleEvent, UseProductItem } from '../events'; import { RoomWidgetAvatarExpressionMessage, RoomWidgetChangePostureMessage, RoomWidgetDanceMessage, RoomWidgetMessage, RoomWidgetRoomObjectMessage, RoomWidgetUseProductMessage, RoomWidgetUserActionMessage } from '../messages'; @@ -82,6 +84,22 @@ export class RoomWidgetAvatarInfoHandler extends RoomWidgetHandler this.container.roomSession.sendPostureMessage(postureMessage.posture); break; } + case RoomWidgetUserActionMessage.RELATIONSHIP_NONE: { + SendMessageComposer(new SetRelationshipStatusComposer(userId, MessengerFriend.RELATIONSHIP_NONE)); + break; + } + case RoomWidgetUserActionMessage.RELATIONSHIP_HEART: { + SendMessageComposer(new SetRelationshipStatusComposer(userId, MessengerFriend.RELATIONSHIP_HEART)); + break; + } + case RoomWidgetUserActionMessage.RELATIONSHIP_SMILE: { + SendMessageComposer(new SetRelationshipStatusComposer(userId, MessengerFriend.RELATIONSHIP_SMILE)); + break; + } + case RoomWidgetUserActionMessage.RELATIONSHIP_BOBBA: { + SendMessageComposer(new SetRelationshipStatusComposer(userId, MessengerFriend.RELATIONSHIP_BOBBA)); + break; + } } return null; @@ -206,6 +224,10 @@ export class RoomWidgetAvatarInfoHandler extends RoomWidgetHandler RoomWidgetDanceMessage.DANCE, RoomWidgetAvatarExpressionMessage.AVATAR_EXPRESSION, RoomWidgetChangePostureMessage.CHANGE_POSTURE, + RoomWidgetUserActionMessage.RELATIONSHIP_NONE, + RoomWidgetUserActionMessage.RELATIONSHIP_HEART, + RoomWidgetUserActionMessage.RELATIONSHIP_SMILE, + RoomWidgetUserActionMessage.RELATIONSHIP_BOBBA ]; } } diff --git a/src/api/nitro/room/widgets/messages/RoomWidgetUserActionMessage.ts b/src/api/nitro/room/widgets/messages/RoomWidgetUserActionMessage.ts index 540ad958..56fd89c7 100644 --- a/src/api/nitro/room/widgets/messages/RoomWidgetUserActionMessage.ts +++ b/src/api/nitro/room/widgets/messages/RoomWidgetUserActionMessage.ts @@ -48,6 +48,11 @@ export class RoomWidgetUserActionMessage extends RoomWidgetMessage public static AMBASSADOR_MUTE_USER_10MIN: string = 'RWUAM_AMBASSADOR_MUTE_10MIN'; public static AMBASSADOR_MUTE_USER_60MIN: string = 'RWUAM_AMBASSADOR_MUTE_60MIN'; public static AMBASSADOR_MUTE_USER_18HOUR: string = 'RWUAM_AMBASSADOR_MUTE_18HOUR'; + public static RELATIONSHIP_NONE: string = 'RWUAM_RELATIONSHIP_NONE'; + public static RELATIONSHIP_HEART: string = 'RWUAM_RELATIONSHIP_HEART'; + public static RELATIONSHIP_SMILE: string = 'RWUAM_RELATIONSHIP_SMILE'; + public static RELATIONSHIP_BOBBA: string = 'RWUAM_RELATIONSHIP_BOBBA'; + private _userId: number; diff --git a/src/components/room/widgets/avatar-info/AvatarInfoWidgetAvatarView.tsx b/src/components/room/widgets/avatar-info/AvatarInfoWidgetAvatarView.tsx index 44e4db4e..a1ec2437 100644 --- a/src/components/room/widgets/avatar-info/AvatarInfoWidgetAvatarView.tsx +++ b/src/components/room/widgets/avatar-info/AvatarInfoWidgetAvatarView.tsx @@ -2,6 +2,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { RoomControllerLevel, RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer'; import { FC, useEffect, useMemo, useState } from 'react'; import { GetOwnRoomObject, GetUserProfile, LocalizeText, RoomWidgetMessage, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUserActionMessage } from '../../../../api'; +import { Base, Flex } from '../../../../common'; import { BatchUpdates } from '../../../../hooks'; import { useRoomContext } from '../../RoomContext'; import { ContextMenuHeaderView } from '../context-menu/ContextMenuHeaderView'; @@ -20,6 +21,7 @@ const MODE_MODERATE_BAN = 2; const MODE_MODERATE_MUTE = 3; const MODE_AMBASSADOR = 4; const MODE_AMBASSADOR_MUTE = 5; +const MODE_RELATIONSHIP = 6; export const AvatarInfoWidgetAvatarView: FC = props => { @@ -108,6 +110,10 @@ export const AvatarInfoWidgetAvatarView: FC = p //userData.canBeAskedAsFriend = false; messageType = RoomWidgetUserActionMessage.SEND_FRIEND_REQUEST; break; + case 'relationship': + hideMenu = false; + setMode(MODE_RELATIONSHIP); + break; case 'respect': let newRespectsLeft = 0; @@ -182,6 +188,19 @@ export const AvatarInfoWidgetAvatarView: FC = p case 'ambassador_mute_18hour': messageType = RoomWidgetUserActionMessage.AMBASSADOR_MUTE_USER_18HOUR; break; + case 'rship_heart': + messageType = RoomWidgetUserActionMessage.RELATIONSHIP_HEART; + break; + case 'rship_smile': + messageType = RoomWidgetUserActionMessage.RELATIONSHIP_SMILE; + break; + case 'rship_bobba': + messageType = RoomWidgetUserActionMessage.RELATIONSHIP_BOBBA; + break; + case 'rship_none': + messageType = RoomWidgetUserActionMessage.RELATIONSHIP_NONE; + console.log('here') + break; } if(messageType) message = new RoomWidgetUserActionMessage(messageType, userData.webID); @@ -204,7 +223,7 @@ export const AvatarInfoWidgetAvatarView: FC = p return ( GetUserProfile(userData.webID) }> - { userData.name } + {userData.name} { (mode === MODE_NORMAL) && <> @@ -221,6 +240,11 @@ export const AvatarInfoWidgetAvatarView: FC = p { (respectsLeft > 0) && processAction('respect') }> { LocalizeText('infostand.button.respect', [ 'count' ], [ respectsLeft.toString() ]) } + } + { !userData.canBeAskedAsFriend && + processAction('relationship') }> + {LocalizeText('infostand.link.relationship')} + } { !userData.isIgnored && processAction('ignore') }> @@ -340,6 +364,27 @@ export const AvatarInfoWidgetAvatarView: FC = p { LocalizeText('generic.back') } + } + { (mode === MODE_RELATIONSHIP) && + <> + + processAction('rship_heart')}> + + + processAction('rship_smile')}> + + + processAction('rship_bobba')}> + + + + processAction('rship_none')}> + { LocalizeText('avatar.widget.clear_relationship') } + + processAction('back')}> + + { LocalizeText('generic.back') } + } );