Add ESLint & Run it against the system (#4470)
This commit is contained in:
parent
43eee6b32e
commit
f789e02096
106 changed files with 1235 additions and 20242 deletions
45
webclient/.eslintrc.js
Normal file
45
webclient/.eslintrc.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
module.exports = {
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {"project": ["./tsconfig.json"]},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"ignorePatterns": ["node_modules/*", "build/*", "public/pb/*"],
|
||||
"rules": {
|
||||
"array-bracket-spacing": ["error", "never"],
|
||||
"arrow-spacing": ["error", {"before": true, "after": true}],
|
||||
"block-spacing": ["error", "always"],
|
||||
"brace-style": ["error", "1tbs", {"allowSingleLine": false}],
|
||||
"comma-spacing": ["error", {"before": false, "after": true}],
|
||||
"comma-style": ["error", "last"],
|
||||
"computed-property-spacing": ["error", "never"],
|
||||
"curly": ["error", "all"],
|
||||
"dot-location": ["error", "property"],
|
||||
"eol-last": ["error"],
|
||||
"func-names": ["warn"],
|
||||
"indent": ["error", 2, {"SwitchCase": 1}],
|
||||
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
|
||||
"keyword-spacing": ["error"],
|
||||
"linebreak-style": ["error", (process.platform === "win32" ? "windows" : "unix")],
|
||||
"max-len": ["error", {"code": 140}],
|
||||
"no-eq-null": ["off"],
|
||||
"no-func-assign": ["error"],
|
||||
"no-inline-comments": ["error"],
|
||||
"no-mixed-spaces-and-tabs": ["error"],
|
||||
"no-multi-spaces": ["error"],
|
||||
"no-spaced-func": ["error"],
|
||||
"no-trailing-spaces": ["error"],
|
||||
"no-var": ["error"],
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"one-var": ["error", "never"],
|
||||
"one-var-declaration-per-line": ["error"],
|
||||
"quotes": ["error", "single"],
|
||||
"semi-spacing": ["error", {"before": false, "after": true}],
|
||||
"space-before-blocks": ["error"],
|
||||
"space-before-function-paren": ["error", {"asyncArrow": "always", "anonymous": "never", "named": "never"}],
|
||||
"space-in-parens": ["error", "never"],
|
||||
"space-infix-ops": ["error"],
|
||||
"space-unary-ops": ["error", {"words": true, "nonwords": false}]
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": { "project": [ "./tsconfig.json" ] },
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"ignorePatterns": [ "node_modules/*", "build/*", "public/pb/*" ]
|
||||
}
|
19186
webclient/package-lock.json
generated
19186
webclient/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -30,7 +30,8 @@
|
|||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject",
|
||||
"lint": "eslint ./**/*.{ts,tsx}"
|
||||
"lint": "eslint ./**/*.{ts,tsx}",
|
||||
"lint:fix": "eslint ./**/*.{ts,tsx} --fix"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
|
@ -63,7 +64,8 @@
|
|||
"@types/react-window": "^1.8.2",
|
||||
"@types/redux": "^3.6.0",
|
||||
"@types/redux-form": "^8.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
||||
"eslint": "^7.1.0"
|
||||
"@typescript-eslint/eslint-plugin": "^5.3.1",
|
||||
"@typescript-eslint/parser": "^5.3.1",
|
||||
"eslint": "^8.1.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {StatusEnum, User} from "types";
|
||||
import {SessionCommands, webClient} from "websocket";
|
||||
import {WebSocketConnectReason, WebSocketOptions} from "../websocket/services/WebSocketService";
|
||||
import { StatusEnum, User } from 'types';
|
||||
import { SessionCommands, webClient } from 'websocket';
|
||||
import { WebSocketConnectReason, WebSocketOptions } from '../websocket/services/WebSocketService';
|
||||
|
||||
export default class AuthenticationService {
|
||||
static connect(options: WebSocketOptions): void {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SessionCommands } from "websocket";
|
||||
import { SessionCommands } from 'websocket';
|
||||
|
||||
export default class ModeratorService {
|
||||
static viewLogHistory(filters): void {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RoomCommands, SessionCommands } from "websocket";
|
||||
import { RoomCommands, SessionCommands } from 'websocket';
|
||||
|
||||
export default class RoomsService {
|
||||
static joinRoom(roomId: number): void {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { RouteEnum } from "types";
|
||||
import { RouteEnum } from 'types';
|
||||
|
||||
export class RouterService {
|
||||
resolveUrl(path, params) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { SessionCommands } from "websocket";
|
||||
import { SessionCommands } from 'websocket';
|
||||
|
||||
export default class SessionService {
|
||||
static addToBuddyList(userName: string) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export { default as AuthenticationService } from "./AuthenticationService";
|
||||
export { default as ModeratorService } from "./ModeratorService";
|
||||
export { default as RoomsService } from "./RoomsService";
|
||||
export { default as SessionService } from "./SessionService";
|
||||
export { default as AuthenticationService } from './AuthenticationService';
|
||||
export { default as ModeratorService } from './ModeratorService';
|
||||
export { default as RoomsService } from './RoomsService';
|
||||
export { default as SessionService } from './SessionService';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React from "react";
|
||||
import React from 'react';
|
||||
import Dialog from '@material-ui/core/Dialog';
|
||||
import DialogContent from '@material-ui/core/DialogContent';
|
||||
import DialogTitle from '@material-ui/core/DialogTitle';
|
||||
|
@ -33,4 +33,4 @@ const CardImportDialog = ({ classes, handleClose, isOpen }: any) => {
|
|||
);
|
||||
};
|
||||
|
||||
export default CardImportDialog;
|
||||
export default CardImportDialog;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import React from 'react';
|
||||
import Checkbox from '@material-ui/core/Checkbox';
|
||||
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
||||
|
||||
const CheckboxField = ({ input, label }) => {
|
||||
const { value, onChange } = input;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Redirect } from "react-router-dom";
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Redirect } from 'react-router-dom';
|
||||
|
||||
import { ServerSelectors } from "store";
|
||||
import { RouteEnum } from "types";
|
||||
import { ServerSelectors } from 'store';
|
||||
import { RouteEnum } from 'types';
|
||||
|
||||
import { AuthenticationService } from "api";
|
||||
import { AuthenticationService } from 'api';
|
||||
|
||||
const AuthGuard = ({ state }: AuthGuardProps) => {
|
||||
return !AuthenticationService.isConnected(state)
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Redirect } from "react-router-dom";
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Redirect } from 'react-router-dom';
|
||||
|
||||
import { ServerSelectors } from "store";
|
||||
import { User } from "types";
|
||||
import { ServerSelectors } from 'store';
|
||||
import { User } from 'types';
|
||||
|
||||
import { AuthenticationService } from "api";
|
||||
import { RouteEnum } from "types";
|
||||
import { AuthenticationService } from 'api';
|
||||
import { RouteEnum } from 'types';
|
||||
|
||||
class ModGuard extends Component<ModGuardProps> {
|
||||
render() {
|
||||
return !AuthenticationService.isModerator(this.props.user)
|
||||
? <Redirect from="*" to={RouteEnum.SERVER} />
|
||||
: "";
|
||||
: '';
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -24,4 +24,4 @@ const mapStateToProps = state => ({
|
|||
user: ServerSelectors.getUser(state),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(ModGuard);
|
||||
export default connect(mapStateToProps)(ModGuard);
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { NavLink, withRouter, generatePath } from "react-router-dom";
|
||||
import AppBar from "@material-ui/core/AppBar";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import Menu from "@material-ui/core/Menu";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { NavLink, withRouter, generatePath } from 'react-router-dom';
|
||||
import AppBar from '@material-ui/core/AppBar';
|
||||
import IconButton from '@material-ui/core/IconButton';
|
||||
import Menu from '@material-ui/core/Menu';
|
||||
import MenuItem from '@material-ui/core/MenuItem';
|
||||
import Toolbar from '@material-ui/core/Toolbar';
|
||||
import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
|
||||
import CloseIcon from '@material-ui/icons/Close';
|
||||
import MailOutlineRoundedIcon from '@material-ui/icons/MailOutline';
|
||||
import MenuRoundedIcon from '@material-ui/icons/MenuRounded';
|
||||
import * as _ from "lodash";
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { AuthenticationService, RoomsService } from "api";
|
||||
import { AuthenticationService, RoomsService } from 'api';
|
||||
import { Images } from 'images';
|
||||
import { RoomsSelectors, ServerSelectors } from "store";
|
||||
import { Room, RouteEnum, User } from "types";
|
||||
import { RoomsSelectors, ServerSelectors } from 'store';
|
||||
import { Room, RouteEnum, User } from 'types';
|
||||
|
||||
import "./Header.css";
|
||||
import './Header.css';
|
||||
|
||||
import CardImportDialog from '../CardImportDialog/CardImportDialog';
|
||||
|
||||
|
@ -85,7 +85,7 @@ class Header extends Component<HeaderProps> {
|
|||
const { joinedRooms, state, user } = this.props;
|
||||
const { anchorEl, showCardImportDialog } = this.state;
|
||||
|
||||
let options = [ ...this.options ];
|
||||
let options = [...this.options];
|
||||
|
||||
if (user && AuthenticationService.isModerator(user)) {
|
||||
options = [
|
||||
|
@ -183,7 +183,7 @@ class Header extends Component<HeaderProps> {
|
|||
</div>
|
||||
) }
|
||||
</Toolbar>
|
||||
|
||||
|
||||
<CardImportDialog
|
||||
isOpen={showCardImportDialog}
|
||||
handleClose={this.closeImportCardWizard}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// eslint-disable-next-line
|
||||
import React from "react";
|
||||
import { Field } from "redux-form"
|
||||
import Button from "@material-ui/core/Button";
|
||||
import { Field } from 'redux-form'
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
import { InputField } from 'components';
|
||||
|
||||
import "./InputAction.css";
|
||||
import './InputAction.css';
|
||||
|
||||
const InputAction = ({ action, label, name }) => (
|
||||
<div className="input-action">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
import React from 'react';
|
||||
import { styled } from '@material-ui/core/styles';
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import TextField from '@material-ui/core/TextField';
|
||||
import ErrorOutlinedIcon from '@material-ui/icons/ErrorOutlined';
|
||||
|
||||
import './InputField.css';
|
||||
|
@ -10,14 +10,14 @@ const InputField = ({ input, label, name, autoComplete, type, meta: { touched, e
|
|||
{ touched && (
|
||||
<div className="inputField-validation">
|
||||
{
|
||||
( error &&
|
||||
(error &&
|
||||
<ThemedFieldError className="inputField-error">
|
||||
{error}
|
||||
<ErrorOutlinedIcon style={{ fontSize: 'small', fontWeight: 'bold' }} />
|
||||
</ThemedFieldError>
|
||||
) ||
|
||||
|
||||
( warning && <ThemedFieldWarning className="inputField-warning">{warning}</ThemedFieldWarning> )
|
||||
(warning && <ThemedFieldWarning className="inputField-warning">{warning}</ThemedFieldWarning>)
|
||||
}
|
||||
</div>
|
||||
) }
|
||||
|
@ -44,4 +44,4 @@ const ThemedFieldWarning = styled('div')(({ theme }) => ({
|
|||
color: theme.palette.warning.main
|
||||
}));
|
||||
|
||||
export default InputField;
|
||||
export default InputField;
|
||||
|
|
|
@ -49,7 +49,7 @@ const CardCallout = ({ name }) => {
|
|||
|
||||
return (
|
||||
<span className='callout'>
|
||||
<span
|
||||
<span
|
||||
onMouseEnter={handlePopoverOpen}
|
||||
onMouseLeave={handlePopoverClose}
|
||||
>{card?.name || token?.name?.value || name}</span>
|
||||
|
@ -74,8 +74,8 @@ const CardCallout = ({ name }) => {
|
|||
}}
|
||||
>
|
||||
<div className="callout-card">
|
||||
{ card && ( <CardDetails card={card} /> ) }
|
||||
{ token && ( <TokenDetails token={token} /> ) }
|
||||
{ card && (<CardDetails card={card} />) }
|
||||
{ token && (<TokenDetails token={token} />) }
|
||||
</div>
|
||||
</Popover>
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import { NavLink, generatePath } from "react-router-dom";
|
||||
import { NavLink, generatePath } from 'react-router-dom';
|
||||
|
||||
import {
|
||||
RouteEnum,
|
||||
|
@ -39,7 +39,7 @@ const ParsedMessage = ({ message }) => {
|
|||
|
||||
return (
|
||||
<div>
|
||||
{ name && ( <strong><PlayerLink name={name} />:</strong> ) }
|
||||
{ name && (<strong><PlayerLink name={name} />:</strong>) }
|
||||
{ messageChunks }
|
||||
</div>
|
||||
);
|
||||
|
@ -61,7 +61,7 @@ function parseMessage(message) {
|
|||
function parseChunks(chunk, index) {
|
||||
if (chunk.match(CARD_CALLOUT_REGEX)) {
|
||||
const name = chunk.replace(CALLOUT_BOUNDARY_REGEX, '').trim();
|
||||
return ( <CardCallout name={name} key={index}></CardCallout> );
|
||||
return (<CardCallout name={name} key={index}></CardCallout>);
|
||||
}
|
||||
|
||||
if (chunk.match(URL_REGEX)) {
|
||||
|
@ -80,7 +80,7 @@ function parseUrlChunk(chunk) {
|
|||
.filter(urlChunk => !!urlChunk)
|
||||
.map((urlChunk, index) => {
|
||||
if (urlChunk.match(URL_REGEX)) {
|
||||
return ( <a className='link' href={urlChunk} key={index} target='_blank' rel='noopener noreferrer'>{urlChunk}</a> );
|
||||
return (<a className='link' href={urlChunk} key={index} target='_blank' rel='noopener noreferrer'>{urlChunk}</a>);
|
||||
}
|
||||
|
||||
return urlChunk;
|
||||
|
@ -95,7 +95,7 @@ function parseMentionChunk(chunk) {
|
|||
|
||||
if (mention) {
|
||||
const name = mention[0].substr(1);
|
||||
return ( <PlayerLink name={name} label={mention} key={index} /> );
|
||||
return (<PlayerLink name={name} label={mention} key={index} />);
|
||||
}
|
||||
|
||||
return mentionChunk;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React from "react";
|
||||
import React from 'react';
|
||||
import Dialog from '@material-ui/core/Dialog';
|
||||
import DialogContent from '@material-ui/core/DialogContent';
|
||||
import DialogTitle from '@material-ui/core/DialogTitle';
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import React, { useEffect, useRef } from "react";
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
|
||||
const ScrollToBottomOnChanges = ({ content, changes }) => {
|
||||
const messagesEndRef = useRef(null);
|
||||
|
||||
// @TODO (2)
|
||||
const scrollToBottom = () => {
|
||||
messagesEndRef.current.scrollIntoView({ behavior: "smooth" })
|
||||
messagesEndRef.current.scrollIntoView({ behavior: 'smooth' })
|
||||
}
|
||||
|
||||
useEffect(scrollToBottom, [changes]);
|
||||
|
@ -22,4 +22,4 @@ const ScrollToBottomOnChanges = ({ content, changes }) => {
|
|||
)
|
||||
}
|
||||
|
||||
export default ScrollToBottomOnChanges;
|
||||
export default ScrollToBottomOnChanges;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import React from "react";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import React from 'react';
|
||||
import FormControl from '@material-ui/core/FormControl';
|
||||
import InputLabel from '@material-ui/core/InputLabel';
|
||||
import MenuItem from '@material-ui/core/MenuItem';
|
||||
import Select from '@material-ui/core/Select';
|
||||
|
||||
import './SelectField.css';
|
||||
|
||||
const SelectField = ({ input, label, options, value }) => {
|
||||
const id = label + "-select-field";
|
||||
const labelId = id + "-label";
|
||||
const id = label + '-select-field';
|
||||
const labelId = id + '-label';
|
||||
|
||||
return (
|
||||
<FormControl variant="outlined" margin="dense" className="select-field">
|
||||
|
@ -19,12 +19,12 @@ const SelectField = ({ input, label, options, value }) => {
|
|||
value={value}
|
||||
{ ...input }
|
||||
>{
|
||||
options.map((option, index) => (
|
||||
<MenuItem value={index} key={index}> { option } </MenuItem>
|
||||
))
|
||||
}</Select>
|
||||
options.map((option, index) => (
|
||||
<MenuItem value={index} key={index}> { option } </MenuItem>
|
||||
))
|
||||
}</Select>
|
||||
</FormControl>
|
||||
);
|
||||
};
|
||||
|
||||
export default SelectField;
|
||||
export default SelectField;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component, CElement } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import Hidden from "@material-ui/core/Hidden";
|
||||
import { connect } from 'react-redux';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import Hidden from '@material-ui/core/Hidden';
|
||||
|
||||
import "./ThreePaneLayout.css";
|
||||
import './ThreePaneLayout.css';
|
||||
|
||||
// @DEPRECATED
|
||||
// This component sucks balls, dont use it. It will be removed sooner than later.
|
||||
|
@ -15,14 +15,14 @@ class ThreePaneLayout extends Component<ThreePaneLayoutProps> {
|
|||
<Grid container spacing={2} className="grid">
|
||||
<Grid item xs={12} md={9} lg={10} className="grid-main">
|
||||
<Grid item className={
|
||||
"grid-main__top"
|
||||
+ (this.props.fixedHeight ? " fixedHeight" : "")
|
||||
'grid-main__top'
|
||||
+ (this.props.fixedHeight ? ' fixedHeight' : '')
|
||||
}>
|
||||
{this.props.top}
|
||||
</Grid>
|
||||
<Grid item className={
|
||||
"grid-main__bottom"
|
||||
+ (this.props.fixedHeight ? " fixedHeight" : "")
|
||||
'grid-main__bottom'
|
||||
+ (this.props.fixedHeight ? ' fixedHeight' : '')
|
||||
}>
|
||||
{this.props.bottom}
|
||||
</Grid>
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { NavLink, generatePath } from "react-router-dom";
|
||||
import { connect } from 'react-redux';
|
||||
import { NavLink, generatePath } from 'react-router-dom';
|
||||
|
||||
import Menu from "@material-ui/core/Menu";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Menu from '@material-ui/core/Menu';
|
||||
import MenuItem from '@material-ui/core/MenuItem';
|
||||
|
||||
import { Images } from "images/Images";
|
||||
import { SessionService } from "api";
|
||||
import { ServerSelectors } from "store";
|
||||
import { RouteEnum, User } from "types";
|
||||
import { Images } from 'images/Images';
|
||||
import { SessionService } from 'api';
|
||||
import { ServerSelectors } from 'store';
|
||||
import { RouteEnum, User } from 'types';
|
||||
|
||||
import "./UserDisplay.css";
|
||||
import './UserDisplay.css';
|
||||
|
||||
|
||||
class UserDisplay extends Component<UserDisplayProps, UserDisplayState> {
|
||||
|
@ -117,13 +117,13 @@ class UserDisplay extends Component<UserDisplayProps, UserDisplayState> {
|
|||
</NavLink>
|
||||
{
|
||||
!isABuddy
|
||||
? ( <MenuItem dense onClick={this.addToBuddyList}>Add to Buddy List</MenuItem> )
|
||||
: ( <MenuItem dense onClick={this.removeFromBuddyList}>Remove From Buddy List</MenuItem> )
|
||||
? (<MenuItem dense onClick={this.addToBuddyList}>Add to Buddy List</MenuItem>)
|
||||
: (<MenuItem dense onClick={this.removeFromBuddyList}>Remove From Buddy List</MenuItem>)
|
||||
}
|
||||
{
|
||||
!isIgnored
|
||||
? ( <MenuItem dense onClick={this.addToIgnoreList}>Add to Ignore List</MenuItem> )
|
||||
: ( <MenuItem dense onClick={this.removeFromIgnoreList}>Remove From Ignore List</MenuItem> )
|
||||
? (<MenuItem dense onClick={this.addToIgnoreList}>Add to Ignore List</MenuItem>)
|
||||
: (<MenuItem dense onClick={this.removeFromIgnoreList}>Remove From Ignore List</MenuItem>)
|
||||
}
|
||||
</Menu>
|
||||
</div>
|
||||
|
|
|
@ -7,8 +7,8 @@ export { default as InputAction } from './InputAction/InputAction';
|
|||
export { default as KnownHosts } from './KnownHosts/KnownHosts';
|
||||
export { default as Message } from './Message/Message';
|
||||
export { default as VirtualList } from './VirtualList/VirtualList';
|
||||
export { default as UserDisplay} from './UserDisplay/UserDisplay';
|
||||
export { default as ThreePaneLayout } from './ThreePaneLayout/ThreePaneLayout';
|
||||
export { default as UserDisplay } from './UserDisplay/UserDisplay';
|
||||
export { default as ThreePaneLayout } from './ThreePaneLayout/ThreePaneLayout';
|
||||
export { default as CheckboxField } from './CheckboxField/CheckboxField';
|
||||
export { default as SelectField } from './SelectField/SelectField';
|
||||
export { default as ScrollToBottomOnChanges } from './ScrollToBottomOnChanges/ScrollToBottomOnChanges';
|
||||
|
@ -16,7 +16,7 @@ export { default as RegistrationDialog } from './RegistrationDialog/Registration
|
|||
|
||||
// Guards
|
||||
export { default as AuthGuard } from './Guard/AuthGuard';
|
||||
export { default as ModGuard} from './Guard/ModGuard';
|
||||
export { default as ModGuard } from './Guard/ModGuard';
|
||||
|
||||
// Dialogs
|
||||
export { default as CardImportDialog} from './CardImportDialog/CardImportDialog';
|
||||
export { default as CardImportDialog } from './CardImportDialog/CardImportDialog';
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import Button from "@material-ui/core/Button";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Button from '@material-ui/core/Button';
|
||||
import ListItem from '@material-ui/core/ListItem';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
|
||||
import { UserDisplay, VirtualList, AuthGuard } from "components";
|
||||
import { AuthenticationService, SessionService } from "api";
|
||||
import { ServerSelectors } from "store";
|
||||
import { UserDisplay, VirtualList, AuthGuard } from 'components';
|
||||
import { AuthenticationService, SessionService } from 'api';
|
||||
import { ServerSelectors } from 'store';
|
||||
import { User } from 'types';
|
||||
|
||||
import AddToBuddies from './AddToBuddies';
|
||||
import AddToIgnore from './AddToIgnore';
|
||||
|
||||
import "./Account.css";
|
||||
import './Account.css';
|
||||
|
||||
class Account extends Component<AccountProps> {
|
||||
handleAddToBuddies({ userName }) {
|
||||
|
@ -31,7 +31,7 @@ class Account extends Component<AccountProps> {
|
|||
const { buddyList, ignoreList, serverName, serverVersion, user } = this.props;
|
||||
const { country, realName, name, userLevel, accountageSecs, avatarBmp } = user;
|
||||
|
||||
var url = URL.createObjectURL(new Blob([avatarBmp], {'type': 'image/png'}));
|
||||
let url = URL.createObjectURL(new Blob([avatarBmp], { 'type': 'image/png' }));
|
||||
|
||||
return (
|
||||
<div className="account">
|
||||
|
@ -47,9 +47,9 @@ class Account extends Component<AccountProps> {
|
|||
<ListItem button dense>
|
||||
<UserDisplay user={user} />
|
||||
</ListItem>
|
||||
) ) }
|
||||
)) }
|
||||
/>
|
||||
<div className="" style={{borderTop: "1px solid"}}>
|
||||
<div className="" style={{ borderTop: '1px solid' }}>
|
||||
<AddToBuddies onSubmit={this.handleAddToBuddies} />
|
||||
</div>
|
||||
</Paper>
|
||||
|
@ -65,15 +65,15 @@ class Account extends Component<AccountProps> {
|
|||
<ListItem button dense>
|
||||
<UserDisplay user={user} />
|
||||
</ListItem>
|
||||
) ) }
|
||||
)) }
|
||||
/>
|
||||
<div className="" style={{borderTop: "1px solid"}}>
|
||||
<div className="" style={{ borderTop: '1px solid' }}>
|
||||
<AddToIgnore onSubmit={this.handleAddToIgnore} />
|
||||
</div>
|
||||
</Paper>
|
||||
</div>
|
||||
<div className="account-column overflow-scroll">
|
||||
<Paper className="account-details" style={{margin: "0 0 5px 0"}}>
|
||||
<Paper className="account-details" style={{ margin: '0 0 5px 0' }}>
|
||||
<img src={url} alt={name} />
|
||||
<p><strong>{name}</strong></p>
|
||||
<p>Location: ({country?.toUpperCase()})</p>
|
||||
|
@ -92,7 +92,7 @@ class Account extends Component<AccountProps> {
|
|||
<Button color="primary" variant="contained" onClick={() => AuthenticationService.disconnect()}>Disconnect</Button>
|
||||
</Paper>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// eslint-disable-next-line
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Form, reduxForm } from "redux-form"
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, reduxForm } from 'redux-form'
|
||||
|
||||
import { InputAction } from 'components';
|
||||
import { FormKey } from 'types';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// eslint-disable-next-line
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Form, reduxForm } from "redux-form"
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, reduxForm } from 'redux-form'
|
||||
|
||||
import { InputAction } from 'components';
|
||||
import { FormKey } from 'types';
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { Provider } from "react-redux";
|
||||
import { MemoryRouter as Router } from "react-router-dom";
|
||||
import CssBaseline from "@material-ui/core/CssBaseline";
|
||||
import { store } from "store";
|
||||
import { Provider } from 'react-redux';
|
||||
import { MemoryRouter as Router } from 'react-router-dom';
|
||||
import CssBaseline from '@material-ui/core/CssBaseline';
|
||||
import { store } from 'store';
|
||||
import { Header } from 'components';
|
||||
import Routes from "./AppShellRoutes";
|
||||
import Routes from './AppShellRoutes';
|
||||
|
||||
import "./AppShell.css";
|
||||
import './AppShell.css';
|
||||
|
||||
class AppShell extends Component {
|
||||
componentDidMount() {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import React from "react";
|
||||
import { Redirect, Route, Switch } from "react-router-dom";
|
||||
import React from 'react';
|
||||
import { Redirect, Route, Switch } from 'react-router-dom';
|
||||
|
||||
import { RouteEnum } from "types";
|
||||
import { RouteEnum } from 'types';
|
||||
import {
|
||||
Account,
|
||||
Decks,
|
||||
Game,
|
||||
Player,
|
||||
Room,
|
||||
Server,
|
||||
Decks,
|
||||
Game,
|
||||
Player,
|
||||
Room,
|
||||
Server,
|
||||
Login,
|
||||
Logs
|
||||
} from "containers";
|
||||
} from 'containers';
|
||||
|
||||
const Routes = () => (
|
||||
<div className="AppShell-routes overflow-scroll">
|
||||
|
@ -30,4 +30,4 @@ const Routes = () => (
|
|||
</div>
|
||||
);
|
||||
|
||||
export default Routes;
|
||||
export default Routes;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
|
||||
import { AuthGuard } from "components/index";
|
||||
import { AuthGuard } from 'components/index';
|
||||
|
||||
import "./Decks.css";
|
||||
import './Decks.css';
|
||||
|
||||
class Decks extends Component {
|
||||
render() {
|
||||
|
@ -16,4 +16,4 @@ class Decks extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default Decks;
|
||||
export default Decks;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
|
||||
import { AuthGuard } from "components";
|
||||
import { AuthGuard } from 'components';
|
||||
|
||||
import "./Game.css";
|
||||
import './Game.css';
|
||||
|
||||
class Game extends Component {
|
||||
render() {
|
||||
|
@ -16,4 +16,4 @@ class Game extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default Game;
|
||||
export default Game;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
// eslint-disable-next-line
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Redirect } from "react-router-dom";
|
||||
import { connect } from 'react-redux';
|
||||
import { Redirect } from 'react-router-dom';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import Button from '@material-ui/core/Button';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
|
||||
import { AuthenticationService } from "api";
|
||||
import { LoginForm } from "forms";
|
||||
import { Images } from "images";
|
||||
import { RouteEnum } from "types";
|
||||
import { /* ServerDispatch, */ ServerSelectors } from "store";
|
||||
import { AuthenticationService } from 'api';
|
||||
import { LoginForm } from 'forms';
|
||||
import { Images } from 'images';
|
||||
import { RouteEnum } from 'types';
|
||||
import { ServerSelectors } from 'store';
|
||||
|
||||
import "./Login.css";
|
||||
import './Login.css';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
@ -58,7 +58,7 @@ const Login = ({ state, description }: LoginProps) => {
|
|||
|
||||
const showDescription = () => {
|
||||
return !isConnected && description?.length;
|
||||
}
|
||||
};
|
||||
|
||||
const createAccount = () => {
|
||||
console.log('Login.createAccount->openForgotPasswordDialog');
|
||||
|
@ -131,7 +131,9 @@ const Login = ({ state, description }: LoginProps) => {
|
|||
</div>
|
||||
{ /*<img src={loginGraphic} className="login-content__description-image"/>*/}
|
||||
<p className="login-content__description-subtitle1">Play multiplayer card games online.</p>
|
||||
<p className="login-content__description-subtitle2">Cross-platform virtual tabletop for multiplayer card games. Forever free.</p>
|
||||
<p className="login-content__description-subtitle2">
|
||||
Cross-platform virtual tabletop for multiplayer card games. Forever free.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Paper>
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import React from "react";
|
||||
import * as _ from "lodash";
|
||||
import React from 'react';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import AppBar from "@material-ui/core/AppBar";
|
||||
import Box from "@material-ui/core/Box";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import Tab from "@material-ui/core/Tab";
|
||||
import Tabs from "@material-ui/core/Tabs";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import AppBar from '@material-ui/core/AppBar';
|
||||
import Box from '@material-ui/core/Box';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
import Table from '@material-ui/core/Table';
|
||||
import TableBody from '@material-ui/core/TableBody';
|
||||
import TableCell from '@material-ui/core/TableCell';
|
||||
import TableHead from '@material-ui/core/TableHead';
|
||||
import TableRow from '@material-ui/core/TableRow';
|
||||
import Tab from '@material-ui/core/Tab';
|
||||
import Tabs from '@material-ui/core/Tabs';
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
|
||||
import "./LogResults.css";
|
||||
import './LogResults.css';
|
||||
|
||||
const LogResults = (props) => {
|
||||
const { logs } = props;
|
||||
|
@ -21,7 +21,7 @@ const LogResults = (props) => {
|
|||
const hasRoomLogs = logs.room && logs.room.length;
|
||||
const hasGameLogs = logs.game && logs.game.length;
|
||||
const hasChatLogs = logs.chat && logs.chat.length;
|
||||
|
||||
|
||||
const [value, setValue] = React.useState(0);
|
||||
|
||||
const handleChange = (event, newValue) => {
|
||||
|
@ -30,32 +30,32 @@ const LogResults = (props) => {
|
|||
|
||||
const headerCells = [
|
||||
{
|
||||
label: "Time"
|
||||
label: 'Time'
|
||||
},
|
||||
{
|
||||
label: "Sender Name"
|
||||
label: 'Sender Name'
|
||||
},
|
||||
{
|
||||
label: "Sender IP"
|
||||
label: 'Sender IP'
|
||||
},
|
||||
{
|
||||
label: "Message"
|
||||
label: 'Message'
|
||||
},
|
||||
{
|
||||
label: "Target ID"
|
||||
label: 'Target ID'
|
||||
},
|
||||
{
|
||||
label: "Target Name"
|
||||
label: 'Target Name'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<AppBar position="static">
|
||||
<Tabs value={value} onChange={handleChange} aria-label="simple tabs example">
|
||||
<Tab label={"Rooms" + (hasRoomLogs ? ` [${logs.room.length}]` : "")} {...a11yProps(0)} />
|
||||
<Tab label={"Games" + (hasGameLogs ? ` [${logs.game.length}]` : "")} {...a11yProps(1)} />
|
||||
<Tab label={"Chats" + (hasChatLogs ? ` [${logs.chat.length}]` : "")} {...a11yProps(2)} />
|
||||
<Tab label={'Rooms' + (hasRoomLogs ? ` [${logs.room.length}]` : '')} {...a11yProps(0)} />
|
||||
<Tab label={'Games' + (hasGameLogs ? ` [${logs.game.length}]` : '')} {...a11yProps(1)} />
|
||||
<Tab label={'Chats' + (hasChatLogs ? ` [${logs.chat.length}]` : '')} {...a11yProps(2)} />
|
||||
</Tabs>
|
||||
</AppBar>
|
||||
<TabPanel value={value} index={0}>
|
||||
|
@ -74,7 +74,7 @@ const LogResults = (props) => {
|
|||
const a11yProps = index => {
|
||||
return {
|
||||
id: `simple-tab-${index}`,
|
||||
"aria-controls": `simple-tabpanel-${index}`,
|
||||
'aria-controls': `simple-tabpanel-${index}`,
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -93,7 +93,7 @@ const TabPanel = ({ children, value, index, ...other }) => {
|
|||
);
|
||||
};
|
||||
|
||||
const Results = ({headerCells, logs}) => (
|
||||
const Results = ({ headerCells, logs }) => (
|
||||
<Paper className="log-results">
|
||||
<Table size="small">
|
||||
<TableHead>
|
||||
|
@ -119,4 +119,4 @@ const Results = ({headerCells, logs}) => (
|
|||
</Paper>
|
||||
);
|
||||
|
||||
export default LogResults;
|
||||
export default LogResults;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import * as _ from "lodash";
|
||||
import { connect } from 'react-redux';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { ModeratorService } from "api";
|
||||
import { AuthGuard, ModGuard} from "components";
|
||||
import { SearchForm } from "forms";
|
||||
import { ServerDispatch, ServerSelectors, ServerStateLogs } from "store";
|
||||
import { ModeratorService } from 'api';
|
||||
import { AuthGuard, ModGuard } from 'components';
|
||||
import { SearchForm } from 'forms';
|
||||
import { ServerDispatch, ServerSelectors, ServerStateLogs } from 'store';
|
||||
|
||||
import LogResults from "./LogResults";
|
||||
import "./Logs.css";
|
||||
import LogResults from './LogResults';
|
||||
import './Logs.css';
|
||||
|
||||
class Logs extends Component<LogsTypes> {
|
||||
MAXIMUM_RESULTS = 1000;
|
||||
|
@ -26,7 +26,7 @@ class Logs extends Component<LogsTypes> {
|
|||
|
||||
onSubmit(fields) {
|
||||
const trimmedFields: any = this.trimFields(fields);
|
||||
|
||||
|
||||
const { userName, ipAddress, gameName, gameId, message, logLocation } = trimmedFields;
|
||||
|
||||
const required = _.filter({
|
||||
|
@ -48,7 +48,7 @@ class Logs extends Component<LogsTypes> {
|
|||
|
||||
private trimFields(fields) {
|
||||
return _.reduce(fields, (obj, field, key) => {
|
||||
if (typeof field === "string") {
|
||||
if (typeof field === 'string') {
|
||||
const trimmed = _.trim(field);
|
||||
|
||||
if (!!trimmed) {
|
||||
|
@ -74,7 +74,7 @@ class Logs extends Component<LogsTypes> {
|
|||
<div className="moderator-logs overflow-scroll">
|
||||
<AuthGuard />
|
||||
<ModGuard />
|
||||
|
||||
|
||||
<div className="moderator-logs__form">
|
||||
<SearchForm onSubmit={this.onSubmit} />
|
||||
</div>
|
||||
|
@ -82,7 +82,7 @@ class Logs extends Component<LogsTypes> {
|
|||
<div className="moderator-logs__results">
|
||||
<LogResults logs={this.props.logs} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
|
||||
import { AuthGuard } from "components";
|
||||
import { AuthGuard } from 'components';
|
||||
|
||||
class Player extends Component {
|
||||
render() {
|
||||
|
@ -14,4 +14,4 @@ class Player extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default Player;
|
||||
export default Player;
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import * as _ from "lodash";
|
||||
import { connect } from 'react-redux';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Table from '@material-ui/core/Table';
|
||||
import TableBody from '@material-ui/core/TableBody';
|
||||
import TableCell from '@material-ui/core/TableCell';
|
||||
import TableHead from '@material-ui/core/TableHead';
|
||||
import TableRow from '@material-ui/core/TableRow';
|
||||
import TableSortLabel from '@material-ui/core/TableSortLabel';
|
||||
import Tooltip from '@material-ui/core/Tooltip';
|
||||
|
||||
// import { RoomsService } from "AppShell/common/services";
|
||||
|
||||
import { SortUtil, RoomsDispatch, RoomsSelectors } from "store";
|
||||
import { UserDisplay } from "components";
|
||||
import { SortUtil, RoomsDispatch, RoomsSelectors } from 'store';
|
||||
import { UserDisplay } from 'components';
|
||||
|
||||
import "./Games.css";
|
||||
import './Games.css';
|
||||
|
||||
// @TODO run interval to update timeSinceCreated
|
||||
class Games extends Component<GamesProps> {
|
||||
private headerCells = [
|
||||
{
|
||||
label: "Age",
|
||||
field: "startTime"
|
||||
label: 'Age',
|
||||
field: 'startTime'
|
||||
},
|
||||
{
|
||||
label: "Description",
|
||||
field: "description"
|
||||
label: 'Description',
|
||||
field: 'description'
|
||||
},
|
||||
{
|
||||
label: "Creator",
|
||||
field: "creatorInfo.name"
|
||||
label: 'Creator',
|
||||
field: 'creatorInfo.name'
|
||||
},
|
||||
{
|
||||
label: "Type",
|
||||
field: "gameType"
|
||||
label: 'Type',
|
||||
field: 'gameType'
|
||||
},
|
||||
{
|
||||
label: "Restrictions",
|
||||
label: 'Restrictions',
|
||||
// field: "?"
|
||||
},
|
||||
{
|
||||
label: "Players",
|
||||
label: 'Players',
|
||||
// field: ["maxPlayers", "playerCount"]
|
||||
},
|
||||
{
|
||||
label: "Spectators",
|
||||
field: "spectatorsCount"
|
||||
label: 'Spectators',
|
||||
field: 'spectatorsCount'
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import React from "react";
|
|||
|
||||
import { Message } from 'components';
|
||||
|
||||
import "./Messages.css";
|
||||
import './Messages.css';
|
||||
|
||||
const Messages = ({ messages }) => (
|
||||
<div className="messages">
|
||||
|
@ -12,7 +12,7 @@ const Messages = ({ messages }) => (
|
|||
<div className="message-wrapper" key={message.timeReceived}>
|
||||
<Message message={message} />
|
||||
</div>
|
||||
) )
|
||||
))
|
||||
}
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import * as _ from "lodash";
|
||||
import { connect } from 'react-redux';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Table from '@material-ui/core/Table';
|
||||
import TableBody from '@material-ui/core/TableBody';
|
||||
import TableCell from '@material-ui/core/TableCell';
|
||||
import TableHead from '@material-ui/core/TableHead';
|
||||
import TableRow from '@material-ui/core/TableRow';
|
||||
import TableSortLabel from '@material-ui/core/TableSortLabel';
|
||||
import Tooltip from '@material-ui/core/Tooltip';
|
||||
|
||||
// import { RoomsService } from "AppShell/common/services";
|
||||
|
||||
import { SortUtil, RoomsDispatch, RoomsSelectors } from "store";
|
||||
import { UserDisplay } from "components";
|
||||
import { SortUtil, RoomsDispatch, RoomsSelectors } from 'store';
|
||||
import { UserDisplay } from 'components';
|
||||
|
||||
import "./OpenGames.css";
|
||||
import './OpenGames.css';
|
||||
|
||||
// @TODO run interval to update timeSinceCreated
|
||||
class OpenGames extends Component<OpenGamesProps> {
|
||||
private headerCells = [
|
||||
{
|
||||
label: "Age",
|
||||
field: "startTime"
|
||||
label: 'Age',
|
||||
field: 'startTime'
|
||||
},
|
||||
{
|
||||
label: "Description",
|
||||
field: "description"
|
||||
label: 'Description',
|
||||
field: 'description'
|
||||
},
|
||||
{
|
||||
label: "Creator",
|
||||
field: "creatorInfo.name"
|
||||
label: 'Creator',
|
||||
field: 'creatorInfo.name'
|
||||
},
|
||||
{
|
||||
label: "Type",
|
||||
field: "gameType"
|
||||
label: 'Type',
|
||||
field: 'gameType'
|
||||
},
|
||||
{
|
||||
label: "Restrictions",
|
||||
label: 'Restrictions',
|
||||
// field: "?"
|
||||
},
|
||||
{
|
||||
label: "Players",
|
||||
label: 'Players',
|
||||
// field: ["maxPlayers", "playerCount"]
|
||||
},
|
||||
{
|
||||
label: "Spectators",
|
||||
field: "spectatorsCount"
|
||||
label: 'Spectators',
|
||||
field: 'spectatorsCount'
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter /*, RouteComponentProps */, generatePath } from "react-router-dom";
|
||||
import { connect } from 'react-redux';
|
||||
import { withRouter, generatePath } from 'react-router-dom';
|
||||
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import ListItem from '@material-ui/core/ListItem';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
|
||||
import { RoomsService } from "api";
|
||||
import { ScrollToBottomOnChanges, ThreePaneLayout, UserDisplay, VirtualList, AuthGuard} from "components";
|
||||
import { RoomsStateMessages, RoomsStateRooms, JoinedRooms, RoomsSelectors } from "store";
|
||||
import { RouteEnum } from "types";
|
||||
import { RoomsService } from 'api';
|
||||
import { ScrollToBottomOnChanges, ThreePaneLayout, UserDisplay, VirtualList, AuthGuard } from 'components';
|
||||
import { RoomsStateMessages, RoomsStateRooms, JoinedRooms, RoomsSelectors } from 'store';
|
||||
import { RouteEnum } from 'types';
|
||||
|
||||
import OpenGames from "./OpenGames";
|
||||
import Messages from "./Messages";
|
||||
import SayMessage from "./SayMessage";
|
||||
import OpenGames from './OpenGames';
|
||||
import Messages from './Messages';
|
||||
import SayMessage from './SayMessage';
|
||||
|
||||
import "./Room.css";
|
||||
import './Room.css';
|
||||
|
||||
// @TODO (3)
|
||||
class Room extends Component<any> {
|
||||
|
@ -25,7 +25,7 @@ class Room extends Component<any> {
|
|||
|
||||
roomId = parseInt(roomId, 0);
|
||||
|
||||
if (!joined.find(({roomId: id}) => id === roomId)) {
|
||||
if (!joined.find(({ roomId: id }) => id === roomId)) {
|
||||
history.push(generatePath(RouteEnum.SERVER));
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class Room extends Component<any> {
|
|||
top={(
|
||||
<Paper className="room-view__games overflow-scroll">
|
||||
<OpenGames room={room} />
|
||||
</Paper>
|
||||
</Paper>
|
||||
)}
|
||||
|
||||
bottom={(
|
||||
|
@ -89,7 +89,7 @@ class Room extends Component<any> {
|
|||
<ListItem button className="room-view__side-list__item">
|
||||
<UserDisplay user={user} />
|
||||
</ListItem>
|
||||
) ) }
|
||||
)) }
|
||||
/>
|
||||
</Paper>
|
||||
)}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// eslint-disable-next-line
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Form, reduxForm } from "redux-form"
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, reduxForm } from 'redux-form'
|
||||
|
||||
import { InputAction } from 'components';
|
||||
|
||||
|
@ -12,7 +12,7 @@ const SayMessage = ({ handleSubmit }) => (
|
|||
);
|
||||
|
||||
const propsMap = {
|
||||
form: "sayMessage"
|
||||
form: 'sayMessage'
|
||||
};
|
||||
|
||||
export default connect()(reduxForm(propsMap)(SayMessage));
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
// eslint-disable-next-line
|
||||
import React from "react";
|
||||
import { generatePath } from "react-router-dom";
|
||||
import * as _ from "lodash";
|
||||
import { generatePath } from 'react-router-dom';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import Button from '@material-ui/core/Button';
|
||||
import Table from '@material-ui/core/Table';
|
||||
import TableBody from '@material-ui/core/TableBody';
|
||||
import TableCell from '@material-ui/core/TableCell';
|
||||
import TableHead from '@material-ui/core/TableHead';
|
||||
import TableRow from '@material-ui/core/TableRow';
|
||||
|
||||
|
||||
import { RoomsService } from "api";
|
||||
import { RouteEnum } from "types";
|
||||
import { RoomsService } from 'api';
|
||||
import { RouteEnum } from 'types';
|
||||
|
||||
import "./Rooms.css";
|
||||
import './Rooms.css';
|
||||
|
||||
const Rooms = ({ rooms, joinedRooms, history }) => {
|
||||
function onClick(roomId) {
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { connect } from 'react-redux';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import ListItem from '@material-ui/core/ListItem';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
|
||||
import { RoomsSelectors, ServerSelectors } from "store";
|
||||
import { RoomsSelectors, ServerSelectors } from 'store';
|
||||
|
||||
import { AuthGuard, ThreePaneLayout, UserDisplay, VirtualList } from "components";
|
||||
import { Room, User } from "types";
|
||||
import { AuthGuard, ThreePaneLayout, UserDisplay, VirtualList } from 'components';
|
||||
import { Room, User } from 'types';
|
||||
import Rooms from './Rooms';
|
||||
|
||||
import "./Server.css";
|
||||
import './Server.css';
|
||||
|
||||
class Server extends Component<ServerProps, ServerState> {
|
||||
render() {
|
||||
|
@ -46,7 +46,7 @@ class Server extends Component<ServerProps, ServerState> {
|
|||
<ListItem button dense>
|
||||
<UserDisplay user={user} />
|
||||
</ListItem>
|
||||
) ) }
|
||||
)) }
|
||||
/>
|
||||
</Paper>
|
||||
)}
|
||||
|
|
|
@ -2,8 +2,8 @@ export { default as AppShell } from './App/AppShell';
|
|||
export { default as Account } from './Account/Account';
|
||||
export { default as Game } from './Game/Game';
|
||||
export { default as Decks } from './Decks/Decks';
|
||||
export { default as Room } from "./Room/Room";
|
||||
export { default as Player } from "./Player/Player";
|
||||
export { default as Server } from "./Server/Server";
|
||||
export { default as Logs } from "./Logs/Logs";
|
||||
export { default as Login } from "./Login/Login";
|
||||
export { default as Room } from './Room/Room';
|
||||
export { default as Player } from './Player/Player';
|
||||
export { default as Server } from './Server/Server';
|
||||
export { default as Logs } from './Logs/Logs';
|
||||
export { default as Login } from './Login/Login';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Field, reduxForm} from 'redux-form'
|
||||
import { Form, Field, reduxForm } from 'redux-form'
|
||||
|
||||
import Button from '@material-ui/core/Button';
|
||||
import Stepper from '@material-ui/core/Stepper';
|
||||
|
@ -16,7 +16,7 @@ import { FormKey } from 'types';
|
|||
import './CardImportForm.css';
|
||||
|
||||
const CardImportForm = (props) => {
|
||||
const { handleSubmit, onSubmit:onClose } = props;
|
||||
const { handleSubmit, onSubmit: onClose } = props;
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [activeStep, setActiveStep] = useState(0);
|
||||
|
@ -25,7 +25,9 @@ const CardImportForm = (props) => {
|
|||
const [error, setError] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (loading) { setError(null); }
|
||||
if (loading) {
|
||||
setError(null);
|
||||
}
|
||||
}, [loading])
|
||||
|
||||
const steps = ['Imports sets', 'Save sets', 'Import tokens', 'Finished'];
|
||||
|
@ -50,7 +52,7 @@ const CardImportForm = (props) => {
|
|||
})
|
||||
.catch(({ message }) => setError(message))
|
||||
.finally(() => setLoading(false));
|
||||
}
|
||||
};
|
||||
|
||||
const handleCardSave = async () => {
|
||||
setLoading(true);
|
||||
|
@ -60,13 +62,13 @@ const CardImportForm = (props) => {
|
|||
await SetDTO.bulkAdd(importedSets);
|
||||
|
||||
handleNext();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setError('Failed to save cards');
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleTokenDownload = ({ tokenDownloadUrl }) => {
|
||||
setLoading(true);
|
||||
|
@ -78,7 +80,7 @@ const CardImportForm = (props) => {
|
|||
})
|
||||
.catch(({ message }) => setError(message))
|
||||
.finally(() => setLoading(false));
|
||||
}
|
||||
};
|
||||
|
||||
const getStepContent = (stepIndex) => {
|
||||
switch (stepIndex) {
|
||||
|
@ -172,7 +174,7 @@ const CardImportForm = (props) => {
|
|||
) }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const BackButton = ({ click, disabled }) => (
|
||||
<Button onClick={click} disabled={disabled}>Go Back</Button>
|
||||
|
@ -182,7 +184,7 @@ const ErrorMessage = ({ error }) => {
|
|||
return error && (
|
||||
<div className='error'>{error}</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const CardsImported = ({ cards, sets }) => {
|
||||
const items = [
|
||||
|
@ -192,11 +194,11 @@ const CardsImported = ({ cards, sets }) => {
|
|||
</div>
|
||||
),
|
||||
|
||||
( <div className='spacer' /> ),
|
||||
(<div className='spacer' />),
|
||||
|
||||
...sets.map(set => (
|
||||
<div>{set.name}: {set.cards.length} cards imported</div>
|
||||
) )
|
||||
))
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Form, Field, reduxForm, change} from "redux-form"
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Field, reduxForm, change } from 'redux-form'
|
||||
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
import { InputField } from "components";
|
||||
import { InputField } from 'components';
|
||||
import { FormKey, KnownHost, KnownHosts } from 'types';
|
||||
|
||||
import "./ConnectForm.css";
|
||||
import { Select, MenuItem } from "@material-ui/core";
|
||||
import './ConnectForm.css';
|
||||
import { Select, MenuItem } from '@material-ui/core';
|
||||
|
||||
const ConnectForm = (props) => {
|
||||
const { handleSubmit, dispatch } = props;
|
||||
|
@ -17,23 +17,23 @@ const ConnectForm = (props) => {
|
|||
|
||||
const handleChange = (event) => {
|
||||
setKnownHosts(event.target.value);
|
||||
dispatch(change(FormKey.CONNECT,'host', KnownHosts[event.target.value].host));
|
||||
dispatch(change(FormKey.CONNECT,'port', KnownHosts[event.target.value].port))
|
||||
dispatch(change(FormKey.CONNECT, 'host', KnownHosts[event.target.value].host));
|
||||
dispatch(change(FormKey.CONNECT, 'port', KnownHosts[event.target.value].port))
|
||||
};
|
||||
|
||||
return (
|
||||
<Form className="connectForm" onSubmit={handleSubmit}>
|
||||
<div className="connectForm-item">
|
||||
<Select
|
||||
labelId="selectedKnownHosts-label"
|
||||
id="selectedKnownHosts-label"
|
||||
className="selectKnownHosts-items"
|
||||
value={knownHosts}
|
||||
fullWidth={true}
|
||||
onChange={handleChange}
|
||||
>
|
||||
<MenuItem value={KnownHost.ROOSTER}>{KnownHost.ROOSTER}</MenuItem>
|
||||
<MenuItem value={KnownHost.TETRARCH}>{KnownHost.TETRARCH}</MenuItem>
|
||||
labelId="selectedKnownHosts-label"
|
||||
id="selectedKnownHosts-label"
|
||||
className="selectKnownHosts-items"
|
||||
value={knownHosts}
|
||||
fullWidth={true}
|
||||
onChange={handleChange}
|
||||
>
|
||||
<MenuItem value={KnownHost.ROOSTER}>{KnownHost.ROOSTER}</MenuItem>
|
||||
<MenuItem value={KnownHost.TETRARCH}>{KnownHost.TETRARCH}</MenuItem>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="connectForm-item">
|
||||
|
@ -53,7 +53,7 @@ const ConnectForm = (props) => {
|
|||
</Button>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const propsMap = {
|
||||
form: FormKey.CONNECT
|
||||
|
@ -63,8 +63,8 @@ const mapStateToProps = () => ({
|
|||
initialValues: {
|
||||
// host: "mtg.tetrarch.co/servatrice",
|
||||
// port: "443"
|
||||
host: "server.cockatrice.us",
|
||||
port: "4748"
|
||||
host: 'server.cockatrice.us',
|
||||
port: '4748'
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
// eslint-disable-next-line
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Form, Field, reduxForm, change } from "redux-form"
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Field, reduxForm, change } from 'redux-form'
|
||||
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
import { InputField, KnownHosts } from "components";
|
||||
import { InputField, KnownHosts } from 'components';
|
||||
// import { ServerDispatch } from "store";
|
||||
import { FormKey } from 'types';
|
||||
|
||||
import "./LoginForm.css";
|
||||
import './LoginForm.css';
|
||||
|
||||
const LoginForm = (props) => {
|
||||
const { dispatch, handleSubmit } = props;
|
||||
|
||||
const forgotPassword = () => {
|
||||
console.log("Show recover password dialog, then AuthService.forgotPasswordRequest");
|
||||
console.log('Show recover password dialog, then AuthService.forgotPasswordRequest');
|
||||
};
|
||||
|
||||
const onHostChange = ({ host, port }) => {
|
||||
|
@ -45,17 +45,25 @@ const LoginForm = (props) => {
|
|||
</Button>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const propsMap = {
|
||||
form: FormKey.LOGIN,
|
||||
validate: values => {
|
||||
const errors: any = {};
|
||||
|
||||
if (!values.user) errors.user = 'Required';
|
||||
if (!values.pass) errors.pass = 'Required';
|
||||
if (!values.host) errors.host = 'Required';
|
||||
if (!values.port) errors.port = 'Required';
|
||||
if (!values.user) {
|
||||
errors.user = 'Required';
|
||||
}
|
||||
if (!values.pass) {
|
||||
errors.pass = 'Required';
|
||||
}
|
||||
if (!values.host) {
|
||||
errors.host = 'Required';
|
||||
}
|
||||
if (!values.port) {
|
||||
errors.port = 'Required';
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Form, Field, reduxForm, change } from 'redux-form'
|
|||
|
||||
import Button from '@material-ui/core/Button';
|
||||
|
||||
import { InputField, KnownHosts } from 'components';
|
||||
import { InputField, KnownHosts } from 'components';
|
||||
import { FormKey } from 'types';
|
||||
|
||||
import './RegisterForm.css';
|
||||
|
@ -51,7 +51,7 @@ const RegisterForm = (props) => {
|
|||
|
||||
</Form >
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const propsMap = {
|
||||
form: FormKey.REGISTER,
|
||||
|
@ -59,7 +59,7 @@ const propsMap = {
|
|||
|
||||
const mapStateToProps = () => ({
|
||||
initialValues: {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
// eslint-disable-next-line
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Form, Field, reduxForm } from "redux-form"
|
||||
import { connect } from 'react-redux';
|
||||
import { Form, Field, reduxForm } from 'redux-form'
|
||||
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Divider from "@material-ui/core/Divider";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Button from '@material-ui/core/Button';
|
||||
import Divider from '@material-ui/core/Divider';
|
||||
import Paper from '@material-ui/core/Paper';
|
||||
|
||||
import { InputField, CheckboxField } from "components";
|
||||
import { FormKey } from "types";
|
||||
import { InputField, CheckboxField } from 'components';
|
||||
import { FormKey } from 'types';
|
||||
|
||||
import "./SearchForm.css";
|
||||
import './SearchForm.css';
|
||||
|
||||
const SearchForm = ({ handleSubmit }) => (
|
||||
<Paper className="log-search">
|
||||
|
@ -35,7 +35,7 @@ const SearchForm = ({ handleSubmit }) => (
|
|||
<Field label="Rooms" name="logLocation.room" component={CheckboxField} />
|
||||
<Field label="Games" name="logLocation.game" component={CheckboxField} />
|
||||
<Field label="Chats" name="logLocation.chat" component={CheckboxField} />
|
||||
</div>
|
||||
</div>
|
||||
<Divider />
|
||||
<div className="log-search__form-item">
|
||||
<span>Date Range: Coming Soon</span>
|
||||
|
@ -57,7 +57,7 @@ const propsMap = {
|
|||
};
|
||||
|
||||
const mapStateToProps = () => ({
|
||||
|
||||
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(reduxForm(propsMap)(SearchForm));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Countries } from "./countries/_Countries";
|
||||
import { Faces } from "./faces/_Faces";
|
||||
import { Countries } from './countries/_Countries';
|
||||
import { Faces } from './faces/_Faces';
|
||||
import Logo from './logo.png';
|
||||
|
||||
export class Images {
|
||||
|
|
|
@ -1,251 +1,251 @@
|
|||
import ad from "./ad.svg";
|
||||
import ae from "./ae.svg";
|
||||
import af from "./af.svg";
|
||||
import ag from "./ag.svg";
|
||||
import ai from "./ai.svg";
|
||||
import al from "./al.svg";
|
||||
import am from "./am.svg";
|
||||
import ao from "./ao.svg";
|
||||
import aq from "./aq.svg";
|
||||
import ar from "./ar.svg";
|
||||
import as from "./as.svg";
|
||||
import at from "./at.svg";
|
||||
import au from "./au.svg";
|
||||
import aw from "./aw.svg";
|
||||
import ax from "./ax.svg";
|
||||
import az from "./az.svg";
|
||||
import ba from "./ba.svg";
|
||||
import bb from "./bb.svg";
|
||||
import bd from "./bd.svg";
|
||||
import be from "./be.svg";
|
||||
import bf from "./bf.svg";
|
||||
import bg from "./bg.svg";
|
||||
import bh from "./bh.svg";
|
||||
import bi from "./bi.svg";
|
||||
import bj from "./bj.svg";
|
||||
import bl from "./bl.svg";
|
||||
import bm from "./bm.svg";
|
||||
import bn from "./bn.svg";
|
||||
import bo from "./bo.svg";
|
||||
import bq from "./bq.svg";
|
||||
import br from "./br.svg";
|
||||
import bs from "./bs.svg";
|
||||
import bt from "./bt.svg";
|
||||
import bv from "./bv.svg";
|
||||
import bw from "./bw.svg";
|
||||
import by from "./by.svg";
|
||||
import bz from "./bz.svg";
|
||||
import ca from "./ca.svg";
|
||||
import cc from "./cc.svg";
|
||||
import cd from "./cd.svg";
|
||||
import cf from "./cf.svg";
|
||||
import cg from "./cg.svg";
|
||||
import ch from "./ch.svg";
|
||||
import ci from "./ci.svg";
|
||||
import ck from "./ck.svg";
|
||||
import cl from "./cl.svg";
|
||||
import cm from "./cm.svg";
|
||||
import cr from "./cr.svg";
|
||||
import cu from "./cu.svg";
|
||||
import cv from "./cv.svg";
|
||||
import cw from "./cw.svg";
|
||||
import cx from "./cx.svg";
|
||||
import cy from "./cy.svg";
|
||||
import cz from "./cz.svg";
|
||||
import de from "./de.svg";
|
||||
import dj from "./dj.svg";
|
||||
import dk from "./dk.svg";
|
||||
import dm from "./dm.svg";
|
||||
import _do from "./do.svg";
|
||||
import dz from "./dz.svg";
|
||||
import ec from "./ec.svg";
|
||||
import ee from "./ee.svg";
|
||||
import eg from "./eg.svg";
|
||||
import eh from "./eh.svg";
|
||||
import er from "./er.svg";
|
||||
import es from "./es.svg";
|
||||
import et from "./et.svg";
|
||||
import eu from "./eu.svg";
|
||||
import fi from "./fi.svg";
|
||||
import fj from "./fj.svg";
|
||||
import fk from "./fk.svg";
|
||||
import fm from "./fm.svg";
|
||||
import fo from "./fo.svg";
|
||||
import fr from "./fr.svg";
|
||||
import ga from "./ga.svg";
|
||||
import gb from "./gb.svg";
|
||||
import gd from "./gd.svg";
|
||||
import ge from "./ge.svg";
|
||||
import gf from "./gf.svg";
|
||||
import gg from "./gg.svg";
|
||||
import gh from "./gh.svg";
|
||||
import gi from "./gi.svg";
|
||||
import gl from "./gl.svg";
|
||||
import gm from "./gm.svg";
|
||||
import gn from "./gn.svg";
|
||||
import gp from "./gp.svg";
|
||||
import gq from "./gq.svg";
|
||||
import gr from "./gr.svg";
|
||||
import gs from "./gs.svg";
|
||||
import gt from "./gt.svg";
|
||||
import gu from "./gu.svg";
|
||||
import gw from "./gw.svg";
|
||||
import gy from "./gy.svg";
|
||||
import hk from "./hk.svg";
|
||||
import hm from "./hm.svg";
|
||||
import hn from "./hn.svg";
|
||||
import hr from "./hr.svg";
|
||||
import ht from "./ht.svg";
|
||||
import hu from "./hu.svg";
|
||||
import id from "./id.svg";
|
||||
import ie from "./ie.svg";
|
||||
import il from "./il.svg";
|
||||
import im from "./im.svg";
|
||||
import _in from "./in.svg";
|
||||
import io from "./io.svg";
|
||||
import iq from "./iq.svg";
|
||||
import ir from "./ir.svg";
|
||||
import is from "./is.svg";
|
||||
import it from "./it.svg";
|
||||
import je from "./je.svg";
|
||||
import jm from "./jm.svg";
|
||||
import jo from "./jo.svg";
|
||||
import jp from "./jp.svg";
|
||||
import ke from "./ke.svg";
|
||||
import kg from "./kg.svg";
|
||||
import kh from "./kh.svg";
|
||||
import ki from "./ki.svg";
|
||||
import km from "./km.svg";
|
||||
import kn from "./kn.svg";
|
||||
import kp from "./kp.svg";
|
||||
import kr from "./kr.svg";
|
||||
import kw from "./kw.svg";
|
||||
import ky from "./ky.svg";
|
||||
import kz from "./kz.svg";
|
||||
import la from "./la.svg";
|
||||
import lb from "./lb.svg";
|
||||
import lc from "./lc.svg";
|
||||
import li from "./li.svg";
|
||||
import lk from "./lk.svg";
|
||||
import lr from "./lr.svg";
|
||||
import ls from "./ls.svg";
|
||||
import lt from "./lt.svg";
|
||||
import lu from "./lu.svg";
|
||||
import lv from "./lv.svg";
|
||||
import ly from "./ly.svg";
|
||||
import ma from "./ma.svg";
|
||||
import mc from "./mc.svg";
|
||||
import md from "./md.svg";
|
||||
import me from "./me.svg";
|
||||
import mf from "./mf.svg";
|
||||
import mg from "./mg.svg";
|
||||
import mh from "./mh.svg";
|
||||
import mk from "./mk.svg";
|
||||
import ml from "./ml.svg";
|
||||
import mm from "./mm.svg";
|
||||
import mn from "./mn.svg";
|
||||
import mo from "./mo.svg";
|
||||
import mp from "./mp.svg";
|
||||
import mq from "./mq.svg";
|
||||
import mr from "./mr.svg";
|
||||
import ms from "./ms.svg";
|
||||
import mt from "./mt.svg";
|
||||
import mu from "./mu.svg";
|
||||
import mv from "./mv.svg";
|
||||
import mw from "./mw.svg";
|
||||
import mx from "./mx.svg";
|
||||
import my from "./my.svg";
|
||||
import mz from "./mz.svg";
|
||||
import na from "./na.svg";
|
||||
import nc from "./nc.svg";
|
||||
import ne from "./ne.svg";
|
||||
import nf from "./nf.svg";
|
||||
import ng from "./ng.svg";
|
||||
import ni from "./ni.svg";
|
||||
import nl from "./nl.svg";
|
||||
import no from "./no.svg";
|
||||
import np from "./np.svg";
|
||||
import nr from "./nr.svg";
|
||||
import nu from "./nu.svg";
|
||||
import nz from "./nz.svg";
|
||||
import om from "./om.svg";
|
||||
import pa from "./pa.svg";
|
||||
import pe from "./pe.svg";
|
||||
import pf from "./pf.svg";
|
||||
import pg from "./pg.svg";
|
||||
import ph from "./ph.svg";
|
||||
import pk from "./pk.svg";
|
||||
import pl from "./pl.svg";
|
||||
import pm from "./pm.svg";
|
||||
import pn from "./pn.svg";
|
||||
import pr from "./pr.svg";
|
||||
import ps from "./ps.svg";
|
||||
import pt from "./pt.svg";
|
||||
import pw from "./pw.svg";
|
||||
import py from "./py.svg";
|
||||
import qa from "./qa.svg";
|
||||
import re from "./re.svg";
|
||||
import ro from "./ro.svg";
|
||||
import rs from "./rs.svg";
|
||||
import ru from "./ru.svg";
|
||||
import rw from "./rw.svg";
|
||||
import sa from "./sa.svg";
|
||||
import sb from "./sb.svg";
|
||||
import sc from "./sc.svg";
|
||||
import sd from "./sd.svg";
|
||||
import se from "./se.svg";
|
||||
import sg from "./sg.svg";
|
||||
import sh from "./sh.svg";
|
||||
import si from "./si.svg";
|
||||
import sj from "./sj.svg";
|
||||
import sk from "./sk.svg";
|
||||
import sl from "./sl.svg";
|
||||
import sm from "./sm.svg";
|
||||
import sn from "./sn.svg";
|
||||
import so from "./so.svg";
|
||||
import sr from "./sr.svg";
|
||||
import ss from "./ss.svg";
|
||||
import st from "./st.svg";
|
||||
import sv from "./sv.svg";
|
||||
import sx from "./sx.svg";
|
||||
import sy from "./sy.svg";
|
||||
import sz from "./sz.svg";
|
||||
import tc from "./tc.svg";
|
||||
import td from "./td.svg";
|
||||
import tf from "./tf.svg";
|
||||
import tg from "./tg.svg";
|
||||
import th from "./th.svg";
|
||||
import tj from "./tj.svg";
|
||||
import tk from "./tk.svg";
|
||||
import tl from "./tl.svg";
|
||||
import tm from "./tm.svg";
|
||||
import tn from "./tn.svg";
|
||||
import to from "./to.svg";
|
||||
import tr from "./tr.svg";
|
||||
import tt from "./tt.svg";
|
||||
import tv from "./tv.svg";
|
||||
import tw from "./tw.svg";
|
||||
import tz from "./tz.svg";
|
||||
import ua from "./ua.svg";
|
||||
import ug from "./ug.svg";
|
||||
import um from "./um.svg";
|
||||
import us from "./us.svg";
|
||||
import uy from "./uy.svg";
|
||||
import uz from "./uz.svg";
|
||||
import va from "./va.svg";
|
||||
import vc from "./vc.svg";
|
||||
import ve from "./ve.svg";
|
||||
import vg from "./vg.svg";
|
||||
import vi from "./vi.svg";
|
||||
import vn from "./vn.svg";
|
||||
import vu from "./vu.svg";
|
||||
import wf from "./wf.svg";
|
||||
import ws from "./ws.svg";
|
||||
import ye from "./ye.svg";
|
||||
import yt from "./yt.svg";
|
||||
import za from "./za.svg";
|
||||
import zm from "./zm.svg";
|
||||
import zw from "./zw.svg";
|
||||
import ad from './ad.svg';
|
||||
import ae from './ae.svg';
|
||||
import af from './af.svg';
|
||||
import ag from './ag.svg';
|
||||
import ai from './ai.svg';
|
||||
import al from './al.svg';
|
||||
import am from './am.svg';
|
||||
import ao from './ao.svg';
|
||||
import aq from './aq.svg';
|
||||
import ar from './ar.svg';
|
||||
import as from './as.svg';
|
||||
import at from './at.svg';
|
||||
import au from './au.svg';
|
||||
import aw from './aw.svg';
|
||||
import ax from './ax.svg';
|
||||
import az from './az.svg';
|
||||
import ba from './ba.svg';
|
||||
import bb from './bb.svg';
|
||||
import bd from './bd.svg';
|
||||
import be from './be.svg';
|
||||
import bf from './bf.svg';
|
||||
import bg from './bg.svg';
|
||||
import bh from './bh.svg';
|
||||
import bi from './bi.svg';
|
||||
import bj from './bj.svg';
|
||||
import bl from './bl.svg';
|
||||
import bm from './bm.svg';
|
||||
import bn from './bn.svg';
|
||||
import bo from './bo.svg';
|
||||
import bq from './bq.svg';
|
||||
import br from './br.svg';
|
||||
import bs from './bs.svg';
|
||||
import bt from './bt.svg';
|
||||
import bv from './bv.svg';
|
||||
import bw from './bw.svg';
|
||||
import by from './by.svg';
|
||||
import bz from './bz.svg';
|
||||
import ca from './ca.svg';
|
||||
import cc from './cc.svg';
|
||||
import cd from './cd.svg';
|
||||
import cf from './cf.svg';
|
||||
import cg from './cg.svg';
|
||||
import ch from './ch.svg';
|
||||
import ci from './ci.svg';
|
||||
import ck from './ck.svg';
|
||||
import cl from './cl.svg';
|
||||
import cm from './cm.svg';
|
||||
import cr from './cr.svg';
|
||||
import cu from './cu.svg';
|
||||
import cv from './cv.svg';
|
||||
import cw from './cw.svg';
|
||||
import cx from './cx.svg';
|
||||
import cy from './cy.svg';
|
||||
import cz from './cz.svg';
|
||||
import de from './de.svg';
|
||||
import dj from './dj.svg';
|
||||
import dk from './dk.svg';
|
||||
import dm from './dm.svg';
|
||||
import _do from './do.svg';
|
||||
import dz from './dz.svg';
|
||||
import ec from './ec.svg';
|
||||
import ee from './ee.svg';
|
||||
import eg from './eg.svg';
|
||||
import eh from './eh.svg';
|
||||
import er from './er.svg';
|
||||
import es from './es.svg';
|
||||
import et from './et.svg';
|
||||
import eu from './eu.svg';
|
||||
import fi from './fi.svg';
|
||||
import fj from './fj.svg';
|
||||
import fk from './fk.svg';
|
||||
import fm from './fm.svg';
|
||||
import fo from './fo.svg';
|
||||
import fr from './fr.svg';
|
||||
import ga from './ga.svg';
|
||||
import gb from './gb.svg';
|
||||
import gd from './gd.svg';
|
||||
import ge from './ge.svg';
|
||||
import gf from './gf.svg';
|
||||
import gg from './gg.svg';
|
||||
import gh from './gh.svg';
|
||||
import gi from './gi.svg';
|
||||
import gl from './gl.svg';
|
||||
import gm from './gm.svg';
|
||||
import gn from './gn.svg';
|
||||
import gp from './gp.svg';
|
||||
import gq from './gq.svg';
|
||||
import gr from './gr.svg';
|
||||
import gs from './gs.svg';
|
||||
import gt from './gt.svg';
|
||||
import gu from './gu.svg';
|
||||
import gw from './gw.svg';
|
||||
import gy from './gy.svg';
|
||||
import hk from './hk.svg';
|
||||
import hm from './hm.svg';
|
||||
import hn from './hn.svg';
|
||||
import hr from './hr.svg';
|
||||
import ht from './ht.svg';
|
||||
import hu from './hu.svg';
|
||||
import id from './id.svg';
|
||||
import ie from './ie.svg';
|
||||
import il from './il.svg';
|
||||
import im from './im.svg';
|
||||
import _in from './in.svg';
|
||||
import io from './io.svg';
|
||||
import iq from './iq.svg';
|
||||
import ir from './ir.svg';
|
||||
import is from './is.svg';
|
||||
import it from './it.svg';
|
||||
import je from './je.svg';
|
||||
import jm from './jm.svg';
|
||||
import jo from './jo.svg';
|
||||
import jp from './jp.svg';
|
||||
import ke from './ke.svg';
|
||||
import kg from './kg.svg';
|
||||
import kh from './kh.svg';
|
||||
import ki from './ki.svg';
|
||||
import km from './km.svg';
|
||||
import kn from './kn.svg';
|
||||
import kp from './kp.svg';
|
||||
import kr from './kr.svg';
|
||||
import kw from './kw.svg';
|
||||
import ky from './ky.svg';
|
||||
import kz from './kz.svg';
|
||||
import la from './la.svg';
|
||||
import lb from './lb.svg';
|
||||
import lc from './lc.svg';
|
||||
import li from './li.svg';
|
||||
import lk from './lk.svg';
|
||||
import lr from './lr.svg';
|
||||
import ls from './ls.svg';
|
||||
import lt from './lt.svg';
|
||||
import lu from './lu.svg';
|
||||
import lv from './lv.svg';
|
||||
import ly from './ly.svg';
|
||||
import ma from './ma.svg';
|
||||
import mc from './mc.svg';
|
||||
import md from './md.svg';
|
||||
import me from './me.svg';
|
||||
import mf from './mf.svg';
|
||||
import mg from './mg.svg';
|
||||
import mh from './mh.svg';
|
||||
import mk from './mk.svg';
|
||||
import ml from './ml.svg';
|
||||
import mm from './mm.svg';
|
||||
import mn from './mn.svg';
|
||||
import mo from './mo.svg';
|
||||
import mp from './mp.svg';
|
||||
import mq from './mq.svg';
|
||||
import mr from './mr.svg';
|
||||
import ms from './ms.svg';
|
||||
import mt from './mt.svg';
|
||||
import mu from './mu.svg';
|
||||
import mv from './mv.svg';
|
||||
import mw from './mw.svg';
|
||||
import mx from './mx.svg';
|
||||
import my from './my.svg';
|
||||
import mz from './mz.svg';
|
||||
import na from './na.svg';
|
||||
import nc from './nc.svg';
|
||||
import ne from './ne.svg';
|
||||
import nf from './nf.svg';
|
||||
import ng from './ng.svg';
|
||||
import ni from './ni.svg';
|
||||
import nl from './nl.svg';
|
||||
import no from './no.svg';
|
||||
import np from './np.svg';
|
||||
import nr from './nr.svg';
|
||||
import nu from './nu.svg';
|
||||
import nz from './nz.svg';
|
||||
import om from './om.svg';
|
||||
import pa from './pa.svg';
|
||||
import pe from './pe.svg';
|
||||
import pf from './pf.svg';
|
||||
import pg from './pg.svg';
|
||||
import ph from './ph.svg';
|
||||
import pk from './pk.svg';
|
||||
import pl from './pl.svg';
|
||||
import pm from './pm.svg';
|
||||
import pn from './pn.svg';
|
||||
import pr from './pr.svg';
|
||||
import ps from './ps.svg';
|
||||
import pt from './pt.svg';
|
||||
import pw from './pw.svg';
|
||||
import py from './py.svg';
|
||||
import qa from './qa.svg';
|
||||
import re from './re.svg';
|
||||
import ro from './ro.svg';
|
||||
import rs from './rs.svg';
|
||||
import ru from './ru.svg';
|
||||
import rw from './rw.svg';
|
||||
import sa from './sa.svg';
|
||||
import sb from './sb.svg';
|
||||
import sc from './sc.svg';
|
||||
import sd from './sd.svg';
|
||||
import se from './se.svg';
|
||||
import sg from './sg.svg';
|
||||
import sh from './sh.svg';
|
||||
import si from './si.svg';
|
||||
import sj from './sj.svg';
|
||||
import sk from './sk.svg';
|
||||
import sl from './sl.svg';
|
||||
import sm from './sm.svg';
|
||||
import sn from './sn.svg';
|
||||
import so from './so.svg';
|
||||
import sr from './sr.svg';
|
||||
import ss from './ss.svg';
|
||||
import st from './st.svg';
|
||||
import sv from './sv.svg';
|
||||
import sx from './sx.svg';
|
||||
import sy from './sy.svg';
|
||||
import sz from './sz.svg';
|
||||
import tc from './tc.svg';
|
||||
import td from './td.svg';
|
||||
import tf from './tf.svg';
|
||||
import tg from './tg.svg';
|
||||
import th from './th.svg';
|
||||
import tj from './tj.svg';
|
||||
import tk from './tk.svg';
|
||||
import tl from './tl.svg';
|
||||
import tm from './tm.svg';
|
||||
import tn from './tn.svg';
|
||||
import to from './to.svg';
|
||||
import tr from './tr.svg';
|
||||
import tt from './tt.svg';
|
||||
import tv from './tv.svg';
|
||||
import tw from './tw.svg';
|
||||
import tz from './tz.svg';
|
||||
import ua from './ua.svg';
|
||||
import ug from './ug.svg';
|
||||
import um from './um.svg';
|
||||
import us from './us.svg';
|
||||
import uy from './uy.svg';
|
||||
import uz from './uz.svg';
|
||||
import va from './va.svg';
|
||||
import vc from './vc.svg';
|
||||
import ve from './ve.svg';
|
||||
import vg from './vg.svg';
|
||||
import vi from './vi.svg';
|
||||
import vn from './vn.svg';
|
||||
import vu from './vu.svg';
|
||||
import wf from './wf.svg';
|
||||
import ws from './ws.svg';
|
||||
import ye from './ye.svg';
|
||||
import yt from './yt.svg';
|
||||
import za from './za.svg';
|
||||
import zm from './zm.svg';
|
||||
import zw from './zw.svg';
|
||||
|
||||
export const Countries = {
|
||||
ad,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { ThemeProvider } from '@material-ui/styles';
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import "./index.css";
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
|
||||
import { materialTheme } from './material-theme';
|
||||
|
||||
import { AppShell } from "containers";
|
||||
import { AppShell } from 'containers';
|
||||
|
||||
const appWithMaterialTheme = () => (
|
||||
<ThemeProvider theme={materialTheme}>
|
||||
|
@ -13,4 +13,4 @@ const appWithMaterialTheme = () => (
|
|||
</ThemeProvider>
|
||||
);
|
||||
|
||||
ReactDOM.render(appWithMaterialTheme(), document.getElementById("root"));
|
||||
ReactDOM.render(appWithMaterialTheme(), document.getElementById('root'));
|
||||
|
|
|
@ -91,10 +91,7 @@ export const materialTheme = createMuiTheme({
|
|||
fontWeight: 'bold',
|
||||
},
|
||||
|
||||
[
|
||||
'& .MuiButtonBase-root:hover,' +
|
||||
'& .MuiButtonBase-root.Mui-selected:hover'
|
||||
]: {
|
||||
['& .MuiButtonBase-root:hover, & .MuiButtonBase-root.Mui-selected:hover']: {
|
||||
background: palette.primary.light
|
||||
},
|
||||
},
|
||||
|
|
|
@ -18,7 +18,7 @@ class CardImporterService {
|
|||
.map(key => json.data[key])
|
||||
.sort((a, b) => new Date(a.releaseDate).getTime() - new Date(b.releaseDate).getTime());
|
||||
|
||||
const sets = sortedSets.map(({ cards, tokens, ...set}) => ({
|
||||
const sets = sortedSets.map(({ cards, tokens, ...set }) => ({
|
||||
...set,
|
||||
cards: cards.map(({ name }) => name),
|
||||
tokens: tokens.map(({ name }) => name),
|
||||
|
@ -54,7 +54,7 @@ class CardImporterService {
|
|||
.then((xmlString) => {
|
||||
try {
|
||||
const parser = new DOMParser();
|
||||
const dom = parser.parseFromString(xmlString, "application/xml");
|
||||
const dom = parser.parseFromString(xmlString, 'application/xml');
|
||||
|
||||
const tokens = Array.from(dom.querySelectorAll('card')).map(
|
||||
(tokenElement) => this.parseXmlAttributes(tokenElement)
|
||||
|
@ -90,7 +90,7 @@ class CardImporterService {
|
|||
if (Array.isArray(attributes[child.tagName])) {
|
||||
attributes[child.tagName].push(parsedAttributes)
|
||||
} else {
|
||||
attributes[child.tagName] = [ parsedAttributes ];
|
||||
attributes[child.tagName] = [parsedAttributes];
|
||||
}
|
||||
} else {
|
||||
attributes[child.tagName] = parsedAttributes;
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export * from "./CardImporterService";
|
||||
export * from './CardImporterService';
|
||||
export * from './DexieDTOs';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import protobuf from "protobufjs";
|
||||
import protobuf from 'protobufjs';
|
||||
|
||||
class MockProtobufRoot {
|
||||
load() {}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import { SortBy, SortDirection, User } from "types";
|
||||
import { SortBy, SortDirection, User } from 'types';
|
||||
|
||||
export default class SortUtil {
|
||||
static sortByField(arr: any[], sortBy: SortBy): void {
|
||||
static sortByField(arr: any[], sortBy: SortBy): void {
|
||||
if (arr.length) {
|
||||
const field = SortUtil.resolveFieldChain(arr[0], sortBy.field);
|
||||
const fieldType = typeof field;
|
||||
|
||||
if (fieldType === "string") {
|
||||
if (fieldType === 'string') {
|
||||
SortUtil.sortByString(arr, sortBy);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fieldType === "number") {
|
||||
if (fieldType === 'number') {
|
||||
SortUtil.sortByNumber(arr, sortBy);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error("SortField must resolve to either a string or number");
|
||||
throw new Error('SortField must resolve to either a string or number');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,10 @@ export default class SortUtil {
|
|||
for (let i = 0; i < sorts.length; i++) {
|
||||
const sortBy = sorts[i];
|
||||
const field = SortUtil.resolveFieldChain(arr[0], sortBy.field);
|
||||
|
||||
|
||||
const fieldType = typeof field;
|
||||
|
||||
if (fieldType === "string") {
|
||||
if (fieldType === 'string') {
|
||||
const result = SortUtil.stringComparator(a, b, sortBy);
|
||||
|
||||
if (result) {
|
||||
|
@ -37,7 +37,7 @@ export default class SortUtil {
|
|||
}
|
||||
}
|
||||
|
||||
if (fieldType === "number") {
|
||||
if (fieldType === 'number') {
|
||||
const result = SortUtil.numberComparator(a, b, sortBy);
|
||||
|
||||
if (result) {
|
||||
|
@ -45,7 +45,7 @@ export default class SortUtil {
|
|||
}
|
||||
}
|
||||
|
||||
throw new Error("SortField must resolve to either a string or number");
|
||||
throw new Error('SortField must resolve to either a string or number');
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -80,7 +80,7 @@ export default class SortUtil {
|
|||
private static userComparator(a, b, sortBy, sortByUserLevel = true) {
|
||||
if (sortByUserLevel) {
|
||||
const adminSortBy = {
|
||||
field: "userLevel",
|
||||
field: 'userLevel',
|
||||
order: SortDirection.DESC
|
||||
};
|
||||
|
||||
|
@ -116,9 +116,15 @@ export default class SortUtil {
|
|||
const bResolved = SortUtil.resolveFieldChain(b, field);
|
||||
|
||||
// Force empty strings to sort to bottom
|
||||
if (!aResolved && !bResolved) { return 0; }
|
||||
if (!aResolved) { return 1; }
|
||||
if (!bResolved) { return -1; }
|
||||
if (!aResolved && !bResolved) {
|
||||
return 0;
|
||||
}
|
||||
if (!aResolved) {
|
||||
return 1;
|
||||
}
|
||||
if (!bResolved) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (order === SortDirection.ASC) {
|
||||
return aResolved.localeCompare(bResolved);
|
||||
|
@ -128,13 +134,13 @@ export default class SortUtil {
|
|||
}
|
||||
|
||||
private static resolveFieldChain(obj: object, field: string) {
|
||||
const links = field.split(".");
|
||||
const links = field.split('.');
|
||||
|
||||
if (links.length > 1) {
|
||||
return links.reduce((obj, link) => {
|
||||
const parsed = parseInt(link, 10);
|
||||
|
||||
if (parsed.toLocaleString() === "NaN") {
|
||||
if (parsed.toLocaleString() === 'NaN') {
|
||||
return obj[link];
|
||||
} else {
|
||||
return obj[parsed];
|
||||
|
|
|
@ -1 +1 @@
|
|||
export { default as SortUtil} from "./SortUtil";
|
||||
export { default as SortUtil } from './SortUtil';
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
export { store } from "./store";
|
||||
export { store } from './store';
|
||||
|
||||
// Common
|
||||
export { SortUtil } from "./common";
|
||||
export { SortUtil } from './common';
|
||||
|
||||
// Server
|
||||
// Server
|
||||
|
||||
export {
|
||||
Selectors as ServerSelectors,
|
||||
Dispatch as ServerDispatch} from './server';
|
||||
export {
|
||||
Selectors as ServerSelectors,
|
||||
Dispatch as ServerDispatch } from './server';
|
||||
|
||||
export * from "store/server/server.interfaces";
|
||||
export * from 'store/server/server.interfaces';
|
||||
|
||||
export {
|
||||
Selectors as RoomsSelectors,
|
||||
Dispatch as RoomsDispatch } from 'store/rooms';
|
||||
export {
|
||||
Selectors as RoomsSelectors,
|
||||
Dispatch as RoomsDispatch } from 'store/rooms';
|
||||
|
||||
export * from "store/rooms/rooms.interfaces";
|
||||
export * from 'store/rooms/rooms.interfaces';
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export * from "./rooms.actions";
|
||||
export * from "./rooms.dispatch";
|
||||
export * from "./rooms.reducer";
|
||||
export * from "./rooms.selectors";
|
||||
export * from "./rooms.types";
|
||||
export * from './rooms.actions';
|
||||
export * from './rooms.dispatch';
|
||||
export * from './rooms.reducer';
|
||||
export * from './rooms.selectors';
|
||||
export * from './rooms.types';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Types } from "./rooms.types";
|
||||
import { Types } from './rooms.types';
|
||||
|
||||
export const Actions = {
|
||||
clearStore: () => ({
|
||||
type: Types.CLEAR_STORE
|
||||
}),
|
||||
|
||||
|
||||
updateRooms: rooms => ({
|
||||
type: Types.UPDATE_ROOMS,
|
||||
rooms
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { reset } from 'redux-form';
|
||||
import { Actions } from "./rooms.actions";
|
||||
import { store } from "store";
|
||||
import { Actions } from './rooms.actions';
|
||||
import { store } from 'store';
|
||||
|
||||
// const history = useHistory();
|
||||
|
||||
|
@ -8,7 +8,7 @@ export const Dispatch = {
|
|||
clearStore: () => {
|
||||
store.dispatch(Actions.clearStore());
|
||||
},
|
||||
|
||||
|
||||
updateRooms: rooms => {
|
||||
store.dispatch(Actions.updateRooms(rooms));
|
||||
},
|
||||
|
@ -26,7 +26,7 @@ export const Dispatch = {
|
|||
if (message.name) {
|
||||
store.dispatch(reset('sayMessage'));
|
||||
}
|
||||
|
||||
|
||||
store.dispatch(Actions.addMessage(roomId, message));
|
||||
},
|
||||
|
||||
|
@ -45,4 +45,4 @@ export const Dispatch = {
|
|||
sortGames: (roomId, field, order) => {
|
||||
store.dispatch(Actions.sortGames(roomId, field, order));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { GameSortField, Room, SortBy, UserSortField } from "types";
|
||||
import { GameSortField, Room, SortBy, UserSortField } from 'types';
|
||||
|
||||
export interface RoomsState {
|
||||
rooms: RoomsStateRooms;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import * as _ from "lodash";
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { GameSortField, UserSortField, SortDirection } from "types";
|
||||
import { GameSortField, UserSortField, SortDirection } from 'types';
|
||||
|
||||
import { SortUtil } from "../common";
|
||||
import { SortUtil } from '../common';
|
||||
|
||||
import { RoomsState } from "./rooms.interfaces"
|
||||
import { MAX_ROOM_MESSAGES, Types } from "./rooms.types";
|
||||
import { RoomsState } from './rooms.interfaces'
|
||||
import { MAX_ROOM_MESSAGES, Types } from './rooms.types';
|
||||
|
||||
const initialState: RoomsState = {
|
||||
rooms: {},
|
||||
|
@ -22,7 +22,7 @@ const initialState: RoomsState = {
|
|||
};
|
||||
|
||||
export const roomsReducer = (state = initialState, action: any) => {
|
||||
switch(action.type) {
|
||||
switch (action.type) {
|
||||
case Types.CLEAR_STORE: {
|
||||
return {
|
||||
...initialState
|
||||
|
@ -37,7 +37,7 @@ export const roomsReducer = (state = initialState, action: any) => {
|
|||
_.each(action.rooms, (room, order) => {
|
||||
const { roomId } = room;
|
||||
const existing = rooms[roomId] || {};
|
||||
|
||||
|
||||
const update = { ...room };
|
||||
delete update.gameList;
|
||||
delete update.gametypeList;
|
||||
|
@ -113,7 +113,7 @@ export const roomsReducer = (state = initialState, action: any) => {
|
|||
const { roomId, message } = action;
|
||||
const { messages } = state;
|
||||
|
||||
let roomMessages = [ ...(messages[roomId] || []) ];
|
||||
let roomMessages = [...(messages[roomId] || [])];
|
||||
|
||||
if (roomMessages.length === MAX_ROOM_MESSAGES) {
|
||||
roomMessages.shift();
|
||||
|
@ -150,7 +150,7 @@ export const roomsReducer = (state = initialState, action: any) => {
|
|||
}, {});
|
||||
|
||||
const gameUpdates = room.gameList
|
||||
// filter out closed games and remove from update map
|
||||
// filter out closed games and remove from update map
|
||||
.filter(game => {
|
||||
const gameUpdate = toUpdate[game.gameId];
|
||||
const closedGame = gameUpdate && gameUpdate.closed;
|
||||
|
@ -181,7 +181,7 @@ export const roomsReducer = (state = initialState, action: any) => {
|
|||
_.each(toUpdate, game => gameUpdates.push(game));
|
||||
}
|
||||
|
||||
const gameList = [ ...gameUpdates ];
|
||||
const gameList = [...gameUpdates];
|
||||
|
||||
SortUtil.sortByField(gameList, sortGamesBy);
|
||||
|
||||
|
@ -216,7 +216,7 @@ export const roomsReducer = (state = initialState, action: any) => {
|
|||
[roomId]: {
|
||||
...room,
|
||||
userList
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ export const roomsReducer = (state = initialState, action: any) => {
|
|||
const { rooms } = state;
|
||||
|
||||
const room = { ...rooms[roomId] };
|
||||
const userList = room.userList.filter(user => user.name !== name);
|
||||
const userList = room.userList.filter(user => user.name !== name);
|
||||
|
||||
return {
|
||||
...state,
|
||||
|
@ -234,7 +234,7 @@ export const roomsReducer = (state = initialState, action: any) => {
|
|||
[roomId]: {
|
||||
...room,
|
||||
userList
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ export const roomsReducer = (state = initialState, action: any) => {
|
|||
const { field, order, roomId } = action;
|
||||
const { rooms } = state;
|
||||
|
||||
const gameList = [ ...rooms[roomId].gameList ];
|
||||
const gameList = [...rooms[roomId].gameList];
|
||||
|
||||
const sortGamesBy = {
|
||||
field, order
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as _ from "lodash";
|
||||
import { RoomsState } from "./rooms.interfaces";
|
||||
import * as _ from 'lodash';
|
||||
import { RoomsState } from './rooms.interfaces';
|
||||
|
||||
interface State {
|
||||
rooms: RoomsState
|
||||
|
@ -8,7 +8,7 @@ interface State {
|
|||
export const Selectors = {
|
||||
getRooms: ({ rooms }: State) => rooms.rooms,
|
||||
getRoom: ({ rooms }: State, id: number) =>
|
||||
_.find(rooms.rooms, ({roomId}) => roomId === id),
|
||||
_.find(rooms.rooms, ({ roomId }) => roomId === id),
|
||||
getJoined: ({ rooms }: State) => rooms.joined,
|
||||
getMessages: ({ rooms }: State) => rooms.messages,
|
||||
getSortGamesBy: ({ rooms: { sortGamesBy } }: State) => sortGamesBy,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
export const Types = {
|
||||
CLEAR_STORE: "[Rooms] Clear Store",
|
||||
UPDATE_ROOMS: "[Rooms] Update Rooms",
|
||||
JOIN_ROOM: "[Rooms] Join Room",
|
||||
LEAVE_ROOM: "[Rooms] Leave Room",
|
||||
ADD_MESSAGE: "[Rooms] Add Message",
|
||||
UPDATE_GAMES: "[Rooms] Update Games",
|
||||
USER_JOINED: "[Rooms] User Joined",
|
||||
USER_LEFT: "[Rooms] User Left",
|
||||
SORT_GAMES: "[Rooms] Sort Games"
|
||||
CLEAR_STORE: '[Rooms] Clear Store',
|
||||
UPDATE_ROOMS: '[Rooms] Update Rooms',
|
||||
JOIN_ROOM: '[Rooms] Join Room',
|
||||
LEAVE_ROOM: '[Rooms] Leave Room',
|
||||
ADD_MESSAGE: '[Rooms] Add Message',
|
||||
UPDATE_GAMES: '[Rooms] Update Games',
|
||||
USER_JOINED: '[Rooms] User Joined',
|
||||
USER_LEFT: '[Rooms] User Left',
|
||||
SORT_GAMES: '[Rooms] Sort Games'
|
||||
};
|
||||
|
||||
export const MAX_ROOM_MESSAGES = 1000;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { combineReducers } from "redux";
|
||||
import { combineReducers } from 'redux';
|
||||
|
||||
import { roomsReducer } from "./rooms";
|
||||
import { serverReducer } from "./server";
|
||||
import { reducer as formReducer } from "redux-form"
|
||||
import { roomsReducer } from './rooms';
|
||||
import { serverReducer } from './server';
|
||||
import { reducer as formReducer } from 'redux-form'
|
||||
|
||||
export default combineReducers({
|
||||
rooms: roomsReducer,
|
||||
server: serverReducer,
|
||||
|
||||
|
||||
form: formReducer
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export { Actions } from "./server.actions";
|
||||
export { Dispatch } from "./server.dispatch";
|
||||
export * from "./server.reducer";
|
||||
export { Selectors } from "./server.selectors";
|
||||
export * from "./server.types";
|
||||
export { Actions } from './server.actions';
|
||||
export { Dispatch } from './server.dispatch';
|
||||
export * from './server.reducer';
|
||||
export { Selectors } from './server.selectors';
|
||||
export * from './server.types';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Types } from "./server.types";
|
||||
import { Types } from './server.types';
|
||||
|
||||
export const Actions = {
|
||||
clearStore: () => ({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { reset } from 'redux-form';
|
||||
import { Actions } from "./server.actions";
|
||||
import { store } from "store";
|
||||
import { Actions } from './server.actions';
|
||||
import { store } from 'store';
|
||||
|
||||
export const Dispatch = {
|
||||
clearStore: () => {
|
||||
|
@ -62,4 +62,4 @@ export const Dispatch = {
|
|||
serverMessage: message => {
|
||||
store.dispatch(Actions.serverMessage(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Log, SortBy, User, UserSortField } from "types";
|
||||
import { Log, SortBy, User, UserSortField } from 'types';
|
||||
|
||||
export interface ServerConnectParams {
|
||||
host: string;
|
||||
|
@ -71,4 +71,4 @@ export interface ServerStateSortUsersBy extends SortBy {
|
|||
|
||||
export interface RequestPasswordSaltParams {
|
||||
user: string;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { SortDirection, StatusEnum, UserSortField } from "types";
|
||||
import { SortDirection, StatusEnum, UserSortField } from 'types';
|
||||
|
||||
import { SortUtil } from "../common";
|
||||
import { SortUtil } from '../common';
|
||||
|
||||
import { ServerState } from "./server.interfaces"
|
||||
import { Types } from "./server.types";
|
||||
import { ServerState } from './server.interfaces'
|
||||
import { Types } from './server.types';
|
||||
|
||||
const initialState: ServerState = {
|
||||
buddyList: [],
|
||||
|
@ -32,7 +32,7 @@ const initialState: ServerState = {
|
|||
};
|
||||
|
||||
export const serverReducer = (state = initialState, action: any) => {
|
||||
switch(action.type) {
|
||||
switch (action.type) {
|
||||
case Types.CLEAR_STORE: {
|
||||
return {
|
||||
...initialState,
|
||||
|
@ -67,7 +67,7 @@ export const serverReducer = (state = initialState, action: any) => {
|
|||
const { user } = action;
|
||||
const { sortUsersBy } = state;
|
||||
|
||||
const buddyList = [ ...state.buddyList ];
|
||||
const buddyList = [...state.buddyList];
|
||||
|
||||
buddyList.push(user);
|
||||
SortUtil.sortUsersByField(buddyList, sortUsersBy);
|
||||
|
@ -103,7 +103,7 @@ export const serverReducer = (state = initialState, action: any) => {
|
|||
const { user } = action;
|
||||
const { sortUsersBy } = state;
|
||||
|
||||
const ignoreList = [ ...state.ignoreList ];
|
||||
const ignoreList = [...state.ignoreList];
|
||||
|
||||
ignoreList.push(user);
|
||||
SortUtil.sortUsersByField(ignoreList, sortUsersBy);
|
||||
|
@ -116,7 +116,7 @@ export const serverReducer = (state = initialState, action: any) => {
|
|||
case Types.REMOVE_FROM_IGNORE_LIST: {
|
||||
const { userName } = action;
|
||||
const ignoreList = state.ignoreList.filter(user => user.name !== userName);
|
||||
|
||||
|
||||
return {
|
||||
...state,
|
||||
ignoreList
|
||||
|
@ -125,7 +125,7 @@ export const serverReducer = (state = initialState, action: any) => {
|
|||
case Types.UPDATE_INFO: {
|
||||
const { name, version } = action.info;
|
||||
const { info } = state;
|
||||
|
||||
|
||||
return {
|
||||
...state,
|
||||
info: { ...info, name, version }
|
||||
|
@ -151,7 +151,7 @@ export const serverReducer = (state = initialState, action: any) => {
|
|||
}
|
||||
}
|
||||
case Types.UPDATE_USERS: {
|
||||
const users = [ ...action.users ];
|
||||
const users = [...action.users];
|
||||
const { sortUsersBy } = state;
|
||||
|
||||
|
||||
|
@ -174,7 +174,7 @@ export const serverReducer = (state = initialState, action: any) => {
|
|||
|
||||
return {
|
||||
...state,
|
||||
users
|
||||
users
|
||||
};
|
||||
}
|
||||
case Types.USER_LEFT: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ServerState } from "./server.interfaces";
|
||||
import { ServerState } from './server.interfaces';
|
||||
|
||||
interface State {
|
||||
server: ServerState
|
||||
|
@ -15,4 +15,4 @@ export const Selectors = {
|
|||
getLogs: ({ server }: State) => server.logs,
|
||||
getBuddyList: ({ server }: State) => server.buddyList,
|
||||
getIgnoreList: ({ server }: State) => server.ignoreList
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
export const Types = {
|
||||
CLEAR_STORE: "[Server] Clear Store",
|
||||
CONNECTION_CLOSED: "[Server] Connection Closed",
|
||||
SERVER_MESSAGE: "[Server] Server Message",
|
||||
UPDATE_BUDDY_LIST: "[Server] Update Buddy List",
|
||||
ADD_TO_BUDDY_LIST: "[Server] Add to Buddy List",
|
||||
REMOVE_FROM_BUDDY_LIST: "[Server] Remove from Buddy List",
|
||||
UPDATE_IGNORE_LIST: "[Server] Update Ignore List",
|
||||
ADD_TO_IGNORE_LIST: "[Server] Add to Ignore List",
|
||||
REMOVE_FROM_IGNORE_LIST: "[Server] Remove from Ignore List",
|
||||
UPDATE_INFO: "[Server] Update Info",
|
||||
UPDATE_STATUS: "[Server] Update Status",
|
||||
UPDATE_USER: "[Server] Update User",
|
||||
UPDATE_USERS: "[Server] Update Users",
|
||||
USER_JOINED: "[Server] User Joined",
|
||||
USER_LEFT: "[Server] User Left",
|
||||
VIEW_LOGS: "[Server] View Logs",
|
||||
CLEAR_LOGS: "[Server] Clear Logs"
|
||||
CLEAR_STORE: '[Server] Clear Store',
|
||||
CONNECTION_CLOSED: '[Server] Connection Closed',
|
||||
SERVER_MESSAGE: '[Server] Server Message',
|
||||
UPDATE_BUDDY_LIST: '[Server] Update Buddy List',
|
||||
ADD_TO_BUDDY_LIST: '[Server] Add to Buddy List',
|
||||
REMOVE_FROM_BUDDY_LIST: '[Server] Remove from Buddy List',
|
||||
UPDATE_IGNORE_LIST: '[Server] Update Ignore List',
|
||||
ADD_TO_IGNORE_LIST: '[Server] Add to Ignore List',
|
||||
REMOVE_FROM_IGNORE_LIST: '[Server] Remove from Ignore List',
|
||||
UPDATE_INFO: '[Server] Update Info',
|
||||
UPDATE_STATUS: '[Server] Update Status',
|
||||
UPDATE_USER: '[Server] Update User',
|
||||
UPDATE_USERS: '[Server] Update Users',
|
||||
USER_JOINED: '[Server] User Joined',
|
||||
USER_LEFT: '[Server] User Left',
|
||||
VIEW_LOGS: '[Server] View Logs',
|
||||
CLEAR_LOGS: '[Server] Clear Logs'
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { createStore, applyMiddleware } from "redux";
|
||||
import thunk from "redux-thunk";
|
||||
import rootReducer from "./rootReducer";
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
import thunk from 'redux-thunk';
|
||||
import rootReducer from './rootReducer';
|
||||
|
||||
const initialState = {};
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ export class Card {
|
|||
printings: string[];
|
||||
rarity: string;
|
||||
rulings: {
|
||||
date: string;
|
||||
text: string;
|
||||
date: string;
|
||||
text: string;
|
||||
}[];
|
||||
side: string;
|
||||
setCode: string;
|
||||
|
@ -82,8 +82,8 @@ export class Token {
|
|||
type: { value: string; };
|
||||
};
|
||||
};
|
||||
related: { value: string; }[];
|
||||
'reverse-related': { value: string; }[];
|
||||
related: { value: string; }[];
|
||||
'reverse-related': { value: string; }[];
|
||||
set: {
|
||||
value: string;
|
||||
picURL: string;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
export enum FormKey {
|
||||
ADD_TO_BUDDIES = "ADD_TO_BUDDIES",
|
||||
ADD_TO_IGNORE = "ADD_TO_IGNORE",
|
||||
CARD_IMPORT = "CARD_IMPORT",
|
||||
CONNECT = "CONNECT",
|
||||
LOGIN = "LOGIN",
|
||||
REGISTER = "REGISTER",
|
||||
SEARCH_LOGS = "SEARCH_LOGS",
|
||||
ADD_TO_BUDDIES = 'ADD_TO_BUDDIES',
|
||||
ADD_TO_IGNORE = 'ADD_TO_IGNORE',
|
||||
CARD_IMPORT = 'CARD_IMPORT',
|
||||
CONNECT = 'CONNECT',
|
||||
LOGIN = 'LOGIN',
|
||||
REGISTER = 'REGISTER',
|
||||
SEARCH_LOGS = 'SEARCH_LOGS',
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ export interface Game {
|
|||
}
|
||||
|
||||
export enum GameSortField {
|
||||
START_TIME = "startTime"
|
||||
START_TIME = 'startTime'
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
export * from "./cards";
|
||||
export * from "./constants";
|
||||
export * from "./game";
|
||||
export * from "./room";
|
||||
export * from "./server";
|
||||
export * from "./sort";
|
||||
export * from "./user";
|
||||
export * from "./routes";
|
||||
export * from "./sort";
|
||||
export * from "./forms";
|
||||
export * from "./message";
|
||||
export * from './cards';
|
||||
export * from './constants';
|
||||
export * from './game';
|
||||
export * from './room';
|
||||
export * from './server';
|
||||
export * from './sort';
|
||||
export * from './user';
|
||||
export * from './routes';
|
||||
export * from './sort';
|
||||
export * from './forms';
|
||||
export * from './message';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { User } from "./user";
|
||||
import { User } from './user';
|
||||
|
||||
export interface Room {
|
||||
autoJoin: boolean
|
||||
|
@ -19,5 +19,5 @@ export interface Room {
|
|||
export interface GametypeMap { [index: number]: string }
|
||||
|
||||
export enum RoomAccessLevel {
|
||||
"none"
|
||||
'none'
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ export enum StatusEnum {
|
|||
CONNECTED,
|
||||
LOGGING_IN,
|
||||
LOGGED_IN,
|
||||
DISCONNECTING = 99
|
||||
DISCONNECTING = 99
|
||||
}
|
||||
|
||||
export class Host {
|
||||
|
@ -68,7 +68,7 @@ export enum KnownHost {
|
|||
|
||||
export const KnownHosts = {
|
||||
[KnownHost.ROOSTER]: { port: 4748, host: 'server.cockatrice.us', },
|
||||
[KnownHost.TETRARCH]: { port: 443, host: 'mtg.tetrarch.co/servatrice'},
|
||||
[KnownHost.TETRARCH]: { port: 443, host: 'mtg.tetrarch.co/servatrice' },
|
||||
}
|
||||
|
||||
export interface Log {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export enum SortDirection {
|
||||
ASC = "ASC",
|
||||
DESC = "DESC"
|
||||
ASC = 'ASC',
|
||||
DESC = 'DESC'
|
||||
}
|
||||
|
||||
export interface SortBy {
|
||||
|
|
|
@ -10,16 +10,16 @@ export interface User {
|
|||
}
|
||||
|
||||
export enum UserAccessLevel {
|
||||
"NONE"
|
||||
'NONE'
|
||||
}
|
||||
|
||||
export enum UserPrivLevel {
|
||||
"unknown 1",
|
||||
"unknown 2",
|
||||
"unknown 3",
|
||||
"unknown 4"
|
||||
'unknown 1',
|
||||
'unknown 2',
|
||||
'unknown 3',
|
||||
'unknown 4'
|
||||
}
|
||||
|
||||
export enum UserSortField {
|
||||
NAME = "name"
|
||||
NAME = 'name'
|
||||
}
|
||||
|
|
|
@ -1,156 +1,156 @@
|
|||
const ProtoFiles = [
|
||||
"admin_commands.proto",
|
||||
"card_attributes.proto",
|
||||
"color.proto",
|
||||
"command_attach_card.proto",
|
||||
"command_change_zone_properties.proto",
|
||||
"command_concede.proto",
|
||||
"command_create_arrow.proto",
|
||||
"command_create_counter.proto",
|
||||
"command_create_token.proto",
|
||||
"command_deck_del.proto",
|
||||
"command_deck_del_dir.proto",
|
||||
"command_deck_download.proto",
|
||||
"command_deck_list.proto",
|
||||
"command_deck_new_dir.proto",
|
||||
"command_deck_select.proto",
|
||||
"command_deck_upload.proto",
|
||||
"command_del_counter.proto",
|
||||
"command_delete_arrow.proto",
|
||||
"command_draw_cards.proto",
|
||||
"command_dump_zone.proto",
|
||||
"command_flip_card.proto",
|
||||
"command_game_say.proto",
|
||||
"command_inc_card_counter.proto",
|
||||
"command_inc_counter.proto",
|
||||
"command_kick_from_game.proto",
|
||||
"command_leave_game.proto",
|
||||
"command_move_card.proto",
|
||||
"command_mulligan.proto",
|
||||
"command_next_turn.proto",
|
||||
"command_ready_start.proto",
|
||||
"command_replay_delete_match.proto",
|
||||
"command_replay_download.proto",
|
||||
"command_replay_list.proto",
|
||||
"command_replay_modify_match.proto",
|
||||
"command_reveal_cards.proto",
|
||||
"command_roll_die.proto",
|
||||
"command_set_active_phase.proto",
|
||||
"command_set_card_attr.proto",
|
||||
"command_set_card_counter.proto",
|
||||
"command_set_counter.proto",
|
||||
"command_set_sideboard_lock.proto",
|
||||
"command_set_sideboard_plan.proto",
|
||||
"command_shuffle.proto",
|
||||
"command_undo_draw.proto",
|
||||
"commands.proto",
|
||||
"context_concede.proto",
|
||||
"context_connection_state_changed.proto",
|
||||
"context_deck_select.proto",
|
||||
"context_move_card.proto",
|
||||
"context_mulligan.proto",
|
||||
"context_ping_changed.proto",
|
||||
"context_ready_start.proto",
|
||||
"context_set_sideboard_lock.proto",
|
||||
"context_undo_draw.proto",
|
||||
"event_add_to_list.proto",
|
||||
"event_attach_card.proto",
|
||||
"event_change_zone_properties.proto",
|
||||
"event_connection_closed.proto",
|
||||
"event_create_arrow.proto",
|
||||
"event_create_counter.proto",
|
||||
"event_create_token.proto",
|
||||
"event_del_counter.proto",
|
||||
"event_delete_arrow.proto",
|
||||
"event_destroy_card.proto",
|
||||
"event_draw_cards.proto",
|
||||
"event_dump_zone.proto",
|
||||
"event_flip_card.proto",
|
||||
"event_game_closed.proto",
|
||||
"event_game_host_changed.proto",
|
||||
"event_game_joined.proto",
|
||||
"event_game_say.proto",
|
||||
"event_game_state_changed.proto",
|
||||
"event_join.proto",
|
||||
"event_join_room.proto",
|
||||
"event_kicked.proto",
|
||||
"event_leave.proto",
|
||||
"event_leave_room.proto",
|
||||
"event_list_games.proto",
|
||||
"event_list_rooms.proto",
|
||||
"event_move_card.proto",
|
||||
"event_notify_user.proto",
|
||||
"event_player_properties_changed.proto",
|
||||
"event_remove_from_list.proto",
|
||||
"event_replay_added.proto",
|
||||
"event_reveal_cards.proto",
|
||||
"event_roll_die.proto",
|
||||
"event_room_say.proto",
|
||||
"event_server_complete_list.proto",
|
||||
"event_server_identification.proto",
|
||||
"event_server_message.proto",
|
||||
"event_server_shutdown.proto",
|
||||
"event_set_active_phase.proto",
|
||||
"event_set_active_player.proto",
|
||||
"event_set_card_attr.proto",
|
||||
"event_set_card_counter.proto",
|
||||
"event_set_counter.proto",
|
||||
"event_shuffle.proto",
|
||||
"event_user_joined.proto",
|
||||
"event_user_left.proto",
|
||||
"event_user_message.proto",
|
||||
"game_commands.proto",
|
||||
"game_event.proto",
|
||||
"game_event_container.proto",
|
||||
"game_event_context.proto",
|
||||
"game_replay.proto",
|
||||
"isl_message.proto",
|
||||
"moderator_commands.proto",
|
||||
"move_card_to_zone.proto",
|
||||
"response.proto",
|
||||
"response_activate.proto",
|
||||
"response_adjust_mod.proto",
|
||||
"response_ban_history.proto",
|
||||
"response_deck_download.proto",
|
||||
"response_deck_list.proto",
|
||||
"response_deck_upload.proto",
|
||||
"response_dump_zone.proto",
|
||||
"response_forgotpasswordrequest.proto",
|
||||
"response_get_games_of_user.proto",
|
||||
"response_get_user_info.proto",
|
||||
"response_join_room.proto",
|
||||
"response_list_users.proto",
|
||||
"response_login.proto",
|
||||
"response_password_salt.proto",
|
||||
"response_register.proto",
|
||||
"response_replay_download.proto",
|
||||
"response_replay_list.proto",
|
||||
"response_viewlog_history.proto",
|
||||
"response_warn_history.proto",
|
||||
"response_warn_list.proto",
|
||||
"room_commands.proto",
|
||||
"room_event.proto",
|
||||
"server_message.proto",
|
||||
"serverinfo_arrow.proto",
|
||||
"serverinfo_ban.proto",
|
||||
"serverinfo_card.proto",
|
||||
"serverinfo_cardcounter.proto",
|
||||
"serverinfo_chat_message.proto",
|
||||
"serverinfo_counter.proto",
|
||||
"serverinfo_deckstorage.proto",
|
||||
"serverinfo_game.proto",
|
||||
"serverinfo_gametype.proto",
|
||||
"serverinfo_player.proto",
|
||||
"serverinfo_playerping.proto",
|
||||
"serverinfo_playerproperties.proto",
|
||||
"serverinfo_replay.proto",
|
||||
"serverinfo_replay_match.proto",
|
||||
"serverinfo_room.proto",
|
||||
"serverinfo_user.proto",
|
||||
"serverinfo_warning.proto",
|
||||
"serverinfo_zone.proto",
|
||||
"session_commands.proto",
|
||||
"session_event.proto",
|
||||
'admin_commands.proto',
|
||||
'card_attributes.proto',
|
||||
'color.proto',
|
||||
'command_attach_card.proto',
|
||||
'command_change_zone_properties.proto',
|
||||
'command_concede.proto',
|
||||
'command_create_arrow.proto',
|
||||
'command_create_counter.proto',
|
||||
'command_create_token.proto',
|
||||
'command_deck_del.proto',
|
||||
'command_deck_del_dir.proto',
|
||||
'command_deck_download.proto',
|
||||
'command_deck_list.proto',
|
||||
'command_deck_new_dir.proto',
|
||||
'command_deck_select.proto',
|
||||
'command_deck_upload.proto',
|
||||
'command_del_counter.proto',
|
||||
'command_delete_arrow.proto',
|
||||
'command_draw_cards.proto',
|
||||
'command_dump_zone.proto',
|
||||
'command_flip_card.proto',
|
||||
'command_game_say.proto',
|
||||
'command_inc_card_counter.proto',
|
||||
'command_inc_counter.proto',
|
||||
'command_kick_from_game.proto',
|
||||
'command_leave_game.proto',
|
||||
'command_move_card.proto',
|
||||
'command_mulligan.proto',
|
||||
'command_next_turn.proto',
|
||||
'command_ready_start.proto',
|
||||
'command_replay_delete_match.proto',
|
||||
'command_replay_download.proto',
|
||||
'command_replay_list.proto',
|
||||
'command_replay_modify_match.proto',
|
||||
'command_reveal_cards.proto',
|
||||
'command_roll_die.proto',
|
||||
'command_set_active_phase.proto',
|
||||
'command_set_card_attr.proto',
|
||||
'command_set_card_counter.proto',
|
||||
'command_set_counter.proto',
|
||||
'command_set_sideboard_lock.proto',
|
||||
'command_set_sideboard_plan.proto',
|
||||
'command_shuffle.proto',
|
||||
'command_undo_draw.proto',
|
||||
'commands.proto',
|
||||
'context_concede.proto',
|
||||
'context_connection_state_changed.proto',
|
||||
'context_deck_select.proto',
|
||||
'context_move_card.proto',
|
||||
'context_mulligan.proto',
|
||||
'context_ping_changed.proto',
|
||||
'context_ready_start.proto',
|
||||
'context_set_sideboard_lock.proto',
|
||||
'context_undo_draw.proto',
|
||||
'event_add_to_list.proto',
|
||||
'event_attach_card.proto',
|
||||
'event_change_zone_properties.proto',
|
||||
'event_connection_closed.proto',
|
||||
'event_create_arrow.proto',
|
||||
'event_create_counter.proto',
|
||||
'event_create_token.proto',
|
||||
'event_del_counter.proto',
|
||||
'event_delete_arrow.proto',
|
||||
'event_destroy_card.proto',
|
||||
'event_draw_cards.proto',
|
||||
'event_dump_zone.proto',
|
||||
'event_flip_card.proto',
|
||||
'event_game_closed.proto',
|
||||
'event_game_host_changed.proto',
|
||||
'event_game_joined.proto',
|
||||
'event_game_say.proto',
|
||||
'event_game_state_changed.proto',
|
||||
'event_join.proto',
|
||||
'event_join_room.proto',
|
||||
'event_kicked.proto',
|
||||
'event_leave.proto',
|
||||
'event_leave_room.proto',
|
||||
'event_list_games.proto',
|
||||
'event_list_rooms.proto',
|
||||
'event_move_card.proto',
|
||||
'event_notify_user.proto',
|
||||
'event_player_properties_changed.proto',
|
||||
'event_remove_from_list.proto',
|
||||
'event_replay_added.proto',
|
||||
'event_reveal_cards.proto',
|
||||
'event_roll_die.proto',
|
||||
'event_room_say.proto',
|
||||
'event_server_complete_list.proto',
|
||||
'event_server_identification.proto',
|
||||
'event_server_message.proto',
|
||||
'event_server_shutdown.proto',
|
||||
'event_set_active_phase.proto',
|
||||
'event_set_active_player.proto',
|
||||
'event_set_card_attr.proto',
|
||||
'event_set_card_counter.proto',
|
||||
'event_set_counter.proto',
|
||||
'event_shuffle.proto',
|
||||
'event_user_joined.proto',
|
||||
'event_user_left.proto',
|
||||
'event_user_message.proto',
|
||||
'game_commands.proto',
|
||||
'game_event.proto',
|
||||
'game_event_container.proto',
|
||||
'game_event_context.proto',
|
||||
'game_replay.proto',
|
||||
'isl_message.proto',
|
||||
'moderator_commands.proto',
|
||||
'move_card_to_zone.proto',
|
||||
'response.proto',
|
||||
'response_activate.proto',
|
||||
'response_adjust_mod.proto',
|
||||
'response_ban_history.proto',
|
||||
'response_deck_download.proto',
|
||||
'response_deck_list.proto',
|
||||
'response_deck_upload.proto',
|
||||
'response_dump_zone.proto',
|
||||
'response_forgotpasswordrequest.proto',
|
||||
'response_get_games_of_user.proto',
|
||||
'response_get_user_info.proto',
|
||||
'response_join_room.proto',
|
||||
'response_list_users.proto',
|
||||
'response_login.proto',
|
||||
'response_password_salt.proto',
|
||||
'response_register.proto',
|
||||
'response_replay_download.proto',
|
||||
'response_replay_list.proto',
|
||||
'response_viewlog_history.proto',
|
||||
'response_warn_history.proto',
|
||||
'response_warn_list.proto',
|
||||
'room_commands.proto',
|
||||
'room_event.proto',
|
||||
'server_message.proto',
|
||||
'serverinfo_arrow.proto',
|
||||
'serverinfo_ban.proto',
|
||||
'serverinfo_card.proto',
|
||||
'serverinfo_cardcounter.proto',
|
||||
'serverinfo_chat_message.proto',
|
||||
'serverinfo_counter.proto',
|
||||
'serverinfo_deckstorage.proto',
|
||||
'serverinfo_game.proto',
|
||||
'serverinfo_gametype.proto',
|
||||
'serverinfo_player.proto',
|
||||
'serverinfo_playerping.proto',
|
||||
'serverinfo_playerproperties.proto',
|
||||
'serverinfo_replay.proto',
|
||||
'serverinfo_replay_match.proto',
|
||||
'serverinfo_room.proto',
|
||||
'serverinfo_user.proto',
|
||||
'serverinfo_warning.proto',
|
||||
'serverinfo_zone.proto',
|
||||
'session_commands.proto',
|
||||
'session_event.proto',
|
||||
];
|
||||
|
||||
export default ProtoFiles;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {ServerStatus, StatusEnum} from "types";
|
||||
import { ServerStatus, StatusEnum } from 'types';
|
||||
|
||||
import {ProtobufService} from './services/ProtobufService';
|
||||
import {WebSocketOptions, WebSocketService} from "./services/WebSocketService";
|
||||
import { ProtobufService } from './services/ProtobufService';
|
||||
import { WebSocketOptions, WebSocketService } from './services/WebSocketService';
|
||||
|
||||
import {RoomPersistence, SessionPersistence} from './persistence';
|
||||
import { RoomPersistence, SessionPersistence } from './persistence';
|
||||
|
||||
export class WebClient {
|
||||
public socket = new WebSocketService(this);
|
||||
|
@ -11,30 +11,30 @@ export class WebClient {
|
|||
|
||||
public protocolVersion = 14;
|
||||
public clientConfig = {
|
||||
"clientver" : "webclient-1.0 (2019-10-31)",
|
||||
"clientfeatures" : [
|
||||
"client_id",
|
||||
"client_ver",
|
||||
"feature_set",
|
||||
"room_chat_history",
|
||||
"client_warnings",
|
||||
'clientver': 'webclient-1.0 (2019-10-31)',
|
||||
'clientfeatures': [
|
||||
'client_id',
|
||||
'client_ver',
|
||||
'feature_set',
|
||||
'room_chat_history',
|
||||
'client_warnings',
|
||||
/* unimplemented features */
|
||||
"forgot_password",
|
||||
"idle_client",
|
||||
"mod_log_lookup",
|
||||
"user_ban_history",
|
||||
'forgot_password',
|
||||
'idle_client',
|
||||
'mod_log_lookup',
|
||||
'user_ban_history',
|
||||
// satisfy server reqs for POC
|
||||
"websocket",
|
||||
"2.7.0_min_version",
|
||||
"2.8.0_min_version"
|
||||
'websocket',
|
||||
'2.7.0_min_version',
|
||||
'2.8.0_min_version'
|
||||
]
|
||||
};
|
||||
|
||||
public options: WebSocketOptions = {
|
||||
host: "",
|
||||
port: "",
|
||||
user: "",
|
||||
pass: "",
|
||||
host: '',
|
||||
port: '',
|
||||
user: '',
|
||||
pass: '',
|
||||
clientid: null,
|
||||
reason: null,
|
||||
autojoinrooms: true,
|
||||
|
@ -54,7 +54,7 @@ export class WebClient {
|
|||
}
|
||||
|
||||
public connect(options: WebSocketOptions) {
|
||||
this.options = {...this.options, ...options};
|
||||
this.options = { ...this.options, ...options };
|
||||
this.socket.connect(this.options);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,4 +68,4 @@ describe('RoomCommands', () => {
|
|||
expect(RoomPersistence.leaveRoom).toHaveBeenCalledWith(roomId);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,28 +1,30 @@
|
|||
import { RoomPersistence } from '../persistence';
|
||||
import webClient from "../WebClient";
|
||||
import webClient from '../WebClient';
|
||||
|
||||
export class RoomCommands {
|
||||
static roomSay(roomId: number, message: string): void {
|
||||
const trimmed = message.trim();
|
||||
|
||||
if (!trimmed) return;
|
||||
|
||||
var CmdRoomSay = webClient.protobuf.controller.Command_RoomSay.create({
|
||||
"message" : trimmed
|
||||
if (!trimmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
const CmdRoomSay = webClient.protobuf.controller.Command_RoomSay.create({
|
||||
'message': trimmed
|
||||
});
|
||||
|
||||
var rc = webClient.protobuf.controller.RoomCommand.create({
|
||||
".Command_RoomSay.ext" : CmdRoomSay
|
||||
const rc = webClient.protobuf.controller.RoomCommand.create({
|
||||
'.Command_RoomSay.ext': CmdRoomSay
|
||||
});
|
||||
|
||||
webClient.protobuf.sendRoomCommand(roomId, rc);
|
||||
}
|
||||
|
||||
static leaveRoom(roomId: number): void {
|
||||
var CmdLeaveRoom = webClient.protobuf.controller.Command_LeaveRoom.create();
|
||||
const CmdLeaveRoom = webClient.protobuf.controller.Command_LeaveRoom.create();
|
||||
|
||||
var rc = webClient.protobuf.controller.RoomCommand.create({
|
||||
".Command_LeaveRoom.ext" : CmdLeaveRoom
|
||||
const rc = webClient.protobuf.controller.RoomCommand.create({
|
||||
'.Command_LeaveRoom.ext': CmdLeaveRoom
|
||||
});
|
||||
|
||||
webClient.protobuf.sendRoomCommand(roomId, rc, (raw) => {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import {StatusEnum} from 'types';
|
||||
import { StatusEnum } from 'types';
|
||||
|
||||
import {SessionCommands} from './SessionCommands';
|
||||
import { SessionCommands } from './SessionCommands';
|
||||
|
||||
import {RoomPersistence, SessionPersistence} from '../persistence';
|
||||
import { RoomPersistence, SessionPersistence } from '../persistence';
|
||||
import webClient from '../WebClient';
|
||||
import {WebSocketConnectReason} from "../services/WebSocketService";
|
||||
import {AccountActivationParams, ServerRegisterParams} from "../../store";
|
||||
import { WebSocketConnectReason } from '../services/WebSocketService';
|
||||
import { AccountActivationParams, ServerRegisterParams } from '../../store';
|
||||
|
||||
describe('SessionCommands', () => {
|
||||
const roomId = 1;
|
||||
|
@ -42,7 +42,7 @@ describe('SessionCommands', () => {
|
|||
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalled();
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(StatusEnum.CONNECTING, expect.any(String));
|
||||
|
||||
|
||||
expect(webClient.connect).toHaveBeenCalled();
|
||||
expect(webClient.connect).toHaveBeenCalledWith({ ...options, reason: WebSocketConnectReason.LOGIN });
|
||||
});
|
||||
|
@ -75,7 +75,7 @@ describe('SessionCommands', () => {
|
|||
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalled();
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(StatusEnum.DISCONNECTING, 'Disconnecting...');
|
||||
|
||||
|
||||
expect(webClient.disconnect).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -226,7 +226,10 @@ describe('SessionCommands', () => {
|
|||
|
||||
SessionCommands.login();
|
||||
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(StatusEnum.DISCONNECTED, 'Login failed: account not activated');
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
|
||||
StatusEnum.DISCONNECTED,
|
||||
'Login failed: account not activated'
|
||||
);
|
||||
});
|
||||
|
||||
it('all other responseCodes should update status', () => {
|
||||
|
@ -236,7 +239,10 @@ describe('SessionCommands', () => {
|
|||
|
||||
SessionCommands.login();
|
||||
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(StatusEnum.DISCONNECTED, `Login failed: unknown error: ${response.responseCode}`);
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
|
||||
StatusEnum.DISCONNECTED,
|
||||
`Login failed: unknown error: ${response.responseCode}`
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -283,17 +289,17 @@ describe('SessionCommands', () => {
|
|||
response = {
|
||||
responseCode: RespRegistrationAccepted,
|
||||
[respKey]: {
|
||||
reasonStr: "",
|
||||
reasonStr: '',
|
||||
endTime: 10000000
|
||||
}
|
||||
};
|
||||
|
||||
webClient.protobuf.controller.Response = { ResponseCode: { RespRegistrationAccepted }};
|
||||
webClient.protobuf.controller.Response = { ResponseCode: { RespRegistrationAccepted } };
|
||||
|
||||
sendSessionCommandSpy.and.callFake((_, callback) => callback(response));
|
||||
})
|
||||
|
||||
it("should login user if registration accepted without email verification", () => {
|
||||
it('should login user if registration accepted without email verification', () => {
|
||||
spyOn(SessionCommands, 'login');
|
||||
spyOn(SessionPersistence, 'accountAwaitingActivation');
|
||||
|
||||
|
@ -303,10 +309,11 @@ describe('SessionCommands', () => {
|
|||
expect(SessionPersistence.accountAwaitingActivation).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should prompt user if registration accepted with email verification", () => {
|
||||
it('should prompt user if registration accepted with email verification', () => {
|
||||
const RespRegistrationAcceptedNeedsActivation = 'RespRegistrationAcceptedNeedsActivation';
|
||||
response.responseCode = RespRegistrationAcceptedNeedsActivation;
|
||||
webClient.protobuf.controller.Response.ResponseCode.RespRegistrationAcceptedNeedsActivation = RespRegistrationAcceptedNeedsActivation;
|
||||
webClient.protobuf.controller.Response.ResponseCode.RespRegistrationAcceptedNeedsActivation =
|
||||
RespRegistrationAcceptedNeedsActivation;
|
||||
|
||||
spyOn(SessionCommands, 'login');
|
||||
spyOn(SessionPersistence, 'accountAwaitingActivation');
|
||||
|
@ -317,7 +324,7 @@ describe('SessionCommands', () => {
|
|||
expect(SessionPersistence.accountAwaitingActivation).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should disconnect user if registration fails due to registration being disabled", () => {
|
||||
it('should disconnect user if registration fails due to registration being disabled', () => {
|
||||
const RespRegistrationDisabled = 'RespRegistrationDisabled';
|
||||
response.responseCode = RespRegistrationDisabled;
|
||||
webClient.protobuf.controller.Response.ResponseCode.RespRegistrationDisabled = RespRegistrationDisabled;
|
||||
|
@ -368,7 +375,7 @@ describe('SessionCommands', () => {
|
|||
}
|
||||
};
|
||||
|
||||
webClient.protobuf.controller.Response = { ResponseCode: { RespActivationAccepted }};
|
||||
webClient.protobuf.controller.Response = { ResponseCode: { RespActivationAccepted } };
|
||||
|
||||
sendSessionCommandSpy.and.callFake((_, callback) => callback(response));
|
||||
spyOn(SessionCommands, 'login');
|
||||
|
@ -497,7 +504,10 @@ describe('SessionCommands', () => {
|
|||
|
||||
SessionCommands.joinRoom(roomId);
|
||||
|
||||
expect(console.error).toHaveBeenCalledWith(RespContextError, 'The server thinks you are in the room but Cockatrice is unable to display it. Try restarting Cockatrice.');
|
||||
expect(console.error).toHaveBeenCalledWith(
|
||||
RespContextError,
|
||||
'The server thinks you are in the room but Cockatrice is unable to display it. Try restarting Cockatrice.'
|
||||
);
|
||||
});
|
||||
|
||||
it('RespUserLevelTooLow should console error', () => {
|
||||
|
@ -572,7 +582,7 @@ describe('SessionCommands', () => {
|
|||
});
|
||||
|
||||
it('should call protobuf controller methods and sendCommand', () => {
|
||||
const addToList = { list: 'list', userName: 'userName'};
|
||||
const addToList = { list: 'list', userName: 'userName' };
|
||||
SessionCommands.addToList(addToList.list, addToList.userName);
|
||||
|
||||
expect(webClient.protobuf.sendSessionCommand).toHaveBeenCalled();
|
||||
|
@ -588,7 +598,7 @@ describe('SessionCommands', () => {
|
|||
});
|
||||
|
||||
it('should call protobuf controller methods and sendCommand', () => {
|
||||
const removeFromList = { list: 'list', userName: 'userName'};
|
||||
const removeFromList = { list: 'list', userName: 'userName' };
|
||||
SessionCommands.removeFromList(removeFromList.list, removeFromList.userName);
|
||||
|
||||
expect(webClient.protobuf.sendSessionCommand).toHaveBeenCalled();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {StatusEnum} from 'types';
|
||||
import { StatusEnum } from 'types';
|
||||
|
||||
import {RoomPersistence, SessionPersistence} from '../persistence';
|
||||
import { RoomPersistence, SessionPersistence } from '../persistence';
|
||||
import webClient from '../WebClient';
|
||||
import {guid, hashPassword} from '../utils';
|
||||
import {WebSocketConnectReason, WebSocketOptions} from "../services/WebSocketService";
|
||||
import { guid, hashPassword } from '../utils';
|
||||
import { WebSocketConnectReason, WebSocketOptions } from '../services/WebSocketService';
|
||||
import {
|
||||
AccountActivationParams,
|
||||
ForgotPasswordChallengeParams,
|
||||
|
@ -11,8 +11,8 @@ import {
|
|||
ForgotPasswordResetParams,
|
||||
RequestPasswordSaltParams,
|
||||
ServerRegisterParams
|
||||
} from "../../store";
|
||||
import NormalizeService from "../utils/NormalizeService";
|
||||
} from '../../store';
|
||||
import NormalizeService from '../utils/NormalizeService';
|
||||
|
||||
export class SessionCommands {
|
||||
static connect(options: WebSocketOptions, reason: WebSocketConnectReason): void {
|
||||
|
@ -53,7 +53,7 @@ export class SessionCommands {
|
|||
const CmdLogin = webClient.protobuf.controller.Command_Login.create(loginConfig);
|
||||
|
||||
const command = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_Login.ext' : CmdLogin
|
||||
'.Command_Login.ext': CmdLogin
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(command, raw => {
|
||||
|
@ -73,7 +73,7 @@ export class SessionCommands {
|
|||
return;
|
||||
}
|
||||
|
||||
switch(raw.responseCode) {
|
||||
switch (raw.responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespClientUpdateRequired:
|
||||
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, 'Login failed: missing features');
|
||||
break;
|
||||
|
@ -127,23 +127,23 @@ export class SessionCommands {
|
|||
const CmdRequestPasswordSalt = webClient.protobuf.controller.Command_RequestPasswordSalt.create(registerConfig);
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
".Command_RequestPasswordSalt.ext" : CmdRequestPasswordSalt
|
||||
'.Command_RequestPasswordSalt.ext': CmdRequestPasswordSalt
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
switch (raw.responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
const passwordSalt = raw[".Response_PasswordSalt.ext"].passwordSalt;
|
||||
const passwordSalt = raw['.Response_PasswordSalt.ext'].passwordSalt;
|
||||
SessionCommands.login(passwordSalt);
|
||||
break;
|
||||
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespRegistrationRequired:
|
||||
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, "Login failed: incorrect username or password");
|
||||
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, 'Login failed: incorrect username or password');
|
||||
SessionCommands.disconnect();
|
||||
break;
|
||||
|
||||
default:
|
||||
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, "Login failed: Unknown Reason");
|
||||
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, 'Login failed: Unknown Reason');
|
||||
SessionCommands.disconnect();
|
||||
break;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ export class SessionCommands {
|
|||
const CmdRegister = webClient.protobuf.controller.Command_Register.create(registerConfig);
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_Register.ext' : CmdRegister
|
||||
'.Command_Register.ext': CmdRegister
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
|
@ -203,12 +203,12 @@ export class SessionCommands {
|
|||
error = NormalizeService.normalizeBannedUserError(raw.reasonStr, raw.endTime);
|
||||
break;
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespUsernameInvalid:
|
||||
console.error("ResponseCode.RespUsernameInvalid", raw.reasonStr);
|
||||
console.error('ResponseCode.RespUsernameInvalid', raw.reasonStr);
|
||||
error = 'Invalid username';
|
||||
break;
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespRegistrationFailed:
|
||||
default:
|
||||
console.error("ResponseCode Type", raw.responseCode);
|
||||
console.error('ResponseCode Type', raw.responseCode);
|
||||
error = 'Registration failed due to a server issue';
|
||||
break;
|
||||
}
|
||||
|
@ -238,13 +238,13 @@ export class SessionCommands {
|
|||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
if (raw.responseCode === webClient.protobuf.controller.Response.ResponseCode.RespActivationAccepted) {
|
||||
SessionCommands.login();
|
||||
} else {
|
||||
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, 'Account Activation Failed');
|
||||
SessionCommands.disconnect();
|
||||
SessionPersistence.accountActivationFailed();
|
||||
}
|
||||
if (raw.responseCode === webClient.protobuf.controller.Response.ResponseCode.RespActivationAccepted) {
|
||||
SessionCommands.login();
|
||||
} else {
|
||||
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, 'Account Activation Failed');
|
||||
SessionCommands.disconnect();
|
||||
SessionPersistence.accountActivationFailed();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -260,12 +260,12 @@ export class SessionCommands {
|
|||
const CmdForgotPasswordRequest = webClient.protobuf.controller.Command_ForgotPasswordRequest.create(forgotPasswordConfig);
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_ForgotPasswordRequest.ext' : CmdForgotPasswordRequest
|
||||
'.Command_ForgotPasswordRequest.ext': CmdForgotPasswordRequest
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
if (raw.responseCode === webClient.protobuf.controller.Response.ResponseCode.RespOk) {
|
||||
const resp = raw[".Response_ForgotPasswordRequest.ext"];
|
||||
const resp = raw['.Response_ForgotPasswordRequest.ext'];
|
||||
|
||||
if (resp.challengeEmail) {
|
||||
SessionPersistence.resetPasswordChallenge();
|
||||
|
@ -293,7 +293,7 @@ export class SessionCommands {
|
|||
const CmdForgotPasswordChallenge = webClient.protobuf.controller.Command_ForgotPasswordChallenge.create(forgotPasswordChallengeConfig);
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_ForgotPasswordChallenge.ext' : CmdForgotPasswordChallenge
|
||||
'.Command_ForgotPasswordChallenge.ext': CmdForgotPasswordChallenge
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
|
@ -321,7 +321,7 @@ export class SessionCommands {
|
|||
const CmdForgotPasswordReset = webClient.protobuf.controller.Command_ForgotPasswordReset.create(forgotPasswordResetConfig);
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_ForgotPasswordReset.ext' : CmdForgotPasswordReset
|
||||
'.Command_ForgotPasswordReset.ext': CmdForgotPasswordReset
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
|
@ -339,7 +339,7 @@ export class SessionCommands {
|
|||
const CmdListUsers = webClient.protobuf.controller.Command_ListUsers.create();
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_ListUsers.ext' : CmdListUsers
|
||||
'.Command_ListUsers.ext': CmdListUsers
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
|
@ -363,7 +363,7 @@ export class SessionCommands {
|
|||
const CmdListRooms = webClient.protobuf.controller.Command_ListRooms.create();
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_ListRooms.ext' : CmdListRooms
|
||||
'.Command_ListRooms.ext': CmdListRooms
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc);
|
||||
|
@ -373,7 +373,7 @@ export class SessionCommands {
|
|||
const CmdJoinRoom = webClient.protobuf.controller.Command_JoinRoom.create({ roomId });
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_JoinRoom.ext' : CmdJoinRoom
|
||||
'.Command_JoinRoom.ext': CmdJoinRoom
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, (raw) => {
|
||||
|
@ -381,7 +381,7 @@ export class SessionCommands {
|
|||
|
||||
let error;
|
||||
|
||||
switch(responseCode) {
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
const { roomInfo } = raw['.Response_JoinRoom.ext'];
|
||||
|
||||
|
@ -400,7 +400,7 @@ export class SessionCommands {
|
|||
error = 'Failed to join the room due to an unknown error.';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (error) {
|
||||
console.error(responseCode, error);
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ export class SessionCommands {
|
|||
const CmdAddToList = webClient.protobuf.controller.Command_AddToList.create({ list, userName });
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_AddToList.ext' : CmdAddToList
|
||||
'.Command_AddToList.ext': CmdAddToList
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, ({ responseCode }) => {
|
||||
|
@ -439,7 +439,7 @@ export class SessionCommands {
|
|||
const CmdRemoveFromList = webClient.protobuf.controller.Command_RemoveFromList.create({ list, userName });
|
||||
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({
|
||||
'.Command_RemoveFromList.ext' : CmdRemoveFromList
|
||||
'.Command_RemoveFromList.ext': CmdRemoveFromList
|
||||
});
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, ({ responseCode }) => {
|
||||
|
@ -451,7 +451,7 @@ export class SessionCommands {
|
|||
const CmdViewLogHistory = webClient.protobuf.controller.Command_ViewLogHistory.create(filters);
|
||||
|
||||
const sc = webClient.protobuf.controller.ModeratorCommand.create({
|
||||
'.Command_ViewLogHistory.ext' : CmdViewLogHistory
|
||||
'.Command_ViewLogHistory.ext': CmdViewLogHistory
|
||||
});
|
||||
|
||||
webClient.protobuf.sendModeratorCommand(sc, (raw) => {
|
||||
|
@ -459,7 +459,7 @@ export class SessionCommands {
|
|||
|
||||
let error;
|
||||
|
||||
switch(responseCode) {
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
const { logMessage } = raw['.Response_ViewLogHistory.ext'];
|
||||
SessionPersistence.viewLogs(logMessage)
|
||||
|
@ -468,7 +468,7 @@ export class SessionCommands {
|
|||
error = 'Failed to retrieve log history.';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (error) {
|
||||
console.error(responseCode, error);
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export { RoomCommands } from "./RoomCommands";
|
||||
export { SessionCommands } from "./SessionCommands";
|
||||
export { RoomCommands } from './RoomCommands';
|
||||
export { SessionCommands } from './SessionCommands';
|
||||
|
|
|
@ -61,4 +61,4 @@ describe('RoomEvents', () => {
|
|||
data
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,10 +3,10 @@ import { RoomPersistence } from '../persistence/RoomPersistence';
|
|||
import { ProtobufEvents } from '../services/ProtobufService';
|
||||
|
||||
export const RoomEvents: ProtobufEvents = {
|
||||
".Event_JoinRoom.ext": joinRoom,
|
||||
".Event_LeaveRoom.ext": leaveRoom,
|
||||
".Event_ListGames.ext": listGames,
|
||||
".Event_RoomSay.ext": roomSay,
|
||||
'.Event_JoinRoom.ext': joinRoom,
|
||||
'.Event_LeaveRoom.ext': leaveRoom,
|
||||
'.Event_ListGames.ext': listGames,
|
||||
'.Event_RoomSay.ext': roomSay,
|
||||
};
|
||||
|
||||
function joinRoom({ userInfo }: JoinRoomData, { roomEvent }: RoomEvent) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {StatusEnum} from "types";
|
||||
import { StatusEnum } from 'types';
|
||||
|
||||
import {
|
||||
AddToListData,
|
||||
|
@ -12,10 +12,10 @@ import {
|
|||
UserLeftData,
|
||||
} from './SessionEvents';
|
||||
|
||||
import {SessionCommands} from "../commands";
|
||||
import {RoomPersistence, SessionPersistence} from '../persistence';
|
||||
import { SessionCommands } from '../commands';
|
||||
import { RoomPersistence, SessionPersistence } from '../persistence';
|
||||
import webClient from '../WebClient';
|
||||
import {WebSocketConnectReason} from "../services/WebSocketService";
|
||||
import { WebSocketConnectReason } from '../services/WebSocketService';
|
||||
|
||||
describe('SessionEvents', () => {
|
||||
const roomId = 1;
|
||||
|
@ -340,7 +340,10 @@ describe('SessionEvents', () => {
|
|||
event(data);
|
||||
|
||||
expect(SessionCommands.disconnect).toHaveBeenCalled();
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(StatusEnum.DISCONNECTED, `Protocol version mismatch: ${data.protocolVersion}`);
|
||||
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
|
||||
StatusEnum.DISCONNECTED,
|
||||
`Protocol version mismatch: ${data.protocolVersion}`
|
||||
);
|
||||
expect(SessionCommands.login).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@ -361,7 +364,7 @@ describe('SessionEvents', () => {
|
|||
describe('.Event_UserJoined.ext', () => {
|
||||
it('should call SessionPersistence.userJoined', () => {
|
||||
spyOn(SessionPersistence, 'userJoined');
|
||||
const data: UserJoinedData = { userInfo: {} as any };
|
||||
const data: UserJoinedData = { userInfo: {} as any };
|
||||
|
||||
SessionEvents['.Event_UserJoined.ext'](data);
|
||||
|
||||
|
@ -374,7 +377,7 @@ describe('SessionEvents', () => {
|
|||
describe('.Event_UserLeft.ext', () => {
|
||||
it('should call SessionPersistence.userLeft', () => {
|
||||
spyOn(SessionPersistence, 'userLeft');
|
||||
const data: UserLeftData = { name: '' };
|
||||
const data: UserLeftData = { name: '' };
|
||||
|
||||
SessionEvents['.Event_UserLeft.ext'](data);
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {Room, StatusEnum, User} from 'types';
|
||||
import { Room, StatusEnum, User } from 'types';
|
||||
|
||||
import {SessionCommands} from '../commands';
|
||||
import {RoomPersistence, SessionPersistence} from '../persistence';
|
||||
import {ProtobufEvents} from '../services/ProtobufService';
|
||||
import { SessionCommands } from '../commands';
|
||||
import { RoomPersistence, SessionPersistence } from '../persistence';
|
||||
import { ProtobufEvents } from '../services/ProtobufService';
|
||||
import webClient from '../WebClient';
|
||||
import {WebSocketConnectReason} from "../services/WebSocketService";
|
||||
import { WebSocketConnectReason } from '../services/WebSocketService';
|
||||
|
||||
export const SessionEvents: ProtobufEvents = {
|
||||
'.Event_AddToList.ext': addToList,
|
||||
|
@ -21,7 +21,7 @@ export const SessionEvents: ProtobufEvents = {
|
|||
'.Event_UserMessage.ext': userMessage,
|
||||
}
|
||||
|
||||
function addToList({ listName, userInfo}: AddToListData) {
|
||||
function addToList({ listName, userInfo }: AddToListData) {
|
||||
switch (listName) {
|
||||
case 'buddy': {
|
||||
SessionPersistence.addToBuddyList(userInfo);
|
||||
|
@ -44,7 +44,7 @@ function connectionClosed({ reason, reasonStr }: ConnectionClosedData) {
|
|||
if (reasonStr) {
|
||||
message = reasonStr;
|
||||
} else {
|
||||
switch(reason) {
|
||||
switch (reason) {
|
||||
case webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.USER_LIMIT_REACHED:
|
||||
message = 'The server has reached its maximum user capacity';
|
||||
break;
|
||||
|
@ -147,7 +147,7 @@ function serverIdentification(info: ServerIdentificationData) {
|
|||
SessionCommands.resetPassword();
|
||||
break;
|
||||
default:
|
||||
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, "Unknown Connection Reason: " + webClient.options.reason);
|
||||
SessionCommands.updateStatus(StatusEnum.DISCONNECTED, 'Unknown Connection Reason: ' + webClient.options.reason);
|
||||
SessionCommands.disconnect();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { store, RoomsDispatch, RoomsSelectors } from "store";
|
||||
import { store, RoomsDispatch, RoomsSelectors } from 'store';
|
||||
import { Game, Message, Room, User } from 'types';
|
||||
import NormalizeService from "../utils/NormalizeService";
|
||||
import NormalizeService from '../utils/NormalizeService';
|
||||
|
||||
export class RoomPersistence {
|
||||
static clearStore() {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ServerDispatch } from "store";
|
||||
import { Log, StatusEnum, User } from "types";
|
||||
import { ServerDispatch } from 'store';
|
||||
import { Log, StatusEnum, User } from 'types';
|
||||
|
||||
import { sanitizeHtml } from "websocket/utils";
|
||||
import NormalizeService from "../utils/NormalizeService";
|
||||
import { sanitizeHtml } from 'websocket/utils';
|
||||
import NormalizeService from '../utils/NormalizeService';
|
||||
|
||||
export class SessionPersistence {
|
||||
static clearStore() {
|
||||
|
@ -74,27 +74,27 @@ export class SessionPersistence {
|
|||
}
|
||||
|
||||
static accountAwaitingActivation() {
|
||||
console.log("Open Modal for Activation Code input");
|
||||
console.log('Open Modal for Activation Code input');
|
||||
}
|
||||
|
||||
static accountActivationFailed() {
|
||||
console.log("Account activation failed, show an action here");
|
||||
console.log('Account activation failed, show an action here');
|
||||
}
|
||||
|
||||
static resetPasswordChallenge() {
|
||||
console.log("Open Modal asking for Email address associated with account");
|
||||
console.log('Open Modal asking for Email address associated with account');
|
||||
}
|
||||
|
||||
static resetPassword() {
|
||||
console.log("Open Modal asking for reset token & new password");
|
||||
console.log('Open Modal asking for reset token & new password');
|
||||
|
||||
}
|
||||
|
||||
static resetPasswordSuccess() {
|
||||
console.log("User password successfully changed Alert!");
|
||||
console.log('User password successfully changed Alert!');
|
||||
}
|
||||
|
||||
static resetPasswordFailed() {
|
||||
console.log("Open Alert telling user their password request failed for some reason");
|
||||
console.log('Open Alert telling user their password request failed for some reason');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export { RoomPersistence } from "./RoomPersistence";
|
||||
export { SessionPersistence } from "./SessionPersistence";
|
||||
export { RoomPersistence } from './RoomPersistence';
|
||||
export { SessionPersistence } from './SessionPersistence';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { KeepAliveService } from './KeepAliveService';
|
||||
import { WebSocketService } from "./WebSocketService";
|
||||
import { WebSocketService } from './WebSocketService';
|
||||
|
||||
import webClient from '../WebClient';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Subject } from "rxjs";
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
import { WebSocketService } from "./WebSocketService";
|
||||
import { WebSocketService } from './WebSocketService';
|
||||
|
||||
export class KeepAliveService {
|
||||
private socket: WebSocketService;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import protobuf from "protobufjs";
|
||||
import protobuf from 'protobufjs';
|
||||
|
||||
import ProtoFiles from "../ProtoFiles";
|
||||
import { WebClient } from "../WebClient";
|
||||
import ProtoFiles from '../ProtoFiles';
|
||||
import { WebClient } from '../WebClient';
|
||||
|
||||
import { RoomEvents, SessionEvents } from '../events';
|
||||
|
||||
|
@ -31,8 +31,8 @@ export class ProtobufService {
|
|||
|
||||
public sendRoomCommand(roomId: number, roomCmd: number, callback?: Function) {
|
||||
const cmd = this.controller.CommandContainer.create({
|
||||
"roomId" : roomId,
|
||||
"roomCommand" : [ roomCmd ]
|
||||
'roomId': roomId,
|
||||
'roomCommand': [roomCmd]
|
||||
});
|
||||
|
||||
this.sendCommand(cmd, raw => callback && callback(raw));
|
||||
|
@ -40,7 +40,7 @@ export class ProtobufService {
|
|||
|
||||
public sendSessionCommand(sesCmd: number, callback?: Function) {
|
||||
const cmd = this.controller.CommandContainer.create({
|
||||
"sessionCommand" : [ sesCmd ]
|
||||
'sessionCommand': [sesCmd]
|
||||
});
|
||||
|
||||
this.sendCommand(cmd, (raw) => callback && callback(raw));
|
||||
|
@ -48,7 +48,7 @@ export class ProtobufService {
|
|||
|
||||
public sendModeratorCommand(modCmd: number, callback?: Function) {
|
||||
const cmd = this.controller.CommandContainer.create({
|
||||
"moderatorCommand" : [ modCmd ]
|
||||
'moderatorCommand': [modCmd]
|
||||
});
|
||||
|
||||
this.sendCommand(cmd, (raw) => callback && callback(raw));
|
||||
|
@ -57,7 +57,7 @@ export class ProtobufService {
|
|||
public sendCommand(cmd: number, callback: Function) {
|
||||
this.cmdId++;
|
||||
|
||||
cmd["cmdId"] = this.cmdId;
|
||||
cmd['cmdId'] = this.cmdId;
|
||||
this.pendingCommands[this.cmdId] = callback;
|
||||
|
||||
if (this.webClient.socket.checkReadyState(WebSocket.OPEN)) {
|
||||
|
@ -67,7 +67,7 @@ export class ProtobufService {
|
|||
|
||||
public sendKeepAliveCommand(pingReceived: Function) {
|
||||
const command = this.controller.SessionCommand.create({
|
||||
".Command_Ping.ext" : this.controller.Command_Ping.create()
|
||||
'.Command_Ping.ext': this.controller.Command_Ping.create()
|
||||
});
|
||||
|
||||
this.sendSessionCommand(command, pingReceived);
|
||||
|
@ -90,12 +90,12 @@ export class ProtobufService {
|
|||
this.processSessionEvent(msg.sessionEvent, msg);
|
||||
break;
|
||||
case this.controller.ServerMessage.MessageType.GAME_EVENT_CONTAINER:
|
||||
// @TODO
|
||||
// @TODO
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Processing failed:", err);
|
||||
console.error('Processing failed:', err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue