34cd63b7c85416fcc4d9751a3c2cedba2976903c
[vchess.git] / client / src / views / Hall.vue
1 <template lang="pug">
2 main
3 input#modalInfo.modal(type="checkbox")
4 div#infoDiv(role="dialog" data-checkbox="modalInfo")
5 .card.text-center
6 label.modal-close(for="modalInfo")
7 p(v-html="infoMessage")
8 input#modalNewgame.modal(type="checkbox")
9 div#newgameDiv(role="dialog" data-checkbox="modalNewgame")
10 .card(@keyup.enter="newChallenge()")
11 label#closeNewgame.modal-close(for="modalNewgame")
12 fieldset
13 label(for="selectVariant") {{ st.tr["Variant"] }} *
14 select#selectVariant(v-model="newchallenge.vid")
15 option(v-for="v in st.variants" :value="v.id"
16 :selected="newchallenge.vid==v.id")
17 | {{ v.name }}
18 fieldset
19 label(for="cadence") {{ st.tr["Cadence"] }} *
20 div#predefinedCadences
21 button 3+2
22 button 5+3
23 button 15+5
24 input#cadence(type="text" v-model="newchallenge.cadence"
25 placeholder="5+0, 1h+30s, 7d+1d ...")
26 fieldset(v-if="st.user.id > 0")
27 label(for="selectPlayers") {{ st.tr["Play with?"] }}
28 input#selectPlayers(type="text" v-model="newchallenge.to")
29 fieldset(v-if="st.user.id > 0 && newchallenge.to.length > 0")
30 label(for="inputFen") FEN
31 input#inputFen(type="text" v-model="newchallenge.fen")
32 button(@click="newChallenge()") {{ st.tr["Send challenge"] }}
33 .row
34 .col-sm-12
35 button#newGame(onClick="doClick('modalNewgame')") {{ st.tr["New game"] }}
36 .row
37 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
38 div
39 .button-group
40 button(@click="setDisplay('c','live',$event)" class="active")
41 | {{ st.tr["Live challenges"] }}
42 button(@click="setDisplay('c','corr',$event)")
43 | {{ st.tr["Correspondance challenges"] }}
44 ChallengeList(v-show="cdisplay=='live'"
45 :challenges="filterChallenges('live')" @click-challenge="clickChallenge")
46 ChallengeList(v-show="cdisplay=='corr'"
47 :challenges="filterChallenges('corr')" @click-challenge="clickChallenge")
48 #people
49 h3.text-center {{ st.tr["Who's there?"] }}
50 #players
51 p(v-for="sid in Object.keys(people)" v-if="!!people[sid].name")
52 span {{ people[sid].name }}
53 // Check: anonymous players cannot send individual challenges or be challenged individually
54 button.player-action(
55 v-if="sid != st.user.sid && !!st.user.name && people[sid].id > 0"
56 @click="challOrWatch(sid)"
57 )
58 | {{ getActionLabel(sid) }}
59 p.anonymous @nonymous ({{ anonymousCount }})
60 #chat
61 Chat(:newChat="newChat" @mychat="processChat" :pastChats="[]")
62 .clearer
63 div
64 .button-group
65 button(@click="setDisplay('g','live',$event)" class="active")
66 | {{ st.tr["Live games"] }}
67 button(@click="setDisplay('g','corr',$event)")
68 | {{ st.tr["Correspondance games"] }}
69 GameList(v-show="gdisplay=='live'" :games="filterGames('live')"
70 @show-game="showGame")
71 GameList(v-show="gdisplay=='corr'" :games="filterGames('corr')"
72 @show-game="showGame")
73 </template>
74
75 <script>
76 import { store } from "@/store";
77 import { checkChallenge } from "@/data/challengeCheck";
78 import { ArrayFun } from "@/utils/array";
79 import { ajax } from "@/utils/ajax";
80 import params from "@/parameters";
81 import { getRandString, shuffle } from "@/utils/alea";
82 import Chat from "@/components/Chat.vue";
83 import GameList from "@/components/GameList.vue";
84 import ChallengeList from "@/components/ChallengeList.vue";
85 import { GameStorage } from "@/utils/gameStorage";
86 import { processModalClick } from "@/utils/modalClick";
87 export default {
88 name: "my-hall",
89 components: {
90 Chat,
91 GameList,
92 ChallengeList,
93 },
94 data: function () {
95 return {
96 st: store.state,
97 cdisplay: "live", //or corr
98 gdisplay: "live",
99 games: [],
100 challenges: [],
101 people: {},
102 infoMessage: "",
103 newchallenge: {
104 fen: "",
105 vid: localStorage.getItem("vid") || "",
106 to: "", //name of challenged player (if any)
107 cadence: localStorage.getItem("cadence") || "",
108 },
109 newChat: "",
110 conn: null,
111 connexionString: "",
112 // Related to (killing of) self multi-connects:
113 newConnect: {},
114 killed: {},
115 };
116 },
117 watch: {
118 // st.variants changes only once, at loading from [] to [...]
119 "st.variants": function(variantArray) {
120 // Set potential challenges and games variant names:
121 this.challenges.concat(this.games).forEach(o => {
122 if (o.vname == "")
123 o.vname = this.getVname(o.vid);
124 });
125 },
126 },
127 computed: {
128 anonymousCount: function() {
129 let count = 0;
130 Object.values(this.people).forEach(p => { count += (!p.name ? 1 : 0); });
131 return count;
132 },
133 },
134 created: function() {
135 const my = this.st.user;
136 this.$set(this.people, my.sid, {id:my.id, name:my.name, pages:["/"]});
137 // Ask server for current corr games (all but mines)
138 ajax(
139 "/games",
140 "GET",
141 {uid: this.st.user.id, excluded: true},
142 response => {
143 this.games = this.games.concat(response.games.map(g => {
144 const type = this.classifyObject(g);
145 const vname = this.getVname(g.vid);
146 return Object.assign({}, g, {type: type, vname: vname});
147 }));
148 }
149 );
150 // Also ask for corr challenges (open + sent by/to me)
151 ajax(
152 "/challenges",
153 "GET",
154 {uid: this.st.user.id},
155 response => {
156 // Gather all senders names, and then retrieve full identity:
157 // (TODO [perf]: some might be online...)
158 let names = {};
159 response.challenges.forEach(c => {
160 if (c.uid != this.st.user.id)
161 names[c.uid] = ""; //unknwon for now
162 else if (!!c.target && c.target != this.st.user.id)
163 names[c.target] = "";
164 });
165 const addChallenges = (newChalls) => {
166 names[this.st.user.id] = this.st.user.name; //in case of
167 this.challenges = this.challenges.concat(
168 response.challenges.map(c => {
169 const from = {name: names[c.uid], id: c.uid}; //or just name
170 const type = this.classifyObject(c);
171 const vname = this.getVname(c.vid);
172 return Object.assign({},
173 {
174 type: type,
175 vname: vname,
176 from: from,
177 to: (!!c.target ? names[c.target] : ""),
178 },
179 c);
180 })
181 );
182 };
183 if (names !== {})
184 {
185 ajax("/users",
186 "GET",
187 { ids: Object.keys(names).join(",") },
188 response2 => {
189 response2.users.forEach(u => {names[u.id] = u.name});
190 addChallenges();
191 }
192 );
193 }
194 else
195 addChallenges();
196 }
197 );
198 const connectAndPoll = () => {
199 this.send("connect");
200 this.send("pollclientsandgamers");
201 };
202 // Initialize connection
203 this.connexionString = params.socketUrl +
204 "/?sid=" + this.st.user.sid +
205 "&tmpId=" + getRandString() +
206 "&page=" + encodeURIComponent(this.$route.path);
207 this.conn = new WebSocket(this.connexionString);
208 this.conn.onopen = connectAndPoll;
209 this.conn.onmessage = this.socketMessageListener;
210 this.conn.onclose = this.socketCloseListener;
211 },
212 mounted: function() {
213 [document.getElementById("infoDiv"),document.getElementById("newgameDiv")]
214 .forEach(elt => elt.addEventListener("click", processModalClick));
215 document.querySelectorAll("#predefinedCadences > button").forEach(
216 (b) => { b.addEventListener("click",
217 () => { this.newchallenge.cadence = b.innerHTML; }
218 )}
219 );
220 },
221 beforeDestroy: function() {
222 this.send("disconnect");
223 },
224 methods: {
225 // Helpers:
226 send: function(code, obj) {
227 if (!!this.conn)
228 {
229 this.conn.send(JSON.stringify(
230 Object.assign(
231 {code: code},
232 obj,
233 )
234 ));
235 }
236 },
237 getVname: function(vid) {
238 const variant = this.st.variants.find(v => v.id == vid);
239 // this.st.variants might be uninitialized (variant == null)
240 return (!!variant ? variant.name : "");
241 },
242 filterChallenges: function(type) {
243 return this.challenges.filter(c => c.type == type);
244 },
245 filterGames: function(type) {
246 return this.games.filter(g => g.type == type);
247 },
248 classifyObject: function(o) { //challenge or game
249 return (o.cadence.indexOf('d') === -1 ? "live" : "corr");
250 },
251 setDisplay: function(letter, type, e) {
252 this[letter + "display"] = type;
253 e.target.classList.add("active");
254 if (!!e.target.previousElementSibling)
255 e.target.previousElementSibling.classList.remove("active");
256 else
257 e.target.nextElementSibling.classList.remove("active");
258 },
259 getActionLabel: function(sid) {
260 return this.people[sid].pages.some(p => p == "/")
261 ? "Challenge"
262 : "Observe";
263 },
264 challOrWatch: function(sid) {
265 if (this.people[sid].pages.some(p => p == "/"))
266 {
267 // Available, in Hall
268 this.newchallenge.to = this.people[sid].name;
269 doClick("modalNewgame");
270 }
271 else
272 {
273 // In some game, maybe playing maybe not
274 const gid = this.people[sid].page.match(/[a-zA-Z0-9]+$/)[0];
275 this.showGame(this.games.find(g => g.id == gid));
276 }
277 },
278 showGame: function(g) {
279 // NOTE: we are an observer, since only games I don't play are shown here
280 // ==> Moves sent by connected remote player(s) if live game
281 let url = "/game/" + g.id;
282 if (g.type == "live")
283 url += "?rid=" + g.rids[Math.floor(Math.random() * g.rids.length)];
284 this.$router.push(url);
285 },
286 processChat: function(chat) {
287 this.send("newchat", {data:chat});
288 },
289 // Messaging center:
290 socketMessageListener: function(msg) {
291 if (!this.conn)
292 return;
293 const data = JSON.parse(msg.data);
294 switch (data.code)
295 {
296 case "pollclientsandgamers":
297 {
298 // Since people can be both in Hall and Game,
299 // need to track "askIdentity" requests:
300 let identityAsked = {};
301 data.sockIds.forEach(s => {
302 if (s.sid != this.st.user.sid && !identityAsked[s.sid])
303 {
304 identityAsked[s.sid] = true;
305 this.send("askidentity", {target:s.sid, page:s.page || "/"});
306 }
307 if (!this.people[s.sid])
308 this.$set(this.people, s.sid, {id:0, name:"", pages:[s.page || "/"]});
309 else if (!!s.page && this.people[s.sid].pages.indexOf(s.page) < 0)
310 this.people[s.sid].pages.push(s.page);
311 if (!s.page) //peer is in Hall
312 this.send("askchallenge", {target:s.sid});
313 else //peer is in Game
314 this.send("askgame", {target:s.sid, page:s.page});
315 });
316 break;
317 }
318 case "connect":
319 case "gconnect":
320 // NOTE: player could have been polled earlier, but might have logged in then
321 // So it's a good idea to ask identity if he was anonymous.
322 // But only ask game / challenge if currently disconnected.
323 if (!this.people[data.from])
324 {
325 this.$set(this.people, data.from, {name:"", id:0, pages:[data.page]});
326 if (data.code == "connect")
327 this.send("askchallenge", {target:data.from});
328 else
329 this.send("askgame", {target:data.from, page:data.page});
330 }
331 else
332 {
333 // append page if not already in list
334 if (this.people[data.from].pages.indexOf(data.page) < 0)
335 this.people[data.from].pages.push(data.page);
336 }
337 if (this.people[data.from].id == 0)
338 {
339 this.newConnect[data.from] = true; //for self multi-connects tests
340 this.send("askidentity", {target:data.from, page:data.page || "/"});
341 }
342 break;
343 case "disconnect":
344 case "gdisconnect":
345 // Disconnect means no more tmpIds:
346 if (data.code == "disconnect")
347 {
348 // Remove the live challenge sent by this player:
349 ArrayFun.remove(this.challenges, c => c.from.sid == data.from);
350 }
351 else
352 {
353 // Remove the matching live game if now unreachable
354 const gid = data.page.match(/[a-zA-Z0-9]+$/)[0];
355 const gidx = this.games.findIndex(g => g.id == gid);
356 if (gidx >= 0)
357 {
358 const game = this.games[gidx];
359 if (game.type == "live" &&
360 game.rids.length == 1 && game.rids[0] == data.from)
361 {
362 this.games.splice(gidx, 1);
363 }
364 }
365 }
366 const page = data.page || "/";
367 ArrayFun.remove(this.people[data.from].pages, p => p == page);
368 if (this.people[data.from].pages.length == 0)
369 this.$delete(this.people, data.from);
370 break;
371 case "killed":
372 // I logged in elsewhere:
373 alert(this.st.tr["New connexion detected: tab now offline"]);
374 // TODO: this fails. See https://github.com/websockets/ws/issues/489
375 //this.conn.removeEventListener("message", this.socketMessageListener);
376 //this.conn.removeEventListener("close", this.socketCloseListener);
377 //this.conn.close();
378 this.conn = null;
379 break;
380 case "askidentity":
381 {
382 // Request for identification (TODO: anonymous shouldn't need to reply)
383 const me = {
384 // Decompose to avoid revealing email
385 name: this.st.user.name,
386 sid: this.st.user.sid,
387 id: this.st.user.id,
388 };
389 this.send("identity", {data:me, target:data.from});
390 break;
391 }
392 case "identity":
393 {
394 const user = data.data;
395 if (!!user.name) //otherwise anonymous
396 {
397 // If I multi-connect, kill current connexion if no mark (I'm older)
398 if (this.newConnect[user.sid] && user.id > 0
399 && user.id == this.st.user.id && user.sid != this.st.user.sid)
400 {
401 if (!this.killed[this.st.user.sid])
402 {
403 this.send("killme", {sid:this.st.user.sid});
404 this.killed[this.st.user.sid] = true;
405 }
406 }
407 if (user.sid != this.st.user.sid) //I already know my identity...
408 {
409 this.$set(this.people, user.sid,
410 {
411 id: user.id,
412 name: user.name,
413 pages: this.people[user.sid].pages,
414 });
415 }
416 }
417 delete this.newConnect[user.sid];
418 break;
419 }
420 case "askchallenge":
421 {
422 // Send my current live challenge (if any)
423 const cIdx = this.challenges.findIndex(c =>
424 c.from.sid == this.st.user.sid && c.type == "live");
425 if (cIdx >= 0)
426 {
427 const c = this.challenges[cIdx];
428 // NOTE: in principle, should only send targeted challenge to the target.
429 // But we may not know yet the identity of the target (just name),
430 // so cannot decide if data.from is the target or not.
431 const myChallenge =
432 {
433 id: c.id,
434 from: this.st.user.sid,
435 to: c.to,
436 fen: c.fen,
437 vid: c.vid,
438 cadence: c.cadence,
439 added: c.added,
440 };
441 this.send("challenge", {data:myChallenge, target:data.from});
442 }
443 break;
444 }
445 case "challenge": //after "askchallenge"
446 case "newchallenge":
447 {
448 // NOTE about next condition: see "askchallenge" case.
449 const chall = data.data;
450 if (!chall.to || (this.people[chall.from].id > 0 &&
451 (chall.from == this.st.user.sid || chall.to == this.st.user.name)))
452 {
453 let newChall = Object.assign({}, chall);
454 newChall.type = this.classifyObject(chall);
455 newChall.added = Date.now();
456 let fromValues = Object.assign({}, this.people[chall.from]);
457 delete fromValues["pages"]; //irrelevant in this context
458 newChall.from = Object.assign({sid:chall.from}, fromValues);
459 newChall.vname = this.getVname(newChall.vid);
460 this.challenges.push(newChall);
461 }
462 break;
463 }
464 case "refusechallenge":
465 {
466 const cid = data.data;
467 ArrayFun.remove(this.challenges, c => c.id == cid);
468 alert(this.st.tr["Challenge declined"]);
469 break;
470 }
471 case "deletechallenge":
472 {
473 // NOTE: the challenge may be already removed
474 const cid = data.data;
475 ArrayFun.remove(this.challenges, c => c.id == cid);
476 break;
477 }
478 case "game": //individual request
479 case "newgame":
480 {
481 // NOTE: it may be live or correspondance
482 const game = data.data;
483 let locGame = this.games.find(g => g.id == game.id);
484 if (!locGame)
485 {
486 let newGame = game;
487 newGame.type = this.classifyObject(game);
488 newGame.vname = this.getVname(game.vid);
489 if (!game.score) //if new game from Hall
490 newGame.score = "*";
491 newGame.rids = [game.rid];
492 delete newGame["rid"];
493 this.games.push(newGame);
494 }
495 else
496 {
497 // Append rid (if not already in list)
498 if (!locGame.rids.includes(game.rid))
499 locGame.rids.push(game.rid);
500 }
501 break;
502 }
503 case "startgame":
504 {
505 // New game just started: data contain all information
506 const gameInfo = data.data;
507 if (this.classifyObject(gameInfo) == "live")
508 this.startNewGame(gameInfo);
509 else
510 {
511 this.infoMessage = this.st.tr["New correspondance game:"] +
512 " <a href='#/game/" + gameInfo.id + "'>" +
513 "#/game/" + gameInfo.id + "</a>";
514 let modalBox = document.getElementById("modalInfo");
515 modalBox.checked = true;
516 }
517 break;
518 }
519 case "newchat":
520 this.newChat = data.data;
521 break;
522 }
523 },
524 socketCloseListener: function() {
525 if (!this.conn)
526 return;
527 this.conn = new WebSocket(this.connexionString);
528 this.conn.addEventListener("message", this.socketMessageListener);
529 this.conn.addEventListener("close", this.socketCloseListener);
530 },
531 // Challenge lifecycle:
532 newChallenge: async function() {
533 if (this.newchallenge.vid == "")
534 return alert(this.st.tr["Please select a variant"]);
535 if (!!this.newchallenge.to && this.newchallenge.to == this.st.user.name)
536 return alert(this.st.tr["Self-challenge is forbidden"]);
537 const vname = this.getVname(this.newchallenge.vid);
538 const vModule = await import("@/variants/" + vname + ".js");
539 window.V = vModule.VariantRules;
540 if (!!this.newchallenge.cadence.match(/^[0-9]+$/))
541 this.newchallenge.cadence += "+0"; //assume minutes, no increment
542 const error = checkChallenge(this.newchallenge);
543 if (!!error)
544 return alert(error);
545 const ctype = this.classifyObject(this.newchallenge);
546 if (ctype == "corr" && this.st.user.id <= 0)
547 return alert(this.st.tr["Please log in to play correspondance games"]);
548 // NOTE: "from" information is not required here
549 let chall = Object.assign({}, this.newchallenge);
550 const finishAddChallenge = (cid) => {
551 chall.id = cid || "c" + getRandString();
552 // Remove old challenge if any (only one at a time of a given type):
553 const cIdx = this.challenges.findIndex(c =>
554 (c.from.sid == this.st.user.sid || c.from.id == this.st.user.id) && c.type == ctype);
555 if (cIdx >= 0)
556 {
557 // Delete current challenge (will be replaced now)
558 this.send("deletechallenge", {data:this.challenges[cIdx].id});
559 if (ctype == "corr")
560 {
561 ajax(
562 "/challenges",
563 "DELETE",
564 {id: this.challenges[cIdx].id}
565 );
566 }
567 this.challenges.splice(cIdx, 1);
568 }
569 this.send("newchallenge", {data:Object.assign({from:this.st.user.sid}, chall)});
570 // Add new challenge:
571 chall.from = { //decompose to avoid revealing email
572 sid: this.st.user.sid,
573 id: this.st.user.id,
574 name: this.st.user.name,
575 };
576 chall.added = Date.now();
577 // NOTE: vname and type are redundant (can be deduced from cadence + vid)
578 chall.type = ctype;
579 chall.vname = vname;
580 this.challenges.push(chall);
581 // Remember cadence + vid for quicker further challenges:
582 localStorage.setItem("cadence", chall.cadence);
583 localStorage.setItem("vid", chall.vid);
584 document.getElementById("modalNewgame").checked = false;
585 };
586 if (ctype == "live")
587 {
588 // Live challenges have a random ID
589 finishAddChallenge(null);
590 }
591 else
592 {
593 // Correspondance game: send challenge to server
594 ajax(
595 "/challenges",
596 "POST",
597 { chall: chall },
598 response => { finishAddChallenge(response.cid); }
599 );
600 }
601 },
602 clickChallenge: function(c) {
603 const myChallenge = (c.from.sid == this.st.user.sid //live
604 || (this.st.user.id > 0 && c.from.id == this.st.user.id)); //corr
605 if (!myChallenge)
606 {
607 if (c.type == "corr" && this.st.user.id <= 0)
608 return alert(this.st.tr["Please log in to accept corr challenges"]);
609 c.accepted = true;
610 if (!!c.to) //c.to == this.st.user.name (connected)
611 {
612 // TODO: if special FEN, show diagram after loading variant
613 c.accepted = confirm("Accept challenge?");
614 }
615 if (c.accepted)
616 {
617 c.seat = { //again, avoid c.seat = st.user to not reveal email
618 sid: this.st.user.sid,
619 id: this.st.user.id,
620 name: this.st.user.name,
621 };
622 this.launchGame(c);
623 }
624 else
625 {
626 this.send("refusechallenge", {data:c.id, target:c.from.sid});
627 }
628 this.send("deletechallenge", {data:c.id});
629 }
630 else //my challenge
631 {
632 if (c.type == "corr")
633 {
634 ajax(
635 "/challenges",
636 "DELETE",
637 {id: c.id}
638 );
639 }
640 this.send("deletechallenge", {data:c.id});
641 }
642 // In all cases, the challenge is consumed:
643 ArrayFun.remove(this.challenges, ch => ch.id == c.id);
644 },
645 // NOTE: when launching game, the challenge is already being deleted
646 launchGame: async function(c) {
647 const vModule = await import("@/variants/" + c.vname + ".js");
648 window.V = vModule.VariantRules;
649 // These game informations will be shared
650 let gameInfo =
651 {
652 id: getRandString(),
653 fen: c.fen || V.GenRandInitFen(),
654 players: shuffle([c.from, c.seat]), //white then black
655 vid: c.vid,
656 cadence: c.cadence,
657 };
658 let oppsid = c.from.sid; //may not be defined if corr + offline opp
659 if (!oppsid)
660 {
661 oppsid = Object.keys(this.people).find(sid =>
662 this.people[sid].id == c.from.id);
663 }
664 const notifyNewgame = () => {
665 if (!!oppsid) //opponent is online
666 this.send("startgame", {data:gameInfo, target:oppsid});
667 // Send game info (only if live) to everyone except me in this tab
668 this.send("newgame", {data:gameInfo});
669 };
670 if (c.type == "live")
671 {
672 notifyNewgame();
673 this.startNewGame(gameInfo);
674 }
675 else //corr: game only on server
676 {
677 ajax(
678 "/games",
679 "POST",
680 {gameInfo: gameInfo, cid: c.id}, //cid useful to delete challenge
681 response => {
682 gameInfo.id = response.gameId;
683 notifyNewgame();
684 this.$router.push("/game/" + response.gameId);
685 }
686 );
687 }
688 },
689 // NOTE: for live games only (corr games start on the server)
690 startNewGame: function(gameInfo) {
691 const game = Object.assign({}, gameInfo, {
692 // (other) Game infos: constant
693 fenStart: gameInfo.fen,
694 vname: this.getVname(gameInfo.vid),
695 created: Date.now(),
696 // Game state (including FEN): will be updated
697 moves: [],
698 clocks: [-1, -1], //-1 = unstarted
699 initime: [0, 0], //initialized later
700 score: "*",
701 });
702 GameStorage.add(game);
703 if (this.st.settings.sound >= 1)
704 new Audio("/sounds/newgame.mp3").play().catch(err => {});
705 this.$router.push("/game/" + gameInfo.id);
706 },
707 },
708 };
709 </script>
710
711 <style lang="sass" scoped>
712 .active
713 color: #42a983
714 #newGame
715 display: block
716 margin: 10px auto 5px auto
717
718 #infoDiv > .card
719 padding: 15px 0
720 max-width: 430px
721
722 #newgameDiv > .card
723 max-width: 767px
724 max-height: 100%
725
726 #people
727 width: 100%
728 #players
729 width: 50%
730 position: relative
731 float: left
732 #chat
733 width: 50%
734 float: left
735 position: relative
736 @media screen and (max-width: 767px)
737 #players, #chats
738 width: 100%
739 #chat > .card
740 max-width: 100%
741 margin: 0;
742 border: none;
743 #players > p
744 margin-left: 5px
745 .anonymous
746 font-style: italic
747 button.player-action
748 margin-left: 32px
749 </style>