fix boolean 0 check bullshit

This commit is contained in:
ntr 2019-07-20 22:44:36 +10:00
parent c69182b94e
commit 4ab8e99f1d
4 changed files with 9 additions and 10 deletions

View File

@ -240,7 +240,7 @@ function Vbox(args) {
const reclaimClass = `vbox-btn reclaim ${reclaiming ? 'reclaiming' : ''}`;
function inventoryBtn(v, i) {
if (!v) return <button disabled class='empty' >&nbsp;</button>;
if (!v && v !== 0) return <button disabled class='empty' >&nbsp;</button>;
function onClick(e) {
if (reclaiming) return sendVboxReclaim(i);
@ -279,25 +279,24 @@ function Vbox(args) {
}
function combinerBtn() {
const dots = combiner.filter(v => v).length;
let text = '';
if (dots < 3) {
if (combiner.length < 3) {
for (let i = 0; i < 3; i++) {
if (dots > i) {
if (combiner.length > i) {
text += '■ ';
} else {
text += '▫ ';
}
}
} else {
text = 'combine'
text = 'combine';
}
return (
<button
class='vbox-btn'
disabled={dots !== 3}
disabled={combiner.length !== 3}
onMouseOver={e => hoverInfo(e, 'refine')}
onClick={() => sendVboxCombine()}>
{text}

View File

@ -113,7 +113,7 @@ function registerEvents(store) {
function clearCombiner() {
store.dispatch(actions.setInfo([]));
store.dispatch(actions.setCombiner([null, null, null]));
store.dispatch(actions.setCombiner([]));
}
function clearConstructRename() {
@ -139,7 +139,7 @@ function registerEvents(store) {
}
function clearInstance() {
store.dispatch(actions.setCombiner([null, null, null]));
store.dispatch(actions.setCombiner([]));
store.dispatch(actions.setReclaiming(false));
store.dispatch(actions.setActiveSkill(null));
store.dispatch(actions.setActiveConstruct(null));

View File

@ -4,7 +4,7 @@ const actions = require('./actions');
function setupKeys(store) {
console.log('binding keys');
key.unbind('esc');
key('esc', () => store.dispatch(actions.setCombiner([null, null, null])));
key('esc', () => store.dispatch(actions.setCombiner([])));
key('esc', () => store.dispatch(actions.setReclaiming(false)));
key('esc', () => store.dispatch(actions.setActiveSkill(null)));
key('esc', () => store.dispatch(actions.setActiveConstruct(null)));

View File

@ -21,7 +21,7 @@ module.exports = {
animTarget: createReducer(null, 'SET_ANIM_TARGET'),
animText: createReducer(null, 'SET_ANIM_TEXT'),
combiner: createReducer([null, null, null], 'SET_COMBINER'),
combiner: createReducer([], 'SET_COMBINER'),
constructs: createReducer([], 'SET_CONSTRUCTS'),
constructEditId: createReducer(null, 'SET_CONSTRUCT_EDIT_ID'),
constructRename: createReducer(null, 'SET_CONSTRUCT_RENAME'),