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.
39 lines
1006 B
39 lines
1006 B
import React, {useState} from 'react';
|
|
import {Col, Progress} from "antd"
|
|
import {useSocket} from "use-socketio/lib";
|
|
|
|
|
|
import {Tick} from "../types/types";
|
|
import {roomTime, useRoom, useTimeline} from "../lib/Connection";
|
|
import {useUpdateAfterDelay} from "../util/hooks";
|
|
|
|
|
|
const ShotsTaken = () => {
|
|
let room = useRoom();
|
|
let timeline = useTimeline();
|
|
|
|
useUpdateAfterDelay(1000);
|
|
|
|
let taken = 0;
|
|
|
|
if (room?.running && timeline) {
|
|
let [current, _] = timeline.eventAtTime(roomTime(), 'shot');
|
|
if (current) {
|
|
taken = current.shotCount!!;
|
|
}
|
|
}
|
|
|
|
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;
|
|
|