vbox selected more wip

This commit is contained in:
Mashy 2019-11-19 12:06:08 +10:00
parent 33152e54d5
commit 604a604c01
2 changed files with 6 additions and 4 deletions

View File

@ -26,7 +26,7 @@ const addState = connect(
} = state; } = state;
function sendVboxAcceptEquip(constructId) { function sendVboxAcceptEquip(constructId) {
return ws.sendVboxAcceptEquip(instance.id, vboxSelected[0], vboxSelected[1], constructId); return ws.sendVboxAcceptEquip(instance.id, vboxSelected[0][0], vboxSelected[0][1], constructId);
} }
function sendVboxApply(constructId, i) { function sendVboxApply(constructId, i) {
@ -114,7 +114,7 @@ function Construct(props) {
e.preventDefault(); e.preventDefault();
if (duplicateSkill || tutorialDisableEquip) return true; if (duplicateSkill || tutorialDisableEquip) return true;
if (itemEquip !== null) return sendVboxApply(construct.id, itemEquip); if (itemEquip !== null) return sendVboxApply(construct.id, itemEquip);
if (vboxSelected[0]) return sendVboxAcceptEquip(construct.id); if (vboxSelected.length === 1) return sendVboxAcceptEquip(construct.id);
if (itemUnequip.length && itemUnequip[0] !== construct.id) return sendVboxUnequipApply(construct.id); if (itemUnequip.length && itemUnequip[0] !== construct.id) return sendVboxUnequipApply(construct.id);
setItemEquip(null); setItemEquip(null);
setItemUnequip([]); setItemUnequip([]);
@ -123,7 +123,7 @@ function Construct(props) {
function hoverInfo(e, info) { function hoverInfo(e, info) {
e.stopPropagation(); e.stopPropagation();
if (!info) return false; if (!info) return false;
if (vboxSelected[0] || itemEquip > -1) return false; if (vboxSelected.length || itemEquip > -1) return false;
return setInfo(info); return setInfo(info);
} }

View File

@ -256,7 +256,9 @@ class Vbox extends preact.Component {
<button <button
class='vbox-btn' class='vbox-btn'
onMouseOver={e => hoverInfo(e, 'refill')} onMouseOver={e => hoverInfo(e, 'refill')}
disabled={tutorial && tutorial < 7 && instance.time_control === 'Practice' && instance.rounds.length === 1} disabled={vbox.bits < 2
|| tutorial && tutorial < 7 && instance.time_control === 'Practice' && instance.rounds.length === 1
}
onClick={e => e.stopPropagation()} onClick={e => e.stopPropagation()}
onMouseDown={() => sendVboxDiscard()}> onMouseDown={() => sendVboxDiscard()}>
refill - 2b refill - 2b