summaryrefslogtreecommitdiff
path: root/src/containers/timeline/TimelineControlsContainer.js
blob: 16d440525caff9d3055f709022024891150c07b9 (plain)
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
import {connect} from "react-redux";
import TimelineControlsComponent from "../../components/timeline/TimelineControlsComponent";

const mapStateToProps = state => {
    let sectionTicks = [];
    if (state.currentExperimentId !== -1) {
        const sectionIds = state.objects.path[state.objects.experiment[state.currentExperimentId].pathId].sectionIds;
        if (sectionIds) {
            sectionTicks = sectionIds
                .filter(sectionId => state.objects.section[sectionId].startTick !== 0)
                .map(sectionId => state.objects.section[sectionId].startTick);
        }
    }

    return {
        currentTick: state.currentTick,
        lastSimulatedTick: state.lastSimulatedTick,
        sectionTicks,
    };
};

const TimelineControlsContainer = connect(
    mapStateToProps
)(TimelineControlsComponent);

export default TimelineControlsContainer;