mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Fix respect counter in avatar info
This commit is contained in:
parent
1162469122
commit
2e44b5e693
@ -1,6 +1,6 @@
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { RoomControllerLevel, RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
||||
import { FC, useEffect, useMemo, useState } from 'react';
|
||||
import { FC, useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { GetOwnRoomObject, GetUserProfile, LocalizeText, RoomWidgetMessage, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUserActionMessage } from '../../../../api';
|
||||
import { Base, Flex } from '../../../../common';
|
||||
import { BatchUpdates } from '../../../../hooks';
|
||||
@ -61,7 +61,7 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
||||
return flag;
|
||||
}, []);
|
||||
|
||||
const processAction = (name: string) =>
|
||||
const processAction = useCallback((name: string) =>
|
||||
{
|
||||
let messageType: string = null;
|
||||
let message: RoomWidgetMessage = null;
|
||||
@ -114,20 +114,16 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
||||
hideMenu = false;
|
||||
setMode(MODE_RELATIONSHIP);
|
||||
break;
|
||||
case 'respect':
|
||||
let newRespectsLeft = 0;
|
||||
case 'respect': {
|
||||
let newRespectsLeft = (respectsLeft - 1);
|
||||
|
||||
setRespectsLeft(prevValue =>
|
||||
{
|
||||
newRespectsLeft = (prevValue - 1);
|
||||
|
||||
return newRespectsLeft;
|
||||
});
|
||||
setRespectsLeft(newRespectsLeft);
|
||||
|
||||
messageType = RoomWidgetUserActionMessage.RESPECT_USER;
|
||||
|
||||
if(newRespectsLeft > 0) hideMenu = false;
|
||||
break;
|
||||
}
|
||||
case 'ignore':
|
||||
messageType = RoomWidgetUserActionMessage.IGNORE_USER;
|
||||
break;
|
||||
@ -208,7 +204,7 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
||||
}
|
||||
|
||||
if(hideMenu) close();
|
||||
}
|
||||
}, [ userData, respectsLeft, widgetHandler, close, ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user