]> git.localhorst.tv Git - alttp.git/commitdiff
public tournament page
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 16 Mar 2022 15:57:17 +0000 (16:57 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 16 Mar 2022 15:57:17 +0000 (16:57 +0100)
app/Events/ResultReported.php
app/Events/RoundAdded.php
app/Events/RoundChanged.php
app/Policies/TournamentPolicy.php
resources/js/components/App.js
resources/js/components/pages/Tournament.js
resources/js/components/protocol/Protocol.js

index 2a3eeb011539b7c0b58734b290a297a911c66427..61ec98bae699751500489b772e6ce037629466c5 100644 (file)
@@ -32,7 +32,7 @@ class ResultReported implements ShouldBroadcast
         */
        public function broadcastOn()
        {
-               return new PrivateChannel('Tournament.'.$this->result->round->tournament_id);
+               return new Channel('Tournament.'.$this->result->round->tournament_id);
        }
 
        public $result;
index a1b8787c6b9857e9dbadf6af33066859af88bd5d..0ea566124803b4a506135db18431ba8dd608d5bf 100644 (file)
@@ -32,7 +32,7 @@ class RoundAdded implements ShouldBroadcast
         */
        public function broadcastOn()
        {
-               return new PrivateChannel('Tournament.'.$this->round->tournament_id);
+               return new Channel('Tournament.'.$this->round->tournament_id);
        }
 
        public $round;
index 91d641bc0fb1b5f6cb9b83dbc3a01a2409c69293..a4df19961938f870b2c117821cf2764c6c9845c5 100644 (file)
@@ -32,7 +32,7 @@ class RoundChanged implements ShouldBroadcast
         */
        public function broadcastOn()
        {
-               return new PrivateChannel('Tournament.'.$this->round->tournament_id);
+               return new Channel('Tournament.'.$this->round->tournament_id);
        }
 
        public $round;
index fd2a781e87db325e2322e517f7b1442dde0a55f8..534813c5277f28c9c7f5e1d650ef74a8c4eff9c8 100644 (file)
@@ -16,7 +16,7 @@ class TournamentPolicy
         * @param  \App\Models\User  $user
         * @return \Illuminate\Auth\Access\Response|bool
         */
-       public function viewAny(User $user)
+       public function viewAny(?User $user)
        {
                return true;
        }
@@ -28,7 +28,7 @@ class TournamentPolicy
         * @param  \App\Models\Tournament  $tournament
         * @return \Illuminate\Auth\Access\Response|bool
         */
-       public function view(User $user, Tournament $tournament)
+       public function view(?User $user, Tournament $tournament)
        {
                return true;
        }
index f63298978de960aa1602ba08c99772e4989c9b0f..0199b931c43a81776c8d6188726107538509e74d 100644 (file)
@@ -3,7 +3,6 @@ import React, { useEffect, useState } from 'react';
 import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
 
 import Header from './common/Header';
-import Front from './pages/Front';
 import Tournament from './pages/Tournament';
 import UserContext from '../helpers/UserContext';
 
@@ -50,12 +49,10 @@ const App = () => {
        return <BrowserRouter>
                <UserContext.Provider value={user}>
                        <Header doLogout={doLogout} />
-                       {user ?
-                               <Routes>
-                                       <Route path="tournaments/:id" element={<Tournament />} />
-                                       <Route path="*" element={<Navigate to="/tournaments/1" />} />
-                               </Routes>
-                       : <Front />}
+                       <Routes>
+                               <Route path="tournaments/:id" element={<Tournament />} />
+                               <Route path="*" element={<Navigate to="/tournaments/1" />} />
+                       </Routes>
                </UserContext.Provider>
        </BrowserRouter>;
 };
index a5c43caf01f604055b1c077a08862fe7766f24b9..d5df3a1ca4916e4cae6a17c55df1c76babee86a0 100644 (file)
@@ -34,7 +34,7 @@ const Tournament = () => {
        }, [id]);
 
        useEffect(() => {
-               window.Echo.private(`Tournament.${id}`)
+               window.Echo.channel(`Tournament.${id}`)
                        .listen('ResultReported', e => {
                                if (e.result) {
                                        setTournament(tournament => patchResult(tournament, e.result));
index e94cad7bf436667ec1f61c724f299287212523d6..7cd0b754b1b19944d0e5b1124b3a3932187dd43b 100644 (file)
@@ -23,7 +23,6 @@ const Protocol = ({ id }) => {
        useEffect(() => {
                window.Echo.private(`Protocol.${id}`)
                        .listen('ProtocolAdded', e => {
-                               console.log(e);
                                if (e.protocol) {
                                        setProtocol(protocol => [e.protocol, ...protocol]);
                                }