summaryrefslogtreecommitdiff
path: root/frontend/src/containers/app/map/TileContainer.js
blob: 04d6c8d607cdf2e74f5068441444a95ec1b3e4fa (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 { goFromRoomToRack } from '../../../actions/interaction-level'
import TileGroup from '../../../components/app/map/groups/TileGroup'

const mapStateToProps = (state, ownProps) => {
    const tile = state.objects.tile[ownProps.tileId]

    return {
        interactionLevel: state.interactionLevel,
        tile,
    }
}

const mapDispatchToProps = (dispatch) => {
    return {
        onClick: (tile) => {
            if (tile.rackId) {
                dispatch(goFromRoomToRack(tile._id))
            }
        },
    }
}

const TileContainer = connect(mapStateToProps, mapDispatchToProps)(TileGroup)

export default TileContainer