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.
centurion/frontend/src/App.tsx

55 lines
1.2 KiB

4 years ago
import React, {useEffect, useState} from 'react';
4 years ago
import './App.css';
import logo from "./via-logo.svg"
4 years ago
import {Row} from "antd"
4 years ago
import socket, { emit } from "./util/socket";
4 years ago
import NextShot from "./components/NextShot";
import ShotsTaken from "./components/ShotsTaken";
import Feed from "./components/Feed";
4 years ago
import Lobby from "./components/Lobby";
4 years ago
const App = () => {
4 years ago
const [connected, setConnected] = useState(false);
const [lobbyId, setLobbyId] = useState(null);
4 years ago
4 years ago
useEffect(() => {
4 years ago
socket.on('welcome', async (obj: any) => {
4 years ago
setLobbyId(obj.lobby.name);
4 years ago
setConnected(true);
4 years ago
});
4 years ago
4 years ago
return () => {
socket.off("SENDING_NEW_TIME");
4 years ago
socket.off("welcome");
4 years ago
}
});
4 years ago
4 years ago
const gameContent = (
<Row>
<NextShot/>
<Feed/>
<ShotsTaken/>
</Row>
);
const lobbyContent = (
4 years ago
<Lobby/>
4 years ago
);
const content = lobbyContent;
4 years ago
return (
4 years ago
<>
4 years ago
<section className="content">
4 years ago
{content}
4 years ago
</section>
<footer>
<img src={logo} className="via-logo" alt="logo"/>
</footer>
4 years ago
</>
4 years ago
);
};
export default App;