Merge branch 'feature/mod-tools' of https://github.com/billsonnn/nitro-react into feature/mod-tools

This commit is contained in:
Bill 2021-10-20 02:45:06 -04:00
commit 1ba006f687
2 changed files with 25 additions and 28 deletions

View File

@ -184,9 +184,7 @@ export const ModToolsView: FC<ModToolsViewProps> = props =>
return; return;
} }
const itemIndex = openRooms.indexOf(currentRoomId); if(openRooms.indexOf(currentRoomId) > -1)
if(itemIndex > -1)
{ {
handleClick('close_room', currentRoomId.toString()); handleClick('close_room', currentRoomId.toString());
} }
@ -217,9 +215,7 @@ export const ModToolsView: FC<ModToolsViewProps> = props =>
return; return;
} }
const itemIndex = openRoomChatlogs.indexOf(currentRoomId); if(openRoomChatlogs.indexOf(currentRoomId) > -1)
if(itemIndex > -1)
{ {
handleClick('close_room_chatlog', currentRoomId.toString()); handleClick('close_room_chatlog', currentRoomId.toString());
} }
@ -255,9 +251,7 @@ export const ModToolsView: FC<ModToolsViewProps> = props =>
return; return;
} }
const itemIndex = openUserInfo.indexOf(userId); if(openUserInfo.indexOf(userId) > -1)
if(itemIndex > -1)
{ {
handleClick('close_user_info', userId.toString()); handleClick('close_user_info', userId.toString());
} }

View File

@ -1,6 +1,7 @@
import { ModtoolReceivedRoomsUserEvent, ModtoolRequestUserRoomsComposer, ModtoolRoomVisitedData } from '@nitrots/nitro-renderer'; import { ModtoolReceivedRoomsUserEvent, ModtoolRequestUserRoomsComposer, ModtoolRoomVisitedData } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { AutoSizer, List, ListRowProps, ListRowRenderer } from 'react-virtualized'; import { AutoSizer, List, ListRowProps, ListRowRenderer } from 'react-virtualized';
import { TryVisitRoom } from '../../../../../api';
import { CreateMessageHook, SendMessageHook } from '../../../../../hooks'; import { CreateMessageHook, SendMessageHook } from '../../../../../hooks';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../../layout'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../../layout';
import { ModToolsUserRoomVisitsViewProps } from './ModToolsUserRoomVisitsView.types'; import { ModToolsUserRoomVisitsViewProps } from './ModToolsUserRoomVisitsView.types';
@ -32,8 +33,10 @@ export const ModToolsUserRoomVisitsView: FC<ModToolsUserRoomVisitsViewProps> = p
const item = roomVisitData.rooms[props.index]; const item = roomVisitData.rooms[props.index];
return ( return (
<div style={props.style} key={props.key} className="room-visit"> <div style={props.style} key={props.key} className="row room-visit">
{item.enterHour}:{item.enterMinute} <b>Room:</b> {item.roomName} <div className="col-auto text-center">{item.enterHour.toString().padStart(2, '0')}:{item.enterMinute.toString().padStart(2, '0')}</div>
<div className="col-7"><span className="fw-bold">Room: </span>{item.roomName}</div>
<button className="btn btn-sm btn-link col-sm-auto fw-bold" onClick={() => TryVisitRoom(item.roomId)}>Visit Room</button>
</div>); </div>);
} }
@ -51,7 +54,7 @@ export const ModToolsUserRoomVisitsView: FC<ModToolsUserRoomVisitsViewProps> = p
width={width} width={width}
height={height} height={height}
rowCount={roomVisitData.rooms.length} rowCount={roomVisitData.rooms.length}
rowHeight={25} rowHeight={30}
className={'roomvisits-container'} className={'roomvisits-container'}
rowRenderer={RowRenderer} rowRenderer={RowRenderer}
/> />