Add check for decorate mode button

This commit is contained in:
Bill 2021-09-30 02:10:23 -04:00
parent b107c2b713
commit e94cdbf4be

View File

@ -1,5 +1,5 @@
import { AvatarAction, AvatarExpressionEnum, RoomObjectCategory, UserProfileComposer } from '@nitrots/nitro-renderer'; import { AvatarAction, AvatarExpressionEnum, RoomControllerLevel, RoomObjectCategory, UserProfileComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useMemo, useState } from 'react';
import { GetCanStandUp, GetCanUseExpression, GetOwnPosture, HasHabboClub, HasHabboVip, IsRidingHorse, LocalizeText, RoomWidgetAvatarExpressionMessage, RoomWidgetChangePostureMessage, RoomWidgetDanceMessage, RoomWidgetMessage, RoomWidgetUpdateDecorateModeEvent, RoomWidgetUserActionMessage } from '../../../../../../api'; import { GetCanStandUp, GetCanUseExpression, GetOwnPosture, HasHabboClub, HasHabboVip, IsRidingHorse, LocalizeText, RoomWidgetAvatarExpressionMessage, RoomWidgetChangePostureMessage, RoomWidgetDanceMessage, RoomWidgetMessage, RoomWidgetUpdateDecorateModeEvent, RoomWidgetUserActionMessage } from '../../../../../../api';
import { AvatarEditorEvent } from '../../../../../../events'; import { AvatarEditorEvent } from '../../../../../../events';
import { dispatchUiEvent, SendMessageHook } from '../../../../../../hooks'; import { dispatchUiEvent, SendMessageHook } from '../../../../../../hooks';
@ -108,6 +108,11 @@ export const AvatarInfoWidgetOwnAvatarView: FC<AvatarInfoWidgetOwnAvatarViewProp
SendMessageHook(new UserProfileComposer(userData.webID)); SendMessageHook(new UserProfileComposer(userData.webID));
}, [ userData ]); }, [ userData ]);
const isShowDecorate = useMemo(() =>
{
return (userData.amIOwner || userData.amIAnyRoomController || (userData.roomControllerLevel > RoomControllerLevel.GUEST));
}, [ userData ]);
const isRidingHorse = IsRidingHorse(); const isRidingHorse = IsRidingHorse();
return ( return (
@ -121,9 +126,10 @@ export const AvatarInfoWidgetOwnAvatarView: FC<AvatarInfoWidgetOwnAvatarViewProp
<ContextMenuListItemView onClick={ event => processAction('change_name') }> <ContextMenuListItemView onClick={ event => processAction('change_name') }>
{ LocalizeText('widget.avatar.change_name') } { LocalizeText('widget.avatar.change_name') }
</ContextMenuListItemView> } </ContextMenuListItemView> }
<ContextMenuListItemView onClick={ event => processAction('decorate') }> { isShowDecorate &&
{ LocalizeText('widget.avatar.decorate') } <ContextMenuListItemView onClick={ event => processAction('decorate') }>
</ContextMenuListItemView> { LocalizeText('widget.avatar.decorate') }
</ContextMenuListItemView> }
<ContextMenuListItemView onClick={ event => processAction('change_looks') }> <ContextMenuListItemView onClick={ event => processAction('change_looks') }>
{ LocalizeText('widget.memenu.myclothes') } { LocalizeText('widget.memenu.myclothes') }
</ContextMenuListItemView> </ContextMenuListItemView>