mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 01:24:46 -07:00
Cleanup and refactor (#4361)
* fix three panel layout height issue * rename websocket/services to websocket/persistence, implement LeaveRoom * cleanup * add new line eof * move route components from /components to /containers * remove duplicate style Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
This commit is contained in:
parent
294229622d
commit
8db9475804
47 changed files with 127 additions and 76 deletions
|
|
@ -1,50 +0,0 @@
|
|||
import { store, RoomsDispatch, RoomsSelectors } from "store";
|
||||
import { WebClient } from "../WebClient";
|
||||
|
||||
import { NormalizeService } from "websocket";
|
||||
|
||||
export default class RoomService {
|
||||
webClient: WebClient;
|
||||
|
||||
constructor(webClient) {
|
||||
this.webClient = webClient;
|
||||
}
|
||||
|
||||
clearStore() {
|
||||
RoomsDispatch.clearStore();
|
||||
}
|
||||
|
||||
joinRoom(roomInfo) {
|
||||
NormalizeService.normalizeRoomInfo(roomInfo);
|
||||
RoomsDispatch.joinRoom(roomInfo);
|
||||
}
|
||||
|
||||
updateRooms(rooms) {
|
||||
RoomsDispatch.updateRooms(rooms);
|
||||
}
|
||||
|
||||
updateGames(roomId, gameList) {
|
||||
const game = gameList[0];
|
||||
|
||||
if (!game.gameType) {
|
||||
const { gametypeMap } = RoomsSelectors.getRoom(store.getState(), roomId);
|
||||
NormalizeService.normalizeGameObject(game, gametypeMap);
|
||||
}
|
||||
|
||||
RoomsDispatch.updateGames(roomId, gameList);
|
||||
}
|
||||
|
||||
addMessage(roomId, message) {
|
||||
NormalizeService.normalizeUserMessage(message);
|
||||
|
||||
RoomsDispatch.addMessage(roomId, message);
|
||||
}
|
||||
|
||||
userJoined(roomId, user) {
|
||||
RoomsDispatch.userJoined(roomId, user);
|
||||
}
|
||||
|
||||
userLeft(roomId, name) {
|
||||
RoomsDispatch.userLeft(roomId, name);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue