Kopie van https://gitlab.com/studieverenigingvia/ict/centurion met een paar aanpassingen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
54 lines
1.2 KiB
import React, {useEffect, useState} from 'react';
|
|
import './App.css';
|
|
import logo from "./via-logo.svg"
|
|
import {Row} from "antd"
|
|
import socket, { emit } from "./util/socket";
|
|
import NextShot from "./components/NextShot";
|
|
import ShotsTaken from "./components/ShotsTaken";
|
|
import Feed from "./components/Feed";
|
|
import Lobby from "./components/Lobby";
|
|
|
|
|
|
const App = () => {
|
|
const [connected, setConnected] = useState(false);
|
|
const [lobbyId, setLobbyId] = useState(null);
|
|
|
|
useEffect(() => {
|
|
socket.on('welcome', async (obj: any) => {
|
|
setLobbyId(obj.lobby.name);
|
|
setConnected(true);
|
|
});
|
|
|
|
return () => {
|
|
socket.off("SENDING_NEW_TIME");
|
|
socket.off("welcome");
|
|
}
|
|
});
|
|
|
|
const gameContent = (
|
|
<Row>
|
|
<NextShot/>
|
|
<Feed/>
|
|
<ShotsTaken/>
|
|
</Row>
|
|
);
|
|
|
|
const lobbyContent = (
|
|
<Lobby/>
|
|
);
|
|
|
|
const content = lobbyContent;
|
|
|
|
return (
|
|
<>
|
|
<section className="content">
|
|
{content}
|
|
</section>
|
|
<footer>
|
|
<img src={logo} className="via-logo" alt="logo"/>
|
|
</footer>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|
|
|