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

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

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

        function sendUnequip(crypId, item) {
            return ws.sendVboxUnequip(instance.id, crypId, item);
        }

        return {
            activeCryp,
            info,
            combiner,
            sendUnequip,
            instance,
            player,
            itemInfo,
            vboxHidden,
        };
    },
);

module.exports = addState(Info);
