From 751a9ef3a12c952fe179f256d854d0c4aa37e28e Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Wed, 4 Oct 2017 22:49:07 +0200 Subject: Apply prettier to codebase --- src/components/app/timeline/PlayButtonComponent.js | 38 +++++++----- src/components/app/timeline/TimelineComponent.js | 50 +++++++-------- .../app/timeline/TimelineControlsComponent.js | 72 ++++++++++++---------- .../app/timeline/TimelineLabelsComponent.js | 14 +++-- 4 files changed, 99 insertions(+), 75 deletions(-) (limited to 'src/components/app/timeline') diff --git a/src/components/app/timeline/PlayButtonComponent.js b/src/components/app/timeline/PlayButtonComponent.js index 2b8e5328..1a9b0ced 100644 --- a/src/components/app/timeline/PlayButtonComponent.js +++ b/src/components/app/timeline/PlayButtonComponent.js @@ -1,20 +1,30 @@ import React from "react"; -const PlayButtonComponent = ({isPlaying, currentTick, lastSimulatedTick, onPlay, onPause}) => ( -
{ - if (isPlaying) { - onPause(); - } else { - if (currentTick !== lastSimulatedTick) { - onPlay(); - } +const PlayButtonComponent = ({ + isPlaying, + currentTick, + lastSimulatedTick, + onPlay, + onPause +}) => ( +
{ + if (isPlaying) { + onPause(); + } else { + if (currentTick !== lastSimulatedTick) { + onPlay(); } - }}> - {isPlaying ? - : - - } -
+ } + }} + > + {isPlaying ? ( + + ) : ( + + )} +
); export default PlayButtonComponent; diff --git a/src/components/app/timeline/TimelineComponent.js b/src/components/app/timeline/TimelineComponent.js index 950a25bd..0f88b8f4 100644 --- a/src/components/app/timeline/TimelineComponent.js +++ b/src/components/app/timeline/TimelineComponent.js @@ -4,34 +4,34 @@ import TimelineLabelsContainer from "../../../containers/app/timeline/TimelineLa import "./Timeline.css"; class TimelineComponent extends React.Component { - componentDidMount() { - this.interval = setInterval(() => { - if (!this.props.isPlaying) { - return; - } + componentDidMount() { + this.interval = setInterval(() => { + if (!this.props.isPlaying) { + return; + } - if (this.props.currentTick < this.props.lastSimulatedTick) { - this.props.incrementTick(); - } else { - this.props.pauseSimulation(); - } - }, 1000); - } + if (this.props.currentTick < this.props.lastSimulatedTick) { + this.props.incrementTick(); + } else { + this.props.pauseSimulation(); + } + }, 1000); + } - componentWillUnmount() { - clearInterval(this.interval); - } + componentWillUnmount() { + clearInterval(this.interval); + } - render() { - return ( -
-
- - -
-
- ); - } + render() { + return ( +
+
+ + +
+
+ ); + } } export default TimelineComponent; diff --git a/src/components/app/timeline/TimelineControlsComponent.js b/src/components/app/timeline/TimelineControlsComponent.js index 72fc4a60..f3d55154 100644 --- a/src/components/app/timeline/TimelineControlsComponent.js +++ b/src/components/app/timeline/TimelineControlsComponent.js @@ -1,39 +1,49 @@ import React from "react"; import PlayButtonContainer from "../../../containers/app/timeline/PlayButtonContainer"; -import {convertTickToPercentage} from "../../../util/timeline"; +import { convertTickToPercentage } from "../../../util/timeline"; class TimelineControlsComponent extends React.Component { - onTimelineClick(e) { - const percentage = e.nativeEvent.offsetX / this.timeline.clientWidth; - const tick = Math.floor(percentage * (this.props.lastSimulatedTick + 1)); - this.props.goToTick(tick); - } + onTimelineClick(e) { + const percentage = e.nativeEvent.offsetX / this.timeline.clientWidth; + const tick = Math.floor(percentage * (this.props.lastSimulatedTick + 1)); + this.props.goToTick(tick); + } - render() { - return ( -
- -
this.timeline = timeline} - onClick={this.onTimelineClick.bind(this)} - > -
- {this.props.sectionTicks.map(sectionTick => ( -
- ))} -
-
- ); - } + render() { + return ( +
+ +
(this.timeline = timeline)} + onClick={this.onTimelineClick.bind(this)} + > +
+ {this.props.sectionTicks.map(sectionTick => ( +
+ ))} +
+
+ ); + } } export default TimelineControlsComponent; diff --git a/src/components/app/timeline/TimelineLabelsComponent.js b/src/components/app/timeline/TimelineLabelsComponent.js index e795691f..6943a86f 100644 --- a/src/components/app/timeline/TimelineLabelsComponent.js +++ b/src/components/app/timeline/TimelineLabelsComponent.js @@ -1,11 +1,15 @@ import React from "react"; -import {convertSecondsToFormattedTime} from "../../../util/date-time"; +import { convertSecondsToFormattedTime } from "../../../util/date-time"; -const TimelineLabelsComponent = ({currentTick, lastSimulatedTick}) => ( -
-
{convertSecondsToFormattedTime(currentTick)}
-
{convertSecondsToFormattedTime(lastSimulatedTick)}
+const TimelineLabelsComponent = ({ currentTick, lastSimulatedTick }) => ( +
+
+ {convertSecondsToFormattedTime(currentTick)}
+
+ {convertSecondsToFormattedTime(lastSimulatedTick)} +
+
); export default TimelineLabelsComponent; -- cgit v1.2.3