|
|
@ -9,7 +9,6 @@ import {useSocket} from "use-socketio/lib"; |
|
|
|
const Lobby = (props: any) => { |
|
|
|
const Lobby = (props: any) => { |
|
|
|
const [lobbyId, setLobbyId] = useQueryParam('lobby', NumberParam); |
|
|
|
const [lobbyId, setLobbyId] = useQueryParam('lobby', NumberParam); |
|
|
|
const [isLeader, setIsLeader] = useState(false); |
|
|
|
const [isLeader, setIsLeader] = useState(false); |
|
|
|
const [isRunning, setIsRunning] = useState(false); |
|
|
|
|
|
|
|
const [seekTime, setSeekTime] = useState(0); |
|
|
|
const [seekTime, setSeekTime] = useState(0); |
|
|
|
const [userCount, setUserCount] = useState(0); |
|
|
|
const [userCount, setUserCount] = useState(0); |
|
|
|
|
|
|
|
|
|
|
@ -34,7 +33,6 @@ const Lobby = (props: any) => { |
|
|
|
const result: any = await emit(socket,'join_lobby', i); |
|
|
|
const result: any = await emit(socket,'join_lobby', i); |
|
|
|
setIsLeader(socket.id === result.lobby.leaderId); |
|
|
|
setIsLeader(socket.id === result.lobby.leaderId); |
|
|
|
setUserCount(result.lobby.users?.length || 0); |
|
|
|
setUserCount(result.lobby.users?.length || 0); |
|
|
|
setIsRunning(result.lobby.running); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
@ -42,9 +40,6 @@ const Lobby = (props: any) => { |
|
|
|
const result: any = await emit(socketRef.current,'lobby_info'); |
|
|
|
const result: any = await emit(socketRef.current,'lobby_info'); |
|
|
|
setIsLeader(socketRef.current.id === result.lobby.leaderId); |
|
|
|
setIsLeader(socketRef.current.id === result.lobby.leaderId); |
|
|
|
setUserCount(result.lobby.users?.length || 0); |
|
|
|
setUserCount(result.lobby.users?.length || 0); |
|
|
|
setIsRunning(result.lobby.running); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log("Got lobby_info"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wrapper(); |
|
|
|
wrapper(); |
|
|
@ -63,7 +58,7 @@ const Lobby = (props: any) => { |
|
|
|
<Row> |
|
|
|
<Row> |
|
|
|
<Col span={24}> |
|
|
|
<Col span={24}> |
|
|
|
<h1 id="centurion-title"> |
|
|
|
<h1 id="centurion-title"> |
|
|
|
<img src={beer} className="beer" alt="beer"/>Centurion! |
|
|
|
<img src={beer} className="beer-flipped" alt="beer"/>Centurion! |
|
|
|
<img src={beer} className="beer" alt="beer"/></h1> |
|
|
|
<img src={beer} className="beer" alt="beer"/></h1> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
@ -74,8 +69,8 @@ const Lobby = (props: any) => { |
|
|
|
<div>Kun jij het aan?</div> |
|
|
|
<div>Kun jij het aan?</div> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
<Row> |
|
|
|
<Row type="flex" justify="center"> |
|
|
|
<Col className="control" span={8} offset={8}> |
|
|
|
<Col className="control" xs={12} sm={10} md={8} xl={6}> |
|
|
|
<Card title={`Lobby setup (${lobbyId}):`} actions={isLeader ? [ |
|
|
|
<Card title={`Lobby setup (${lobbyId}):`} actions={isLeader ? [ |
|
|
|
<span onClick={async () => { |
|
|
|
<span onClick={async () => { |
|
|
|
await emit(socket,'request_start', seekTime) |
|
|
|
await emit(socket,'request_start', seekTime) |
|
|
|