]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/pages/Tournament.js
set window title
[alttp.git] / resources / js / components / pages / Tournament.js
index bc1282e0586fdc351d626eb9ccd1707bdcd1ce8b..729e55d138d856d2da8491a0a20f177831d05cee 100644 (file)
@@ -8,6 +8,7 @@ import Loading from '../common/Loading';
 import NotFound from '../pages/NotFound';
 import Detail from '../tournament/Detail';
 import {
+       patchApplication,
        patchParticipant,
        patchResult,
        patchRound,
@@ -31,6 +32,7 @@ const Tournament = () => {
                                setError(null);
                                setLoading(false);
                                setTournament(sortParticipants(response.data));
+                               window.document.title = response.data.title;
                        })
                        .catch(error => {
                                setError(error);
@@ -41,6 +43,16 @@ const Tournament = () => {
 
        useEffect(() => {
                window.Echo.channel(`Tournament.${id}`)
+                       .listen('ApplicationAdded', e => {
+                               if (e.application) {
+                                       setTournament(tournament => patchApplication(tournament, e.application));
+                               }
+                       })
+                       .listen('ApplicationChanged', e => {
+                               if (e.application) {
+                                       setTournament(tournament => patchApplication(tournament, e.application));
+                               }
+                       })
                        .listen('ParticipantChanged', e => {
                                if (e.participant) {
                                        setTournament(tournament => patchParticipant(tournament, e.participant));