]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/pages/Tournament.js
switch participant list to scoreboard
[alttp.git] / resources / js / components / pages / Tournament.js
index aab442346149865aa01f5bc47185a56f6200eede..90f7d038c3718612d5051dcf9453abbb79e14fe8 100644 (file)
@@ -7,7 +7,7 @@ import ErrorMessage from '../common/ErrorMessage';
 import Loading from '../common/Loading';
 import NotFound from '../pages/NotFound';
 import Detail from '../tournament/Detail';
-import { patchResult, sortParticipants } from '../../helpers/Tournament';
+import { patchResult, patchRound, sortParticipants } from '../../helpers/Tournament';
 
 const Tournament = () => {
        const params = useParams();
@@ -36,7 +36,6 @@ const Tournament = () => {
        useEffect(() => {
                window.Echo.private(`Tournament.${id}`)
                        .listen('ResultReported', e => {
-                               console.log(e);
                                if (e.result) {
                                        setTournament(tournament => patchResult(tournament, e.result));
                                }
@@ -48,6 +47,11 @@ const Tournament = () => {
                                                rounds: [...tournament.rounds, e.round],
                                        }));
                                }
+                       })
+                       .listen('RoundChanged', e => {
+                               if (e.round) {
+                                       setTournament(tournament => patchRound(tournament, e.round));
+                               }
                        });
                return () => {
                        window.Echo.leave(`Tournament.${id}`);