mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
upgrade packages + improve typing
This commit is contained in:
parent
fd55f4fb7f
commit
19f5eefdd2
138 changed files with 4504 additions and 11015 deletions
|
|
@ -1,21 +1,25 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { connect } from 'react-redux';
|
||||
import React from "react";
|
||||
import { generatePath, useNavigate } from 'react-router-dom';
|
||||
|
||||
import ListItem from '@mui/material/ListItem';
|
||||
import ListItemButton from '@mui/material/ListItemButton';
|
||||
import Paper from '@mui/material/Paper';
|
||||
|
||||
import { AuthGuard, ThreePaneLayout, UserDisplay, VirtualList } from 'components';
|
||||
import { useReduxEffect } from 'hooks';
|
||||
import { RoomsSelectors, RoomsTypes, ServerSelectors } from 'store';
|
||||
import { Room, RouteEnum, User } from 'types';
|
||||
import { RouteEnum } from 'types';
|
||||
import { useAppSelector } from 'store/store';
|
||||
import Rooms from './Rooms';
|
||||
import Layout from 'containers/Layout/Layout';
|
||||
|
||||
import './Server.css';
|
||||
|
||||
const Server = ({ message, rooms, joinedRooms, users }: ServerProps) => {
|
||||
const Server = () => {
|
||||
const message = useAppSelector(state => ServerSelectors.getMessage(state));
|
||||
const rooms = useAppSelector(state => RoomsSelectors.getRooms(state));
|
||||
const joinedRooms = useAppSelector(state => RoomsSelectors.getJoinedRooms(state));
|
||||
const users = useAppSelector(state => ServerSelectors.getUsers(state));
|
||||
const navigate = useNavigate();
|
||||
|
||||
useReduxEffect((action: any) => {
|
||||
|
|
@ -46,11 +50,10 @@ const Server = ({ message, rooms, joinedRooms, users }: ServerProps) => {
|
|||
Users connected to server: {users.length}
|
||||
</div>
|
||||
<VirtualList
|
||||
itemKey={(index) => users[index].name }
|
||||
items={ users.map(user => (
|
||||
<ListItem button dense>
|
||||
<ListItemButton dense>
|
||||
<UserDisplay user={user} />
|
||||
</ListItem>
|
||||
</ListItemButton>
|
||||
)) }
|
||||
/>
|
||||
</Paper>
|
||||
|
|
@ -60,18 +63,4 @@ const Server = ({ message, rooms, joinedRooms, users }: ServerProps) => {
|
|||
);
|
||||
}
|
||||
|
||||
interface ServerProps {
|
||||
message: string;
|
||||
rooms: Room[];
|
||||
joinedRooms: Room[];
|
||||
users: User[];
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
message: ServerSelectors.getMessage(state),
|
||||
rooms: RoomsSelectors.getRooms(state),
|
||||
joinedRooms: RoomsSelectors.getJoinedRooms(state),
|
||||
users: ServerSelectors.getUsers(state)
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(Server);
|
||||
export default Server;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue