mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-27 08:00:51 +01:00
Update widgets
This commit is contained in:
parent
3fc5fdd68e
commit
5fc3a95d2f
@ -1,5 +1,6 @@
|
|||||||
import { AvatarExpressionEnum, HabboClubLevelEnum, NitroEvent, RoomControllerLevel, RoomSessionChatEvent, RoomSettingsComposer, RoomZoomEvent } from 'nitro-renderer';
|
import { AvatarExpressionEnum, HabboClubLevelEnum, NitroEvent, RoomControllerLevel, RoomSessionChatEvent, RoomSettingsComposer, RoomZoomEvent } from 'nitro-renderer';
|
||||||
import { GetConnection, GetRoomEngine, GetSessionDataManager } from '../../../api';
|
import { GetRoomEngine, GetSessionDataManager } from '../../../api';
|
||||||
|
import { SendMessageHook } from '../../../hooks/messages';
|
||||||
import { RoomWidgetFloodControlEvent, RoomWidgetUpdateEvent } from '../events';
|
import { RoomWidgetFloodControlEvent, RoomWidgetUpdateEvent } from '../events';
|
||||||
import { RoomWidgetChatMessage, RoomWidgetChatSelectAvatarMessage, RoomWidgetChatTypingMessage, RoomWidgetMessage, RoomWidgetRequestWidgetMessage } from '../messages';
|
import { RoomWidgetChatMessage, RoomWidgetChatSelectAvatarMessage, RoomWidgetChatTypingMessage, RoomWidgetMessage, RoomWidgetRequestWidgetMessage } from '../messages';
|
||||||
import { RoomWidgetHandler } from './RoomWidgetHandler';
|
import { RoomWidgetHandler } from './RoomWidgetHandler';
|
||||||
@ -148,7 +149,7 @@ export class RoomWidgetChatInputHandler extends RoomWidgetHandler
|
|||||||
case ':settings':
|
case ':settings':
|
||||||
if(this.container.roomSession.isRoomOwner || GetSessionDataManager().isModerator)
|
if(this.container.roomSession.isRoomOwner || GetSessionDataManager().isModerator)
|
||||||
{
|
{
|
||||||
GetConnection().send(new RoomSettingsComposer(this.container.roomSession.roomId));
|
SendMessageHook(new RoomSettingsComposer(this.container.roomSession.roomId));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
export class PetSupplementEnum
|
||||||
|
{
|
||||||
|
public static WATER: number = 0;
|
||||||
|
public static LIGHT: number = 1;
|
||||||
|
}
|
@ -103,8 +103,6 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
|||||||
return newRespectsLeft;
|
return newRespectsLeft;
|
||||||
});
|
});
|
||||||
|
|
||||||
//userData.respectLeft--;
|
|
||||||
|
|
||||||
messageType = RoomWidgetUserActionMessage.RESPECT_USER;
|
messageType = RoomWidgetUserActionMessage.RESPECT_USER;
|
||||||
|
|
||||||
if(newRespectsLeft > 0) hideMenu = false;
|
if(newRespectsLeft > 0) hideMenu = false;
|
||||||
|
@ -1,9 +1,235 @@
|
|||||||
import { FC } from 'react';
|
import { PetType, RoomObjectCategory, RoomObjectVariable } from 'nitro-renderer';
|
||||||
|
import { FC, useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
|
import { GetOwnRoomObject } from '../../../../../../api';
|
||||||
|
import { LocalizeText } from '../../../../../../utils/LocalizeText';
|
||||||
|
import { useRoomContext } from '../../../../context/RoomContext';
|
||||||
|
import { RoomWidgetMessage, RoomWidgetUserActionMessage } from '../../../../messages';
|
||||||
|
import { ContextMenuView } from '../../../context-menu/ContextMenuView';
|
||||||
|
import { ContextMenuHeaderView } from '../../../context-menu/views/header/ContextMenuHeaderView';
|
||||||
|
import { ContextMenuListItemView } from '../../../context-menu/views/list-item/ContextMenuListItemView';
|
||||||
import { AvatarInfoWidgetOwnPetViewProps } from './AvatarInfoWidgetOwnPetView.types';
|
import { AvatarInfoWidgetOwnPetViewProps } from './AvatarInfoWidgetOwnPetView.types';
|
||||||
|
|
||||||
|
const _Str_2906: number = 0;
|
||||||
|
const _Str_5818: number = 1;
|
||||||
|
const _Str_5938: number = 2;
|
||||||
|
const _Str_10946: number = 3;
|
||||||
|
|
||||||
export const AvatarInfoWidgetOwnPetView: FC<AvatarInfoWidgetOwnPetViewProps> = props =>
|
export const AvatarInfoWidgetOwnPetView: FC<AvatarInfoWidgetOwnPetViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { petData = null } = props;
|
const { petData = null, close = null } = props;
|
||||||
|
const [ mode, setMode ] = useState(_Str_2906);
|
||||||
|
const [ respectsLeft, setRespectsLeft ] = useState(0);
|
||||||
|
const { roomSession = null, widgetHandler = null } = useRoomContext();
|
||||||
|
|
||||||
return null;
|
useEffect(() =>
|
||||||
|
{
|
||||||
|
setMode(prevValue =>
|
||||||
|
{
|
||||||
|
if(petData.petType === PetType.MONSTERPLANT) return _Str_10946;
|
||||||
|
else if(petData.saddle && !petData.rider) return _Str_5818;
|
||||||
|
else if(petData.rider) return _Str_5938;
|
||||||
|
|
||||||
|
return _Str_2906;
|
||||||
|
});
|
||||||
|
|
||||||
|
setRespectsLeft(petData.respectsPetLeft);
|
||||||
|
}, [ petData ])
|
||||||
|
|
||||||
|
const processAction = useCallback((name: string) =>
|
||||||
|
{
|
||||||
|
let messageType: string = null;
|
||||||
|
let message: RoomWidgetMessage = null;
|
||||||
|
let hideMenu = true;
|
||||||
|
|
||||||
|
if(name)
|
||||||
|
{
|
||||||
|
switch(name)
|
||||||
|
{
|
||||||
|
case 'respect':
|
||||||
|
let newRespectsLeft = 0;
|
||||||
|
|
||||||
|
setRespectsLeft(prevValue =>
|
||||||
|
{
|
||||||
|
newRespectsLeft = (prevValue - 1);
|
||||||
|
|
||||||
|
return newRespectsLeft;
|
||||||
|
});
|
||||||
|
|
||||||
|
messageType = RoomWidgetUserActionMessage.RESPECT_PET;
|
||||||
|
|
||||||
|
if(newRespectsLeft > 0) hideMenu = false;
|
||||||
|
break;
|
||||||
|
case 'treat':
|
||||||
|
messageType = RoomWidgetUserActionMessage.TREAT_PET;
|
||||||
|
break;
|
||||||
|
case 'pass_handitem':
|
||||||
|
messageType = RoomWidgetUserActionMessage.GIVE_CARRY_ITEM_TO_PET;
|
||||||
|
break;
|
||||||
|
case 'train':
|
||||||
|
//this.widget._Str_23877();
|
||||||
|
break;
|
||||||
|
case 'pick_up':
|
||||||
|
messageType = RoomWidgetUserActionMessage.PICKUP_PET;
|
||||||
|
//this.widget._Str_25401();
|
||||||
|
break;
|
||||||
|
case 'mount':
|
||||||
|
messageType = RoomWidgetUserActionMessage.MOUNT_PET;
|
||||||
|
break;
|
||||||
|
case 'toggle_riding_permission':
|
||||||
|
messageType = RoomWidgetUserActionMessage.TOGGLE_PET_RIDING_PERMISSION;
|
||||||
|
// update riding checkbox
|
||||||
|
break;
|
||||||
|
case 'toggle_breeding_permission':
|
||||||
|
messageType = RoomWidgetUserActionMessage.TOGGLE_PET_BREEDING_PERMISSION
|
||||||
|
// update breeding checkbox;
|
||||||
|
break;
|
||||||
|
case 'dismount':
|
||||||
|
messageType = RoomWidgetUserActionMessage.DISMOUNT_PET;
|
||||||
|
break;
|
||||||
|
case 'saddle_off':
|
||||||
|
messageType = RoomWidgetUserActionMessage.SADDLE_OFF;
|
||||||
|
break;
|
||||||
|
case 'breed':
|
||||||
|
if(mode === _Str_2906)
|
||||||
|
{
|
||||||
|
// _local_7 = RoomWidgetPetCommandMessage._Str_16282;
|
||||||
|
// _local_8 = ("pet.command." + _local_7);
|
||||||
|
// _local_9 = _Str_2268.catalog.localization.getLocalization(_local_8);
|
||||||
|
// _local_4 = new RoomWidgetPetCommandMessage(RoomWidgetPetCommandMessage.RWPCM_PET_COMMAND, this._Str_594.id, ((this._Str_594.name + " ") + _local_9));
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(mode === _Str_10946)
|
||||||
|
{
|
||||||
|
messageType = RoomWidgetUserActionMessage.REQUEST_BREED_PET;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'harvest':
|
||||||
|
messageType = RoomWidgetUserActionMessage.HARVEST_PET;
|
||||||
|
break;
|
||||||
|
case 'revive':
|
||||||
|
messageType = RoomWidgetUserActionMessage.REVIVE_PET;
|
||||||
|
break;
|
||||||
|
case 'compost':
|
||||||
|
messageType = RoomWidgetUserActionMessage.COMPOST_PLANT;
|
||||||
|
break;
|
||||||
|
case 'buy_saddle':
|
||||||
|
//this.openCatalogPage(this._Str_11220);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(messageType) message = new RoomWidgetUserActionMessage(messageType, petData.id);
|
||||||
|
|
||||||
|
if(message) widgetHandler.processWidgetMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hideMenu) close();
|
||||||
|
}, [ widgetHandler, petData, mode, close ]);
|
||||||
|
|
||||||
|
const canGiveHandItem = useMemo(() =>
|
||||||
|
{
|
||||||
|
let flag = false;
|
||||||
|
|
||||||
|
const roomObject = GetOwnRoomObject();
|
||||||
|
|
||||||
|
if(roomObject)
|
||||||
|
{
|
||||||
|
const carryId = roomObject.model.getValue<number>(RoomObjectVariable.FIGURE_CARRY_OBJECT);
|
||||||
|
|
||||||
|
if((carryId > 0) && (carryId < 999999)) flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return flag;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ContextMenuView objectId={ petData.roomIndex } category={ RoomObjectCategory.UNIT } close={ close }>
|
||||||
|
<ContextMenuHeaderView>
|
||||||
|
{ petData.name }
|
||||||
|
</ContextMenuHeaderView>
|
||||||
|
{ (mode === _Str_2906) &&
|
||||||
|
<>
|
||||||
|
{ (respectsLeft > 0) &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('respect') }>
|
||||||
|
{ LocalizeText('infostand.button.petrespect', [ 'count' ], [ respectsLeft.toString() ]) }
|
||||||
|
</ContextMenuListItemView> }
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('train') }>
|
||||||
|
{ LocalizeText('infostand.button.train') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('pick_up') }>
|
||||||
|
{ LocalizeText('infostand.button.pickup') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
{ (petData.petType === PetType.HORSE) &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('buy_saddle') }>
|
||||||
|
{ LocalizeText('infostand.button.buy_saddle') }
|
||||||
|
</ContextMenuListItemView> }
|
||||||
|
{ ([ PetType.BEAR, PetType.TERRIER, PetType.CAT, PetType.DOG, PetType.PIG].indexOf(petData.petType) > -1) &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('breed') }>
|
||||||
|
{ LocalizeText('infostand.button.breed') }
|
||||||
|
</ContextMenuListItemView> }
|
||||||
|
</> }
|
||||||
|
{ (mode === _Str_5818) &&
|
||||||
|
<>
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('mount') }>
|
||||||
|
{ LocalizeText('infostand.button.mount') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('toggle_riding_permission') }>
|
||||||
|
{ LocalizeText('infostand.button.toggle_riding_permission') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
{ (respectsLeft > 0) &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('respect') }>
|
||||||
|
{ LocalizeText('infostand.button.petrespect', [ 'count' ], [ respectsLeft.toString() ]) }
|
||||||
|
</ContextMenuListItemView> }
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('train') }>
|
||||||
|
{ LocalizeText('infostand.button.train') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('pick_up') }>
|
||||||
|
{ LocalizeText('infostand.button.pickup') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('saddle_off') }>
|
||||||
|
{ LocalizeText('infostand.button.saddle_off') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
</> }
|
||||||
|
{ (mode === _Str_5938) &&
|
||||||
|
<>
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('dismount') }>
|
||||||
|
{ LocalizeText('infostand.button.dismount') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
{ (respectsLeft > 0) &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('respect') }>
|
||||||
|
{ LocalizeText('infostand.button.petrespect', [ 'count' ], [ respectsLeft.toString() ]) }
|
||||||
|
</ContextMenuListItemView> }
|
||||||
|
</> }
|
||||||
|
{ (mode === _Str_10946) &&
|
||||||
|
<>
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('pick_up') }>
|
||||||
|
{ LocalizeText('infostand.button.pickup') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
{ petData.dead &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('revive') }>
|
||||||
|
{ LocalizeText('infostand.button.revive') }
|
||||||
|
</ContextMenuListItemView> }
|
||||||
|
{ roomSession.isRoomOwner &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('compost') }>
|
||||||
|
{ LocalizeText('infostand.button.compost') }
|
||||||
|
</ContextMenuListItemView> }
|
||||||
|
{ !petData.dead && ((petData.energy / petData.maximumEnergy) < 0.98) &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('treat') }>
|
||||||
|
{ LocalizeText('infostand.button.treat') }
|
||||||
|
</ContextMenuListItemView> }
|
||||||
|
{ !petData.dead && (petData.level === petData.maximumLevel) && petData.breedable &&
|
||||||
|
<>
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('toggle_breeding_permission') }>
|
||||||
|
{ LocalizeText('infostand.button.toggle_breeding_permission') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('breed') }>
|
||||||
|
{ LocalizeText('infostand.button.breed') }
|
||||||
|
</ContextMenuListItemView>
|
||||||
|
</> }
|
||||||
|
</> }
|
||||||
|
{ canGiveHandItem &&
|
||||||
|
<ContextMenuListItemView onClick={ event => processAction('pass_hand_item') }>
|
||||||
|
{ LocalizeText('infostand.button.pass_hand_item') }
|
||||||
|
</ContextMenuListItemView> }
|
||||||
|
</ContextMenuView>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { BotCommandConfigurationEvent, BotRemoveComposer, BotSkillSaveComposer, Nitro, RequestBotCommandConfigurationComposer, RoomObjectCategory } from 'nitro-renderer';
|
import { BotCommandConfigurationEvent, BotRemoveComposer, BotSkillSaveComposer, Nitro, RequestBotCommandConfigurationComposer, RoomObjectCategory } from 'nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
import { FC, useCallback, useEffect, useState } from 'react';
|
||||||
import { GetConnection } from '../../../../../../api';
|
import { CreateMessageHook, SendMessageHook } from '../../../../../../hooks/messages';
|
||||||
import { CreateMessageHook } from '../../../../../../hooks/messages';
|
|
||||||
import { LocalizeText } from '../../../../../../utils/LocalizeText';
|
import { LocalizeText } from '../../../../../../utils/LocalizeText';
|
||||||
import { useRoomContext } from '../../../../context/RoomContext';
|
import { useRoomContext } from '../../../../context/RoomContext';
|
||||||
import { RoomWidgetUpdateRentableBotChatEvent } from '../../../../events';
|
import { RoomWidgetUpdateRentableBotChatEvent } from '../../../../events';
|
||||||
@ -73,7 +72,7 @@ export const AvatarInfoWidgetRentableBotView: FC<AvatarInfoWidgetRentableBotView
|
|||||||
|
|
||||||
const requestBotCommandConfiguration = useCallback((skillType: number) =>
|
const requestBotCommandConfiguration = useCallback((skillType: number) =>
|
||||||
{
|
{
|
||||||
GetConnection().send(new RequestBotCommandConfigurationComposer(rentableBotData.webID, skillType));
|
SendMessageHook(new RequestBotCommandConfigurationComposer(rentableBotData.webID, skillType));
|
||||||
}, [ rentableBotData ]);
|
}, [ rentableBotData ]);
|
||||||
|
|
||||||
const processAction = useCallback((name: string) =>
|
const processAction = useCallback((name: string) =>
|
||||||
@ -86,45 +85,45 @@ export const AvatarInfoWidgetRentableBotView: FC<AvatarInfoWidgetRentableBotView
|
|||||||
{
|
{
|
||||||
case 'donate_to_all':
|
case 'donate_to_all':
|
||||||
requestBotCommandConfiguration(BotSkillsEnum.DONATE_TO_ALL);
|
requestBotCommandConfiguration(BotSkillsEnum.DONATE_TO_ALL);
|
||||||
GetConnection().send(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.DONATE_TO_ALL, ''));
|
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.DONATE_TO_ALL, ''));
|
||||||
break;
|
break;
|
||||||
case 'donate_to_user':
|
case 'donate_to_user':
|
||||||
requestBotCommandConfiguration(BotSkillsEnum.DONATE_TO_USER);
|
requestBotCommandConfiguration(BotSkillsEnum.DONATE_TO_USER);
|
||||||
GetConnection().send(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.DONATE_TO_USER, ''));
|
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.DONATE_TO_USER, ''));
|
||||||
break;
|
break;
|
||||||
case 'change_bot_name':
|
case 'change_bot_name':
|
||||||
requestBotCommandConfiguration(BotSkillsEnum.CHANGE_BOT_NAME);
|
requestBotCommandConfiguration(BotSkillsEnum.CHANGE_BOT_NAME);
|
||||||
hideMenu = false;
|
hideMenu = false;
|
||||||
break;
|
break;
|
||||||
case 'save_bot_name':
|
case 'save_bot_name':
|
||||||
GetConnection().send(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.CHANGE_BOT_NAME, newName));
|
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.CHANGE_BOT_NAME, newName));
|
||||||
break;
|
break;
|
||||||
case 'change_bot_motto':
|
case 'change_bot_motto':
|
||||||
requestBotCommandConfiguration(BotSkillsEnum.CHANGE_BOT_MOTTO);
|
requestBotCommandConfiguration(BotSkillsEnum.CHANGE_BOT_MOTTO);
|
||||||
hideMenu = false;
|
hideMenu = false;
|
||||||
break;
|
break;
|
||||||
case 'save_bot_motto':
|
case 'save_bot_motto':
|
||||||
GetConnection().send(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.CHANGE_BOT_MOTTO, newMotto));
|
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.CHANGE_BOT_MOTTO, newMotto));
|
||||||
break;
|
break;
|
||||||
case 'dress_up':
|
case 'dress_up':
|
||||||
GetConnection().send(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.DRESS_UP, ''));
|
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.DRESS_UP, ''));
|
||||||
break;
|
break;
|
||||||
case 'random_walk':
|
case 'random_walk':
|
||||||
GetConnection().send(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.RANDOM_WALK, ''));
|
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.RANDOM_WALK, ''));
|
||||||
break;
|
break;
|
||||||
case 'setup_chat':
|
case 'setup_chat':
|
||||||
requestBotCommandConfiguration(BotSkillsEnum.SETUP_CHAT);
|
requestBotCommandConfiguration(BotSkillsEnum.SETUP_CHAT);
|
||||||
hideMenu = false;
|
hideMenu = false;
|
||||||
break;
|
break;
|
||||||
case 'dance':
|
case 'dance':
|
||||||
GetConnection().send(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.DANCE, ''));
|
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.DANCE, ''));
|
||||||
break;
|
break;
|
||||||
case 'nux_take_tour':
|
case 'nux_take_tour':
|
||||||
Nitro.instance.createLinkEvent('help/tour');
|
Nitro.instance.createLinkEvent('help/tour');
|
||||||
GetConnection().send(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.NUX_TAKE_TOUR, ''));
|
SendMessageHook(new BotSkillSaveComposer(rentableBotData.webID, BotSkillsEnum.NUX_TAKE_TOUR, ''));
|
||||||
break;
|
break;
|
||||||
case 'pick':
|
case 'pick':
|
||||||
GetConnection().send(new BotRemoveComposer(rentableBotData.webID));
|
SendMessageHook(new BotRemoveComposer(rentableBotData.webID));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -48,7 +48,7 @@ export const ContextMenuView: FC<ContextMenuViewProps> = props =>
|
|||||||
if(!bounds || !elementRef.current) return;
|
if(!bounds || !elementRef.current) return;
|
||||||
|
|
||||||
let left = Math.round((bounds.left + (bounds.width / 2)) - (elementRef.current.offsetWidth / 2));
|
let left = Math.round((bounds.left + (bounds.width / 2)) - (elementRef.current.offsetWidth / 2));
|
||||||
let top = Math.round((bounds.top - elementRef.current.offsetHeight) + 20);
|
let top = Math.round((bounds.top - elementRef.current.offsetHeight));
|
||||||
|
|
||||||
const maxLeft = ((Nitro.instance.width - elementRef.current.offsetWidth) - SPACE_AROUND_EDGES);
|
const maxLeft = ((Nitro.instance.width - elementRef.current.offsetWidth) - SPACE_AROUND_EDGES);
|
||||||
const maxTop = ((Nitro.instance.height - elementRef.current.offsetHeight) - SPACE_AROUND_EDGES);
|
const maxTop = ((Nitro.instance.height - elementRef.current.offsetHeight) - SPACE_AROUND_EDGES);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { BotRemoveComposer } from 'nitro-renderer';
|
import { BotRemoveComposer } from 'nitro-renderer';
|
||||||
import { FC, useCallback, useMemo } from 'react';
|
import { FC, useCallback, useMemo } from 'react';
|
||||||
import { GetConnection } from '../../../../../../api';
|
import { SendMessageHook } from '../../../../../../hooks/messages';
|
||||||
import { LocalizeText } from '../../../../../../utils/LocalizeText';
|
import { LocalizeText } from '../../../../../../utils/LocalizeText';
|
||||||
import { AvatarImageView } from '../../../../../shared/avatar-image/AvatarImageView';
|
import { AvatarImageView } from '../../../../../shared/avatar-image/AvatarImageView';
|
||||||
import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView';
|
import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView';
|
||||||
@ -23,7 +23,7 @@ export const InfoStandWidgetRentableBotView: FC<InfoStandWidgetRentableBotViewPr
|
|||||||
|
|
||||||
const pickupBot = useCallback(() =>
|
const pickupBot = useCallback(() =>
|
||||||
{
|
{
|
||||||
GetConnection().send(new BotRemoveComposer(rentableBotData.webID));
|
SendMessageHook(new BotRemoveComposer(rentableBotData.webID));
|
||||||
}, [ rentableBotData ]);
|
}, [ rentableBotData ]);
|
||||||
|
|
||||||
if(!rentableBotData) return;
|
if(!rentableBotData) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user