SIX size stash

This commit is contained in:
ntr
2019-11-22 16:26:43 +11:00
parent d4f2f9623f
commit 2d3c6cd18c
6 changed files with 41 additions and 37 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ function combinerBtn(props) {
let bits = 0;
storeSelect.forEach(item => bits += item[0] + 1);
text = bits
? `Buy ${comboItem} - ${bits}b`
? `${comboItem} - ${bits}b`
: `Combine - ${comboItem}`;
if (vbox.bits >= bits) mouseEvent = sendVboxCombine;
} else if (stashSelect.length === 0 && storeSelect.length === 1) {
+19 -22
View File
@@ -201,33 +201,31 @@ class Vbox extends preact.Component {
}
function stashHdr() {
return (
<div class='stash-hdr'>
<h3 onTouchStart={e => e.target.scrollIntoView(true)}
onMouseOver={e => vboxHover(e, 'stash')}> STASH
</h3>
</div>
);
}
function refundBtn() {
const refund = storeSelect.length === 0 && stashSelect.length === 1
? itemInfo.items.find(i => i.item === vbox.bound[stashSelect[0]]).cost
: 0;
const tutorialDisabled = tutorial && tutorial < 8
&& instance.time_control === 'Practice' && instance.rounds.length === 1;
const refundBtn = (
<button
disabled={tutorialDisabled || !refund}
class='vbox-btn'
onClick={e => e.stopPropagation()}
onMouseDown={e => {
e.stopPropagation();
sendVboxReclaim(vboxSelected.stashSelect[0]);
}}>
refund <br />
{refund}b
</button>
);
return (
<div class='refund'>
<button
disabled={tutorialDisabled || !refund}
class='vbox-btn'
onClick={e => e.stopPropagation()}
onMouseDown={e => {
e.stopPropagation();
sendVboxReclaim(vboxSelected.stashSelect[0]);
}}>
refund <br />
{refund}b
</button>
<div class='stash-hdr'>
<h3 onTouchStart={e => e.target.scrollIntoView(true)}
onMouseOver={e => vboxHover(e, 'stash')}> STASH
</h3>
{refundBtn}
</div>
);
}
@@ -237,7 +235,6 @@ class Vbox extends preact.Component {
<div class='vbox'>
{storeHdr()}
{stashHdr()}
{refundBtn()}
<StoreElement
clearVboxSelected = {clearVboxSelected}
setInfo = {setInfo}
+1 -1
View File
@@ -99,7 +99,7 @@ function stashElement(props) {
onDragOver={ev => ev.preventDefault()}
onDrop={stashClick}
>
{range(0, 4).map(i => stashBtn(vbox.bound[i], i))}
{range(0, 6).map(i => stashBtn(vbox.bound[i], i))}
</div>
);
}