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