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/components/ShotsTaken.tsx

34 lines
826 B

4 years ago
import React, {useState} from 'react';
4 years ago
import {Col, Progress} from "antd"
import {Tick} from "../types/types";
4 years ago
import {useSocket} from "use-socketio/lib";
4 years ago
const ShotsTaken = () => {
const [taken, setTaken] = useState(100);
4 years ago
useSocket("tick_event", async (tick: Tick) => {
if (!tick.nextShot) {
setTaken(100);
return;
}
4 years ago
4 years ago
setTaken(tick.nextShot.count - 1);
});
4 years ago
return (
4 years ago
<Col className="sider" span={24} md={4}>
4 years ago
<h1>Shots genomen:</h1>
<Progress type="circle"
percent={taken}
format={_ => taken + ' / 100'}
status="normal"
4 years ago
strokeColor={"#304ba3"}
strokeWidth={10}/>
</Col>
);
};
export default ShotsTaken;