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

53 lines
1.1 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 = () => {
const [started, setStarted] = useState(false);
4 years ago
4 years ago
useEffect(() => {
socket.on('started', async () => {
setStarted(true);
console.log('ffin started')
4 years ago
});
4 years ago
4 years ago
return () => {
socket.off("started");
4 years ago
}
});
4 years ago
const feedContent = (
4 years ago
<Row>
<NextShot/>
<Feed/>
<ShotsTaken/>
</Row>
);
const lobbyContent = (
4 years ago
<Lobby/>
4 years ago
);
const content = started ? feedContent : lobbyContent;
4 years ago
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;