summaryrefslogtreecommitdiff
path: root/frontend/src/components/app/timeline/TimelineComponent.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/components/app/timeline/TimelineComponent.js')
-rw-r--r--frontend/src/components/app/timeline/TimelineComponent.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/frontend/src/components/app/timeline/TimelineComponent.js b/frontend/src/components/app/timeline/TimelineComponent.js
new file mode 100644
index 00000000..0f88b8f4
--- /dev/null
+++ b/frontend/src/components/app/timeline/TimelineComponent.js
@@ -0,0 +1,37 @@
+import React from "react";
+import TimelineControlsContainer from "../../../containers/app/timeline/TimelineControlsContainer";
+import TimelineLabelsContainer from "../../../containers/app/timeline/TimelineLabelsContainer";
+import "./Timeline.css";
+
+class TimelineComponent extends React.Component {
+ componentDidMount() {
+ this.interval = setInterval(() => {
+ if (!this.props.isPlaying) {
+ return;
+ }
+
+ if (this.props.currentTick < this.props.lastSimulatedTick) {
+ this.props.incrementTick();
+ } else {
+ this.props.pauseSimulation();
+ }
+ }, 1000);
+ }
+
+ componentWillUnmount() {
+ clearInterval(this.interval);
+ }
+
+ render() {
+ return (
+ <div className="timeline-bar">
+ <div className="timeline-container">
+ <TimelineLabelsContainer />
+ <TimelineControlsContainer />
+ </div>
+ </div>
+ );
+ }
+}
+
+export default TimelineComponent;