mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 23:50:52 +01:00
updated packets
This commit is contained in:
parent
1ba006f687
commit
e0fa891266
@ -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<ModToolsChatlogViewProps> = props =>
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
SendMessageHook(new ModtoolRequestRoomChatlogComposer(roomId));
|
||||
SendMessageHook(new GetRoomChatlogMessageComposer(roomId));
|
||||
}, [roomId]);
|
||||
|
||||
const onModtoolRoomChatlogEvent = useCallback((event: ModtoolRoomChatlogEvent) =>
|
||||
|
@ -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<ModToolsRoomViewProps> = 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) =>
|
||||
{
|
||||
|
@ -0,0 +1,6 @@
|
||||
import { FC } from 'react';
|
||||
|
||||
export const ModToolsOpenIssuesTabView: FC<{}> = props =>
|
||||
{
|
||||
return null;
|
||||
}
|
@ -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<ModToolsTicketsViewProps> = props =>
|
||||
|
||||
const [ currentTab, setCurrentTab ] = useState<number>(0);
|
||||
|
||||
const CurrentTabComponent = useCallback(() =>
|
||||
{
|
||||
switch(currentTab)
|
||||
{
|
||||
case 0: return <ModToolsOpenIssuesTabView />;
|
||||
default: return null;
|
||||
}
|
||||
}, [currentTab]);
|
||||
|
||||
return (
|
||||
<NitroCardView className="nitro-mod-tools-tickets" simple={ false }>
|
||||
<NitroCardHeaderView headerText={ 'Tickets' } onCloseClick={ onCloseClick } />
|
||||
@ -26,7 +36,9 @@ export const ModToolsTicketsView: FC<ModToolsTicketsViewProps> = props =>
|
||||
</NitroCardTabsItemView>);
|
||||
}) }
|
||||
</NitroCardTabsView>
|
||||
<div className="p-2"></div>
|
||||
<div className="p-2">
|
||||
<CurrentTabComponent />
|
||||
</div>
|
||||
</NitroCardContentView>
|
||||
</NitroCardView>
|
||||
);
|
||||
|
@ -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<ModToolsUserChatlogViewProps> = 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 (
|
||||
<NitroCardView className="nitro-mod-tools-user-chatlog" simple={true}>
|
||||
|
@ -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<ModToolsUserViewProps> = props =>
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
SendMessageHook(new ModtoolRequestUserInfoComposer(userId));
|
||||
SendMessageHook(new GetModeratorUserInfoMessageComposer(userId));
|
||||
}, [ userId ]);
|
||||
|
||||
const onModtoolUserInfoEvent = useCallback((event: ModtoolUserInfoEvent) =>
|
||||
@ -109,11 +109,11 @@ export const ModToolsUserView: FC<ModToolsUserViewProps> = props =>
|
||||
<NitroLayoutGridColumn size={ 8 }>
|
||||
<table className="table table-striped table-sm table-text-small text-black m-0">
|
||||
<tbody>
|
||||
{ userProperties.map(property =>
|
||||
{ userProperties.map( (property, index) =>
|
||||
{
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<tr key={index}>
|
||||
<th scope="row">{ LocalizeText(property.localeKey) }</th>
|
||||
<td>
|
||||
{ property.value }
|
||||
|
@ -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<ModToolsUserRoomVisitsViewProps> = p
|
||||
{
|
||||
const { userId = null, onCloseClick = null } = props;
|
||||
|
||||
const [roomVisitData, setRoomVisitData] = useState<ModtoolRoomVisitedData>(null);
|
||||
const [roomVisitData, setRoomVisitData] = useState<RoomVisitsData>(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<ModToolsUserRoomVisitsViewProps> = p
|
||||
setRoomVisitData(parser.data);
|
||||
}, [userId]);
|
||||
|
||||
CreateMessageHook(ModtoolReceivedRoomsUserEvent, onModtoolReceivedRoomsUserEvent);
|
||||
CreateMessageHook(RoomVisitsEvent, onModtoolReceivedRoomsUserEvent);
|
||||
|
||||
const RowRenderer: ListRowRenderer = (props: ListRowProps) =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user