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 setNav = value => ({ type: 'SET_NAV', value });
export const setPing = value => ({ type: 'SET_PING', value }); export const setPing = value => ({ type: 'SET_PING', value });
export const setPlayer = value => ({ type: 'SET_PLAYER', 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 setShowLog = value => ({ type: 'SET_SHOW_LOG', value });
export const setShop = value => ({ type: 'SET_SHOP', value }); export const setShop = value => ({ type: 'SET_SHOP', value });
export const setSubscription = value => ({ type: 'SET_SUBSCRIPTION', 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 setTutorial = value => ({ type: 'SET_TUTORIAL', value });
export const setTutorialGame = value => ({ type: 'SET_TUTORIAL_GAME', 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 setVboxSelected = value => ({ type: 'SET_VBOX_SELECTED', value });
export const setWs = value => ({ type: 'SET_WS', value }); export const setWs = value => ({ type: 'SET_WS', value });

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,11 +6,9 @@ function setupKeys(store) {
key.unbind('esc'); key.unbind('esc');
key('esc', () => document.activeElement.blur()); key('esc', () => document.activeElement.blur());
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.setInfo(null))); key('esc', () => store.dispatch(actions.setInfo(null)));
key('esc', () => store.dispatch(actions.setItemUnequip([]))); 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.setVboxSelected({ shopSelect: [], stashSelect: [] })));
key('esc', () => store.dispatch(actions.setMtxActive(null))); key('esc', () => store.dispatch(actions.setMtxActive(null)));
} }

View File

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

View File

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