-
Notifications
You must be signed in to change notification settings - Fork 1
/
Events.jsx
40 lines (35 loc) · 1.11 KB
/
Events.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import EventSeries from "./EventSeries";
import { useState } from "react";
const Events = ({ eventLogger, svgMaxTimeSec }) => {
const [eventsCount, setEventsCount] = useState(0);
const [windowsCount, setWindowsCount] = useState(0);
eventLogger.setOnAddEventCallback(() => setEventsCount((c) => c + 1));
eventLogger.setOnSetFirstDateGetTime(() => setWindowsCount((c) => c + 1));
const elemEvents = [];
const events = eventLogger.getAllEvents();
const firstDateGetTime = eventLogger.firstDateGetTime;
events.forEach((value, key) => {
const eventName = key;
const listEventsDate = value;
const elem = (
<EventSeries
key={eventName}
eventName={eventName}
listEventsDate={listEventsDate}
svgMaxTimeSec={svgMaxTimeSec}
firstDateGetTime={firstDateGetTime}
/>
);
elemEvents.push(elem);
});
return (
<div>
<p>
Time window span: {svgMaxTimeSec} [s] , Events add : {eventsCount} ,
Time window count : {eventLogger.firstDateGetTime ? windowsCount : null}
</p>
{elemEvents}
</div>
);
};
export default Events;