const preact = require('preact'); const range = require('lodash/range'); const without = require('lodash/without'); const shapes = require('./shapes'); const buttons = require('./buttons'); const { removeTier } = require('../utils'); function stashElement(props) { const { combinerChange, itemUnequip, vbox, vboxBuySelected, vboxHighlight, vboxHover, vboxSelecting, stashSelect, sendItemUnequip, setInfo, setVboxSelected, } = props; function stashClick(e) { e.stopPropagation(); if (itemUnequip.length) return sendItemUnequip(itemUnequip); if (vboxSelecting) return vboxBuySelected(); return true; } function stashBtn(v, i) { const stashHighlight = vboxSelecting || itemUnequip.length; if (!v && v !== 0) { const emptyInvClick = () => { if (vboxSelecting) return vboxBuySelected(); return false; }; return ; } const comboHighlight = vboxHighlight && vboxHighlight.includes(v) ? 'combo-border' : ''; function onClick(type) { const combinerContainsIndex = stashSelect.indexOf(i) > -1; // removing if (combinerContainsIndex) { if (type === 'click') { return combinerChange(without(stashSelect, i)); } return true; } if (!comboHighlight) { setInfo(vbox.bound[i]); return setVboxSelected({ shopSelect: [], stashSelect: [i] }); } stashSelect.push(i); // if (stashSelect.length === 3) setInfo(comboItem.item); return combinerChange(stashSelect); } const highlighted = stashSelect.indexOf(i) > -1; const border = buttons[removeTier(v)] ? buttons[removeTier(v)]() : ''; const classes = `${highlighted ? 'highlight' : border} ${comboHighlight}`; const invObject = shapes[v] ? shapes[v]() : v; return ( ); } return (