delete "reclaim" & "vboxHighlight" state variables

This commit is contained in:
Mashy 2019-11-21 11:10:34 +10:00
parent 26c1c49c4e
commit 917858174c
11 changed files with 3 additions and 34 deletions

View File

@ -35,7 +35,6 @@ export const setMtxActive = value => ({ type: 'SET_MTX_ACTIVE', value });
export const setNav = value => ({ type: 'SET_NAV', value });
export const setPing = value => ({ type: 'SET_PING', value });
export const setPlayer = value => ({ type: 'SET_PLAYER', value });
export const setReclaiming = value => ({ type: 'SET_RECLAIMING', value });
export const setShowLog = value => ({ type: 'SET_SHOW_LOG', value });
export const setShop = value => ({ type: 'SET_SHOP', value });
export const setSubscription = value => ({ type: 'SET_SUBSCRIPTION', value });
@ -48,7 +47,6 @@ export const setTeamSelect = value => ({ type: 'SET_TEAM_SELECT', value: Array.f
export const setTutorial = value => ({ type: 'SET_TUTORIAL', value });
export const setTutorialGame = value => ({ type: 'SET_TUTORIAL_GAME', value });
export const setVboxHighlight = value => ({ type: 'SET_VBOX_HIGHLIGHT', value });
export const setVboxSelected = value => ({ type: 'SET_VBOX_SELECTED', value });
export const setWs = value => ({ type: 'SET_WS', value });

View File

@ -33,11 +33,9 @@ const addState = connect(
function accountPage() {
dispatch(actions.setGame(null));
dispatch(actions.setInstance(null));
dispatch(actions.setReclaiming(false));
dispatch(actions.setActiveSkill(null));
dispatch(actions.setInfo(null));
dispatch(actions.setItemUnequip([]));
dispatch(actions.setVboxHighlight([]));
return dispatch(actions.setNav('account'));
}

View File

@ -32,11 +32,9 @@ const addState = connect(
function setNav(place) {
dispatch(actions.setGame(null));
dispatch(actions.setInstance(null));
dispatch(actions.setReclaiming(false));
dispatch(actions.setActiveSkill(null));
dispatch(actions.setInfo(null));
dispatch(actions.setItemUnequip([]));
dispatch(actions.setVboxHighlight([]));
dispatch(actions.setMtxActive(null));
return dispatch(actions.setNav(place));
}

View File

@ -27,9 +27,7 @@ const addState = connect(
function clearItems() {
dispatch(actions.setReclaiming(false));
dispatch(actions.setItemUnequip([]));
dispatch(actions.setVboxHighlight([]));
dispatch(actions.setVboxSelected({ shopSelect: [], stashSelect: [] }));
return true;
}

View File

@ -258,7 +258,6 @@ class InstanceConstructs extends preact.Component {
sendVboxApply,
sendVboxAcceptEquip,
sendVboxUnequipApply,
setVboxHighlight,
setItemUnequip,
} = props;
@ -281,7 +280,6 @@ class InstanceConstructs extends preact.Component {
sendVboxUnequipApply,
setInfo,
itemInfo,
setVboxHighlight,
vboxSelected,
tutorial,
});

View File

@ -33,11 +33,9 @@ const addState = connect(
function setNav(place) {
dispatch(actions.setGame(null));
dispatch(actions.setInstance(null));
dispatch(actions.setReclaiming(false));
dispatch(actions.setActiveSkill(null));
dispatch(actions.setInfo(null));
dispatch(actions.setItemUnequip([]));
dispatch(actions.setVboxHighlight([]));
return dispatch(actions.setNav(place));
}

View File

@ -16,7 +16,6 @@ const addState = connect(
ws,
instance,
player,
reclaiming,
vboxSelected,
itemInfo,
itemUnequip,
@ -47,7 +46,6 @@ const addState = connect(
return {
instance,
player,
reclaiming,
sendVboxAccept,
sendVboxCombine,
sendVboxDiscard,
@ -61,12 +59,6 @@ const addState = connect(
},
function receiveDispatch(dispatch) {
function setReclaiming(v) {
dispatch(actions.setItemUnequip([]));
dispatch(actions.setVboxSelected({ shopSelect: [], stashSelect: [] }));
return dispatch(actions.setReclaiming(v));
}
function setInfo(item) {
return dispatch(actions.setInfo(item));
}
@ -78,7 +70,6 @@ const addState = connect(
}
return {
setReclaiming,
setInfo,
setVboxSelected,
};
@ -119,7 +110,6 @@ class Vbox extends preact.Component {
shouldComponentUpdate(newProps) {
// Single variable props
if (newProps.itemUnequip !== this.props.itemUnequip) return true;
if (newProps.reclaiming !== this.props.reclaiming) return true;
if (newProps.tutorial !== this.props.tutorial) return true;
if (newProps.vboxSelected !== this.props.vboxSelected) return true;
if (newProps.player !== this.props.player) return true;
@ -132,7 +122,6 @@ class Vbox extends preact.Component {
// Changing state variables
itemUnequip,
player,
reclaiming,
tutorial,
vboxSelected,
instance,
@ -147,7 +136,6 @@ class Vbox extends preact.Component {
sendVboxReclaim,
setVboxSelected,
setInfo,
setReclaiming,
} = args;
if (!player) return false;
@ -418,7 +406,7 @@ class Vbox extends preact.Component {
const tutorialDisabled = tutorial && tutorial < 8 && instance.time_control === 'Practice' && instance.rounds.length === 1;
return (
<div class={`stash-hdr ${reclaiming ? 'reclaiming' : ''}`}>
<div class={'stash-hdr'}>
<div class='items'>
<h3
onTouchStart={e => e.target.scrollIntoView(true)}
@ -426,8 +414,7 @@ class Vbox extends preact.Component {
</h3>
<button
disabled={tutorialDisabled || !refund}
class='vbox-btn reclaim'
onMouseOver={e => hoverInfo(e, 'reclaim')}
class='vbox-btn'
onClick={e => e.stopPropagation()}
onMouseDown={e => {
e.stopPropagation();

View File

@ -179,11 +179,9 @@ function registerEvents(store) {
}
function clearInstance() {
store.dispatch(actions.setReclaiming(false));
store.dispatch(actions.setActiveSkill(null));
store.dispatch(actions.setInfo(null));
store.dispatch(actions.setItemUnequip([]));
store.dispatch(actions.setVboxHighlight([]));
store.dispatch(actions.setVboxSelected({ shopSelect: [], stashSelect: [] }));
}

View File

@ -6,11 +6,9 @@ function setupKeys(store) {
key.unbind('esc');
key('esc', () => document.activeElement.blur());
key('esc', () => store.dispatch(actions.setReclaiming(false)));
key('esc', () => store.dispatch(actions.setActiveSkill(null)));
key('esc', () => store.dispatch(actions.setInfo(null)));
key('esc', () => store.dispatch(actions.setItemUnequip([])));
key('esc', () => store.dispatch(actions.setVboxHighlight([])));
key('esc', () => store.dispatch(actions.setVboxSelected({ shopSelect: [], stashSelect: [] })));
key('esc', () => store.dispatch(actions.setMtxActive(null)));
}

View File

@ -44,7 +44,6 @@ module.exports = {
nav: createReducer(null, 'SET_NAV'),
ping: createReducer(null, 'SET_PING'),
player: createReducer(null, 'SET_PLAYER'),
reclaiming: createReducer(false, 'SET_RECLAIMING'),
shop: createReducer(false, 'SET_SHOP'),
pvp: createReducer(null, 'SET_PVP'),

View File

@ -205,8 +205,7 @@ function tutorialStage(tutorial, ws, clearTutorial, instance) {
<div class='info-item'>
<h2>Tutorial</h2>
<p>You've completed the tutorial! Try to create more skill and spec combinations. </p>
<p>You can unequip skills and specs back into the inventory by double clicking. <br />
Reclaim can be used to refund the cost of items in your inventory. </p>
<p>Skills and specs can also be unequiped back into the stash. </p>
</div>
);
}