From cfc1c1ea81f495fb186d8092fb4f507e63d82e3f Mon Sep 17 00:00:00 2001 From: Mashy Date: Mon, 28 Oct 2019 19:08:01 +1000 Subject: [PATCH] cleanup old files --- client/src/components/instance.component.jsx | 6 +- client/src/components/instance.equip.jsx | 144 ------------------- client/src/components/particles.config.js | 41 ------ 3 files changed, 5 insertions(+), 186 deletions(-) delete mode 100644 client/src/components/instance.equip.jsx delete mode 100644 client/src/components/particles.config.js diff --git a/client/src/components/instance.component.jsx b/client/src/components/instance.component.jsx index 76291079..d4953550 100644 --- a/client/src/components/instance.component.jsx +++ b/client/src/components/instance.component.jsx @@ -7,7 +7,6 @@ const Hammer = require('hammerjs'); const Vbox = require('./vbox.component'); const InfoContainer = require('./info.container'); const InstanceConstructsContainer = require('./instance.constructs'); -// const EquipmentContainer = require('./instance.equip'); const Faceoff = require('./faceoff'); const actions = require('../actions'); @@ -53,6 +52,11 @@ const addState = connect( ); class Instance extends Component { + componentShouldUpdate(newProps) { + if (newProps.instance !== this.props.instance) return true; + return false; + } + render(args) { const { instance, diff --git a/client/src/components/instance.equip.jsx b/client/src/components/instance.equip.jsx deleted file mode 100644 index ef4ac2e3..00000000 --- a/client/src/components/instance.equip.jsx +++ /dev/null @@ -1,144 +0,0 @@ -const { connect } = require('preact-redux'); -const preact = require('preact'); -const range = require('lodash/range'); - -const actions = require('../actions'); -const shapes = require('./shapes'); -const { convertItem } = require('./../utils'); - -const addState = connect( - function receiveState(state) { - const { account, activeConstruct, itemInfo, info, ws, instance, player, itemUnequip } = state; - - function sendUnequip(constructId, item) { - return ws.sendVboxUnequip(instance.id, constructId, item); - } - - return { player, itemInfo, instance, info, sendUnequip, activeConstruct, itemUnequip }; - }, - - function receiveDispatch(dispatch) { - function setInfo(item) { - dispatch(actions.setInfo(item)); - } - - function clearInfo() { - return dispatch(actions.setInfo(null)); - } - - function setItemEquip(v) { - return dispatch(actions.setItemEquip(v)); - } - - function setItemUnequip(v) { - return dispatch(actions.setItemUnequip(v)); - } - - return { setInfo, setItemEquip, setItemUnequip, clearInfo }; - } - -); - -function Equipment(props) { - const { - player, - instance, - - itemUnequip, - setItemEquip, - setItemUnequip, - activeConstruct, - - itemInfo, - sendUnequip, - - setInfo, - } = props; - - if (instance.phase === 'Lobby') return false; - - const { vbox } = player; - - const fullInfo = itemInfo.items.find(i => i.item === itemUnequip); - const isSkill = fullInfo && fullInfo.skill; - const isSpec = fullInfo && fullInfo.spec; - - function skillClick(e, i) { - if (itemUnequip && activeConstruct) return false; - // const value = vbox.bound[i]; - setItemEquip(i); - return false; - } - - function unequipClick(e) { - e.stopPropagation(); - if (!itemUnequip) return false; - if (!activeConstruct) return false; - setItemUnequip([]); - return sendUnequip(activeConstruct.id, itemUnequip); - } - - function hoverInfo(e, info) { - e.stopPropagation(); - return setInfo(info); - } - - const skillClass = isSkill ? 'skills highlight' : 'skills'; - const specClass = isSpec ? 'specs highlight' : 'specs'; - - const skills = range(0, 9).map(i => { - const item = convertItem(vbox.bound[i]); - const skillInfo = itemInfo.items.find(i => i.item === item); - if (skillInfo && skillInfo.skill) { - return ( - - ); - } - return false; - }); - - const specs = range(0, 9).map(i => { - const item = convertItem(vbox.bound[i]); - const specInfo = itemInfo.items.find(i => i.item === item); - if (specInfo && specInfo.spec) { - return ( -
skillClick(e, i)} onMouseOver={e => hoverInfo(e, item)} > - {shapes[item]()} -
{item ? item : '-'}
-
- ); - } - return false; - }); - - if (skills.every(s => !s)) skills.push(); - if (specs.every(s => !s)) { - specs.push( -
- {shapes.diamond('gray')} -
 
-
- ); - } - - return ( -
-
unequipClick(e)} onMouseOver={e => hoverInfo(e, 'equipSkills')} > -

Skills

-
- {skills} -
-
-
unequipClick(e)} onMouseOver={e => hoverInfo(e, 'equipSpecs')} > -

Specs

-
- {specs} -
-
-
- ); -} - -module.exports = addState(Equipment); diff --git a/client/src/components/particles.config.js b/client/src/components/particles.config.js deleted file mode 100644 index 651cae39..00000000 --- a/client/src/components/particles.config.js +++ /dev/null @@ -1,41 +0,0 @@ -const config = { - particles: { - number: { value: 300, density: { enable: true, value_area: 800 } }, - color: { value: '#ffffff' }, - shape: { - type: 'circle', - stroke: { width: 0, color: '#000000' }, - polygon: { nb_sides: 5 }, - image: { src: 'img/github.svg', width: 100, height: 100 } - }, - opacity: { - value: 0.5, - random: false, - anim: { enable: false, speed: 1, opacity_min: 0.1, sync: false }, - }, - size: { - value: 3, - random: true, - anim: { enable: false, speed: 40, size_min: 0.1, sync: false }, - }, - line_linked: { - enable: true, - distance: 150, - color: '#ffffff', - opacity: 0.4, - width: 1, - }, - move: { - enable: true, - speed: 6, - direction: 'none', - random: false, - straight: false, - out_mode: 'out', - bounce: false, - attract: { enable: false, rotateX: 600, rotateY: 1200 }, - }, - }, -}; - -module.exports = config;