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