From 0d8f15956bf7ed8cbba6e0ac8c9df1023bef295f Mon Sep 17 00:00:00 2001 From: MyNameIsBatman Date: Mon, 6 Sep 2021 04:36:29 -0300 Subject: [PATCH] Fix more group stuff --- .../CatalogLayoutGuildForumView.tsx | 38 +++++++------------ .../context-menu/FurnitureContextMenuView.tsx | 3 ++ 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/views/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx b/src/views/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx index 7c1be64a..add86a9c 100644 --- a/src/views/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx +++ b/src/views/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx @@ -1,6 +1,6 @@ -import { CatalogGroupsComposer, HabboGroupEntryData } from '@nitrots/nitro-renderer'; +import { CatalogGroupsComposer } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; -import { GetSessionDataManager, LocalizeText } from '../../../../../../api'; +import { LocalizeText } from '../../../../../../api'; import { SendMessageHook } from '../../../../../../hooks/messages'; import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView'; import { GetCatalogPageText } from '../../../../common/CatalogUtilities'; @@ -17,7 +17,6 @@ export const CatalogLayouGuildForumView: FC = const { activeOffer = null, groups = null } = catalogState; const [ selectedGroupIndex, setSelectedGroupIndex ] = useState(0); - const [ availableGroups, setAvailableGroups ] = useState([]); const product = ((activeOffer && activeOffer.products[0]) || null); @@ -35,48 +34,37 @@ export const CatalogLayouGuildForumView: FC = }); } }, [ dispatchCatalogState, pageParser ]); - - useEffect(() => - { - const available: HabboGroupEntryData[] = []; - - groups.forEach((group) => - { - if(!group.hasForum && group.ownerId === GetSessionDataManager().userId) available.push(group); - }); - - setAvailableGroups(available); - }, [ groups ]); return (
-
- { availableGroups.length === 0 &&
+ { product &&
+ { groups.length === 0 &&
{ LocalizeText('catalog.guild_selector.members_only') }
} - { availableGroups[selectedGroupIndex] &&
- + { groups[selectedGroupIndex] &&
+
} - { availableGroups.length > 0 && <> + { groups.length > 0 && <>
-
-
+
+
- + { groups[selectedGroupIndex].hasForum &&
{ LocalizeText('catalog.alert.group_has_forum') }
} + } -
+
}
); } diff --git a/src/views/room/widgets/furniture/context-menu/FurnitureContextMenuView.tsx b/src/views/room/widgets/furniture/context-menu/FurnitureContextMenuView.tsx index 20453f54..765e082d 100644 --- a/src/views/room/widgets/furniture/context-menu/FurnitureContextMenuView.tsx +++ b/src/views/room/widgets/furniture/context-menu/FurnitureContextMenuView.tsx @@ -192,6 +192,9 @@ export const FurnitureContextMenuView: FC<{}> = props => processAction('go_to_group_homeroom') }> { LocalizeText('widget.furniture.button.go.to.group.home.room') } + { groupData.guildHasReadableForum && processAction('open_forum') }> + { LocalizeText('widget.furniture.button.open_group_forum') } + } } }