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