summaryrefslogtreecommitdiff
path: root/src/containers/map/RackContainer.js
blob: 60df9aaf59e6f95cb19cfd43e38e16ec9c49e188 (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/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;