const { connect } = require('preact-redux');

const actions = require('../actions');
const Info = require('./info.component');

const addState = connect(
    function receiveState(state) {
        const {
            ws,
            combiner,
            info,
            itemInfo,
            instance,
            player,
            account,
            tutorial,
        } = state;

        return {
            ws,
            combiner,
            info,
            itemInfo,
            instance,
            player,
            account,
            tutorial,
        };
    },

    function receiveDispatch(dispatch) {
        function setTutorialNull() {
            dispatch(actions.setTutorial(null));
        }

        function setInfo(info) {
            dispatch(actions.setInfo(info));
        }
        return { setTutorialNull, setInfo };
    }


);

module.exports = addState(Info);
