diff --git a/client/src/components/info.component.jsx b/client/src/components/info.component.jsx index 08f70c78..265657a3 100644 --- a/client/src/components/info.component.jsx +++ b/client/src/components/info.component.jsx @@ -10,6 +10,7 @@ function Info(args) { info, sendUnequip, instance, + setInfo, } = args; function infoVar([type, value]) { @@ -87,10 +88,17 @@ function Info(args) { function infoCrypElement(cryp) { // onClick={() => setInfo('skill', { skill: s, cryp })} const skills = range(0, 4).map(i => { + const skill = cryp.skills[i]; + + function skillClick() { + if (!skill) return false; + return setInfo('skill', { skill: skill.skill, cryp }); + } + const s = cryp.skills[i] ? cryp.skills[i].skill : ( ); - return ; + return ; }); const stats = Object.values(STATS).map((s, j) => ( @@ -100,12 +108,18 @@ function Info(args) { )); - const specs = cryp.specs.map((s, i) => ( -
- {SPECS[s].svg(`stat-icon ${SPECS[s].colour}`)} -
{SPECS[s].caption}
-
- )); + const specs = cryp.specs.map((s, i) => { + function specClick() { + setInfo('spec', { spec: s, cryp }); + } + + return ( +
+ {SPECS[s].svg(`stat-icon ${SPECS[s].colour}`)} +
{SPECS[s].caption}
+
+ ); + }); return ( diff --git a/client/src/components/info.container.jsx b/client/src/components/info.container.jsx index 1b098e82..b4cd2779 100644 --- a/client/src/components/info.container.jsx +++ b/client/src/components/info.container.jsx @@ -1,7 +1,6 @@ const { connect } = require('preact-redux'); -// const actions = require('../actions'); - +const actions = require('../actions'); const Info = require('./info.component'); const addState = connect( @@ -23,13 +22,24 @@ const addState = connect( sendUnequip, instance, }; - } -/* - function receiveDispatch(dispatch) { + }, - return { }; + function receiveDispatch(dispatch) { + function setInfo(item, value) { + dispatch(actions.setInfo([item, value])); + } + + function setActiveVar(value) { + dispatch(actions.setActiveVar(value)); + } + + + return { + setInfo, + setActiveVar, + }; } -*/ + ); module.exports = addState(Info); diff --git a/client/src/components/instance.component.jsx b/client/src/components/instance.component.jsx index fbca776e..40e927c3 100644 --- a/client/src/components/instance.component.jsx +++ b/client/src/components/instance.component.jsx @@ -25,7 +25,7 @@ function Cryp(props) { function skillClick() { if (!skill) return false; - setInfo('skill', { skill, cryp }); + setInfo('skill', { skill: skill.skill, cryp }); return setActiveCryp(cryp); }