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

View File

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

View File

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

View File

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