From e0fa8912661e1383e465cbc108482b32c37b8a16 Mon Sep 17 00:00:00 2001 From: dank074 Date: Wed, 20 Oct 2021 19:28:50 -0500 Subject: [PATCH] updated packets --- .../room/room-chatlog/ModToolsChatlogView.tsx | 4 ++-- .../room/room-tools/ModToolsRoomView.tsx | 22 +++++++++---------- .../tickets/ModToolsOpenIssuesTabView.tsx | 6 +++++ .../views/tickets/ModToolsTicketsView.tsx | 16 ++++++++++++-- .../user-chatlog/ModToolsUserChatlogView.tsx | 14 ++++++------ .../views/user/user-info/ModToolsUserView.tsx | 8 +++---- .../ModToolsUserRoomVisitsView.tsx | 10 ++++----- 7 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 src/views/mod-tools/views/tickets/ModToolsOpenIssuesTabView.tsx diff --git a/src/views/mod-tools/views/room/room-chatlog/ModToolsChatlogView.tsx b/src/views/mod-tools/views/room/room-chatlog/ModToolsChatlogView.tsx index 77573e30..4097d8c9 100644 --- a/src/views/mod-tools/views/room/room-chatlog/ModToolsChatlogView.tsx +++ b/src/views/mod-tools/views/room/room-chatlog/ModToolsChatlogView.tsx @@ -1,4 +1,4 @@ -import { ChatRecordData, ModtoolRequestRoomChatlogComposer, ModtoolRoomChatlogEvent } from '@nitrots/nitro-renderer'; +import { ChatRecordData, GetRoomChatlogMessageComposer, ModtoolRoomChatlogEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { CreateMessageHook, SendMessageHook } from '../../../../../hooks/messages'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../../layout'; @@ -13,7 +13,7 @@ export const ModToolsChatlogView: FC = props => useEffect(() => { - SendMessageHook(new ModtoolRequestRoomChatlogComposer(roomId)); + SendMessageHook(new GetRoomChatlogMessageComposer(roomId)); }, [roomId]); const onModtoolRoomChatlogEvent = useCallback((event: ModtoolRoomChatlogEvent) => diff --git a/src/views/mod-tools/views/room/room-tools/ModToolsRoomView.tsx b/src/views/mod-tools/views/room/room-tools/ModToolsRoomView.tsx index 6a5c69e3..d169c1fb 100644 --- a/src/views/mod-tools/views/room/room-tools/ModToolsRoomView.tsx +++ b/src/views/mod-tools/views/room/room-tools/ModToolsRoomView.tsx @@ -1,4 +1,4 @@ -import { ModerateRoomMessageComposer, ModeratorActionMessageComposer, ModtoolRequestRoomInfoComposer, ModtoolRoomInfoEvent } from '@nitrots/nitro-renderer'; +import { GetModeratorRoomInfoMessageComposer, ModerateRoomMessageComposer, ModeratorActionMessageComposer, ModeratorRoomInfoEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { TryVisitRoom } from '../../../../../api'; import { ModToolsOpenRoomChatlogEvent } from '../../../../../events/mod-tools/ModToolsOpenRoomChatlogEvent'; @@ -30,25 +30,25 @@ export const ModToolsRoomView: FC = props => { if(infoRequested) return; - SendMessageHook(new ModtoolRequestRoomInfoComposer(roomId)); + SendMessageHook(new GetModeratorRoomInfoMessageComposer(roomId)); setInfoRequested(true); }, [ roomId, infoRequested, setInfoRequested ]); - const onModtoolRoomInfoEvent = useCallback((event: ModtoolRoomInfoEvent) => + const onModtoolRoomInfoEvent = useCallback((event: ModeratorRoomInfoEvent) => { const parser = event.getParser(); - if(!parser || parser.id !== roomId) return; + if(!parser || parser.data.flatId !== roomId) return; - setLoadedRoomId(parser.id); - setName(parser.name); - setOwnerId(parser.ownerId); - setOwnerName(parser.ownerName); - setOwnerInRoom(parser.ownerInRoom); - setUsersInRoom(parser.playerAmount); + setLoadedRoomId(parser.data.flatId); + setName(parser.data.room.name); + setOwnerId(parser.data.ownerId); + setOwnerName(parser.data.ownerName); + setOwnerInRoom(parser.data.ownerInRoom); + setUsersInRoom(parser.data.userCount); }, [ setLoadedRoomId, setName, setOwnerId, setOwnerName, setOwnerInRoom, setUsersInRoom, roomId ]); - CreateMessageHook(ModtoolRoomInfoEvent, onModtoolRoomInfoEvent); + CreateMessageHook(ModeratorRoomInfoEvent, onModtoolRoomInfoEvent); const handleClick = useCallback((action: string, value?: string) => { diff --git a/src/views/mod-tools/views/tickets/ModToolsOpenIssuesTabView.tsx b/src/views/mod-tools/views/tickets/ModToolsOpenIssuesTabView.tsx new file mode 100644 index 00000000..6d4392b7 --- /dev/null +++ b/src/views/mod-tools/views/tickets/ModToolsOpenIssuesTabView.tsx @@ -0,0 +1,6 @@ +import { FC } from 'react'; + +export const ModToolsOpenIssuesTabView: FC<{}> = props => +{ + return null; +} diff --git a/src/views/mod-tools/views/tickets/ModToolsTicketsView.tsx b/src/views/mod-tools/views/tickets/ModToolsTicketsView.tsx index 5d2ebf47..60651532 100644 --- a/src/views/mod-tools/views/tickets/ModToolsTicketsView.tsx +++ b/src/views/mod-tools/views/tickets/ModToolsTicketsView.tsx @@ -1,5 +1,6 @@ -import { FC, useState } from 'react'; +import { FC, useCallback, useState } from 'react'; import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../../../layout'; +import { ModToolsOpenIssuesTabView } from './ModToolsOpenIssuesTabView'; import { ModToolsTicketsViewProps } from './ModToolsTicketsView.types'; const TABS: string[] = [ @@ -14,6 +15,15 @@ export const ModToolsTicketsView: FC = props => const [ currentTab, setCurrentTab ] = useState(0); + const CurrentTabComponent = useCallback(() => + { + switch(currentTab) + { + case 0: return ; + default: return null; + } + }, [currentTab]); + return ( @@ -26,7 +36,9 @@ export const ModToolsTicketsView: FC = props => ); }) } -
+
+ +
); diff --git a/src/views/mod-tools/views/user/user-chatlog/ModToolsUserChatlogView.tsx b/src/views/mod-tools/views/user/user-chatlog/ModToolsUserChatlogView.tsx index 0da179cb..705cc690 100644 --- a/src/views/mod-tools/views/user/user-chatlog/ModToolsUserChatlogView.tsx +++ b/src/views/mod-tools/views/user/user-chatlog/ModToolsUserChatlogView.tsx @@ -1,4 +1,4 @@ -import { ChatRecordData, ModtoolRequestUserChatlogComposer, ModtoolUserChatlogEvent } from '@nitrots/nitro-renderer'; +import { ChatRecordData, GetUserChatlogMessageComposer, UserChatlogEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { CreateMessageHook, SendMessageHook } from '../../../../../hooks'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../../layout'; @@ -13,20 +13,20 @@ export const ModToolsUserChatlogView: FC = props = useEffect(() => { - SendMessageHook(new ModtoolRequestUserChatlogComposer(userId)); + SendMessageHook(new GetUserChatlogMessageComposer(userId)); }, [userId]); - const onModtoolUserChatlogEvent = useCallback((event: ModtoolUserChatlogEvent) => + const onModtoolUserChatlogEvent = useCallback((event: UserChatlogEvent) => { const parser = event.getParser(); - if(!parser || parser.userId !== userId) return; + if(!parser || parser.data.userId !== userId) return; - setUsername(parser.username); - setUserChatlog(parser.roomVisits); + setUsername(parser.data.username); + setUserChatlog(parser.data.roomChatlogs); }, [setUsername, setUserChatlog, userId]); - CreateMessageHook(ModtoolUserChatlogEvent, onModtoolUserChatlogEvent); + CreateMessageHook(UserChatlogEvent, onModtoolUserChatlogEvent); return ( diff --git a/src/views/mod-tools/views/user/user-info/ModToolsUserView.tsx b/src/views/mod-tools/views/user/user-info/ModToolsUserView.tsx index 5981f666..fa1a3214 100644 --- a/src/views/mod-tools/views/user/user-info/ModToolsUserView.tsx +++ b/src/views/mod-tools/views/user/user-info/ModToolsUserView.tsx @@ -1,4 +1,4 @@ -import { FriendlyTime, ModeratorUserInfoData, ModtoolRequestUserInfoComposer, ModtoolUserInfoEvent } from '@nitrots/nitro-renderer'; +import { FriendlyTime, GetModeratorUserInfoMessageComposer, ModeratorUserInfoData, ModtoolUserInfoEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { LocalizeText } from '../../../../../api'; import { ModToolsOpenUserChatlogEvent } from '../../../../../events/mod-tools/ModToolsOpenUserChatlogEvent'; @@ -19,7 +19,7 @@ export const ModToolsUserView: FC = props => useEffect(() => { - SendMessageHook(new ModtoolRequestUserInfoComposer(userId)); + SendMessageHook(new GetModeratorUserInfoMessageComposer(userId)); }, [ userId ]); const onModtoolUserInfoEvent = useCallback((event: ModtoolUserInfoEvent) => @@ -109,11 +109,11 @@ export const ModToolsUserView: FC = props => - { userProperties.map(property => + { userProperties.map( (property, index) => { return ( - +
{ LocalizeText(property.localeKey) } { property.value } diff --git a/src/views/mod-tools/views/user/user-room-visits/ModToolsUserRoomVisitsView.tsx b/src/views/mod-tools/views/user/user-room-visits/ModToolsUserRoomVisitsView.tsx index 0faec1ef..c79117dc 100644 --- a/src/views/mod-tools/views/user/user-room-visits/ModToolsUserRoomVisitsView.tsx +++ b/src/views/mod-tools/views/user/user-room-visits/ModToolsUserRoomVisitsView.tsx @@ -1,4 +1,4 @@ -import { ModtoolReceivedRoomsUserEvent, ModtoolRequestUserRoomsComposer, ModtoolRoomVisitedData } from '@nitrots/nitro-renderer'; +import { GetRoomVisitsMessageComposer, RoomVisitsData, RoomVisitsEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { AutoSizer, List, ListRowProps, ListRowRenderer } from 'react-virtualized'; import { TryVisitRoom } from '../../../../../api'; @@ -10,14 +10,14 @@ export const ModToolsUserRoomVisitsView: FC = p { const { userId = null, onCloseClick = null } = props; - const [roomVisitData, setRoomVisitData] = useState(null); + const [roomVisitData, setRoomVisitData] = useState(null); useEffect(() => { - SendMessageHook(new ModtoolRequestUserRoomsComposer(userId)); + SendMessageHook(new GetRoomVisitsMessageComposer(userId)); }, [userId]); - const onModtoolReceivedRoomsUserEvent = useCallback((event: ModtoolReceivedRoomsUserEvent) => + const onModtoolReceivedRoomsUserEvent = useCallback((event: RoomVisitsEvent) => { const parser = event.getParser(); @@ -26,7 +26,7 @@ export const ModToolsUserRoomVisitsView: FC = p setRoomVisitData(parser.data); }, [userId]); - CreateMessageHook(ModtoolReceivedRoomsUserEvent, onModtoolReceivedRoomsUserEvent); + CreateMessageHook(RoomVisitsEvent, onModtoolReceivedRoomsUserEvent); const RowRenderer: ListRowRenderer = (props: ListRowProps) => {