summaryrefslogtreecommitdiff
path: root/src/containers/app/map/RackContainer.js
blob: 38f01efc1a37ae8a06c021fbac9c9ac2d86ea5fe (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 RackGroup from "../../../components/app/map/groups/RackGroup";
import {getStateLoad} from "../../../util/simulation-load";

const mapStateToProps = (state, ownProps) => {
    const inSimulation = state.currentExperimentId !== -1;

    let rackLoad = undefined;
    if (inSimulation) {
        if (state.states.rack[state.currentTick] && state.states.rack[state.currentTick][ownProps.tile.objectId]) {
            rackLoad = getStateLoad(state.loadMetric, state.states.rack[state.currentTick][ownProps.tile.objectId]);
        }
    }

    return {
        interactionLevel: state.interactionLevel,
        inSimulation,
        rackLoad,
    };
};

const RackContainer = connect(
    mapStateToProps
)(RackGroup);

export default RackContainer;