Fix GroupRoomInfo View

This commit is contained in:
MyNameIsBatman 2021-09-13 18:41:16 -03:00
parent 17a821d294
commit 0a615dffb6

View File

@ -12,13 +12,13 @@ export const GroupRoomInformationView: FC<{}> = props =>
const [ groupId, setGroupId ] = useState<number>(null); const [ groupId, setGroupId ] = useState<number>(null);
const [ groupInformation, setGroupInformation ] = useState<GroupInformationParser>(null); const [ groupInformation, setGroupInformation ] = useState<GroupInformationParser>(null);
const [ isExpended, setIsExpended ] = useState<boolean>(true); const [ isExpended, setIsExpended ] = useState<boolean>(true);
const onRoomInfoEvent = useCallback((event: RoomInfoEvent) => const onRoomInfoEvent = useCallback((event: RoomInfoEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
setGroupInformation(null); setGroupInformation(null);
if(parser.data.habboGroupId) if(parser.data.habboGroupId)
{ {
setGroupId(parser.data.habboGroupId); setGroupId(parser.data.habboGroupId);
@ -33,7 +33,7 @@ export const GroupRoomInformationView: FC<{}> = props =>
const parser = event.getParser(); const parser = event.getParser();
if(parser.flag || groupId !== parser.id) return; if(parser.flag || groupId !== parser.id) return;
console.log(parser);
setGroupInformation(null); setGroupInformation(null);
setGroupInformation(parser); setGroupInformation(parser);
}, [ groupId ]); }, [ groupId ]);
@ -110,7 +110,7 @@ export const GroupRoomInformationView: FC<{}> = props =>
<i className={ 'fas fa-chevron-' + (isExpended ? 'up' : 'down') } /> <i className={ 'fas fa-chevron-' + (isExpended ? 'up' : 'down') } />
</div> </div>
{ isExpended && <> { isExpended && <>
<div className="d-flex cursor-pointer" onClick={ () => GetGroupInformation(groupInformation.id) }> <div className="d-flex cursor-pointer" onClick={ () => GetGroupInformation(groupId) }>
<div className="group-badge flex-shrink-0 me-1"> <div className="group-badge flex-shrink-0 me-1">
<BadgeImageView badgeCode={ groupInformation.badge } isGroup={ true } /> <BadgeImageView badgeCode={ groupInformation.badge } isGroup={ true } />
</div> </div>