info updates
This commit is contained in:
parent
33b519ed66
commit
6213bdf421
@ -399,41 +399,50 @@ header {
|
|||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
INFO
|
||||||
|
*/
|
||||||
.thresholds {
|
.thresholds {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: left;
|
justify-content: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-skills {
|
.info-cryp .skills {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-skills .cryp-skill-btn {
|
.info-cryp .skills .cryp-skill-btn {
|
||||||
border: 1px solid whitesmoke;
|
border: 1px solid whitesmoke;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-stats {
|
.info-cryp .stats, .info-cryp .specs {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row wrap;
|
flex-flow: row wrap;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-stats .speed {
|
.info-cryp .stats .speed {
|
||||||
flex: 1 0 100%;
|
flex: 1 0 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-stats figure {
|
.info-cryp .stats figure {
|
||||||
flex: 0 0 30%;
|
flex: 0 0 30%;
|
||||||
border: 0;
|
border: 0;
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-stats .stat-icon {
|
.info-cryp .stats .stat-icon {
|
||||||
height: 2.5em;
|
height: 2.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.info-cryp .specs figure {
|
||||||
|
border: 0;
|
||||||
|
margin: 1em 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* CRYP BOX */
|
/* CRYP BOX */
|
||||||
.cryp-box {
|
.cryp-box {
|
||||||
@ -504,7 +513,7 @@ header {
|
|||||||
border-right-width: 0px;
|
border-right-width: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.skills .cryp-skill-btn:first-child {
|
.cryp-list .skills .cryp-skill-btn:first-child {
|
||||||
border-top-width: 0;
|
border-top-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,7 +710,7 @@ header {
|
|||||||
height: 1em;
|
height: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stats figcaption {
|
.cryp-list .stats figcaption {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,18 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
const range = require('lodash/range');
|
const range = require('lodash/range');
|
||||||
|
|
||||||
const { ITEMS: { SKILLS, SPECS, COLOURS } } = require('./constants');
|
const { ITEMS: { SKILLS, COLOURS } } = require('./constants');
|
||||||
const { COLOUR_ICONS, STATS } = require('../utils');
|
const { COLOUR_ICONS, STATS, SPECS } = require('../utils');
|
||||||
|
|
||||||
function Info(args) {
|
function Info(args) {
|
||||||
const {
|
const {
|
||||||
|
activeCryp,
|
||||||
info,
|
info,
|
||||||
sendUnequip,
|
sendUnequip,
|
||||||
instance,
|
instance,
|
||||||
} = args;
|
} = args;
|
||||||
if (!info.length) return (<div className="instance-info"> </div>);
|
|
||||||
|
function infoVar(info) {
|
||||||
let red = 0; let blue = 0; let green = 0;
|
let red = 0; let blue = 0; let green = 0;
|
||||||
instance.cryps.forEach(cryp => {
|
instance.cryps.forEach(cryp => {
|
||||||
red += cryp.colours.red;
|
red += cryp.colours.red;
|
||||||
@ -29,7 +31,7 @@ function Info(args) {
|
|||||||
itemDetails = COLOURS[value];
|
itemDetails = COLOURS[value];
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="instance-info">
|
<div className="info-var">
|
||||||
{value} - {itemDetails.description}
|
{value} - {itemDetails.description}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -37,15 +39,13 @@ function Info(args) {
|
|||||||
|
|
||||||
if (type === 'skill') {
|
if (type === 'skill') {
|
||||||
return (
|
return (
|
||||||
<div className="instance-info">
|
<div className="info-skill">
|
||||||
<div>
|
|
||||||
<div> {value.skill} </div>
|
<div> {value.skill} </div>
|
||||||
<div> {SKILLS[value.skill].description} </div>
|
<div> {SKILLS[value.skill].description} </div>
|
||||||
<button onClick={() => sendUnequip(value.cryp.id, value.skill)}>
|
<button onClick={() => sendUnequip(value.cryp.id, value.skill)}>
|
||||||
unequip
|
unequip
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ function Info(args) {
|
|||||||
);
|
);
|
||||||
}) : null;
|
}) : null;
|
||||||
return (
|
return (
|
||||||
<div className="instance-info">
|
<div className="info-spec">
|
||||||
<div>
|
<div>
|
||||||
<div> {value.spec} </div>
|
<div> {value.spec} </div>
|
||||||
<div> {SPECS[value.spec].description} </div>
|
<div> {SPECS[value.spec].description} </div>
|
||||||
@ -83,11 +83,10 @@ function Info(args) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (type === 'cryp') {
|
function infoCrypElement(cryp) {
|
||||||
const cryp = value;
|
// onClick={() => setInfo('skill', { skill: s, cryp })}
|
||||||
|
|
||||||
// onClick={() => setInfo('skill', { skill: s, cryp })}
|
|
||||||
const skills = range(0, 4).map(i => {
|
const skills = range(0, 4).map(i => {
|
||||||
const s = cryp.skills[i]
|
const s = cryp.skills[i]
|
||||||
? cryp.skills[i].skill
|
? cryp.skills[i].skill
|
||||||
@ -101,18 +100,45 @@ function Info(args) {
|
|||||||
<figcaption>{cryp[s.stat].value}</figcaption>
|
<figcaption>{cryp[s.stat].value}</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
));
|
));
|
||||||
|
|
||||||
|
const specs = cryp.specs.map((s, i) => (
|
||||||
|
<figure key={i}>
|
||||||
|
{SPECS[s].svg(`stat-icon ${SPECS[s].colour}`)}
|
||||||
|
<figcaption>{SPECS[s].caption}</figcaption>
|
||||||
|
</figure>
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="instance-info">
|
<div className="info-cryp">
|
||||||
<h5>{cryp.name}</h5>
|
<h5>{cryp.name}</h5>
|
||||||
<div className="info-skills">
|
<div className="stats">
|
||||||
{skills}
|
|
||||||
</div>
|
|
||||||
<div className="info-stats">
|
|
||||||
{stats}
|
{stats}
|
||||||
</div>
|
</div>
|
||||||
|
<div className="specs">
|
||||||
|
{specs}
|
||||||
|
</div>
|
||||||
|
<div className="skills">
|
||||||
|
{skills}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const infoCryp = activeCryp
|
||||||
|
? infoCrypElement(activeCryp)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const otherInfo = info.length
|
||||||
|
? infoVar(info)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="instance-info">
|
||||||
|
{infoCryp}
|
||||||
|
{otherInfo}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Info;
|
module.exports = Info;
|
||||||
|
|||||||
@ -6,12 +6,23 @@ const Info = require('./info.component');
|
|||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const { info, ws, instance } = state;
|
const {
|
||||||
|
activeCryp,
|
||||||
|
info,
|
||||||
|
ws,
|
||||||
|
instance,
|
||||||
|
} = state;
|
||||||
|
|
||||||
function sendUnequip(crypId, item) {
|
function sendUnequip(crypId, item) {
|
||||||
return ws.sendVboxUnequip(instance.instance, crypId, item);
|
return ws.sendVboxUnequip(instance.instance, crypId, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { info, sendUnequip, instance };
|
return {
|
||||||
|
activeCryp,
|
||||||
|
info,
|
||||||
|
sendUnequip,
|
||||||
|
instance,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
function receiveDispatch(dispatch) {
|
function receiveDispatch(dispatch) {
|
||||||
|
|||||||
@ -6,15 +6,28 @@ const VboxContainer = require('./vbox.container');
|
|||||||
const InfoContainer = require('./info.container');
|
const InfoContainer = require('./info.container');
|
||||||
const molecule = require('./molecule');
|
const molecule = require('./molecule');
|
||||||
|
|
||||||
const shapes = require('./shapes');
|
const { SPECS } = require('../utils');
|
||||||
const { STATS, SPECS } = require('../utils');
|
|
||||||
|
function Cryp(props) {
|
||||||
|
const {
|
||||||
|
cryp,
|
||||||
|
sendVboxApply,
|
||||||
|
setInfo,
|
||||||
|
activeVar,
|
||||||
|
setActiveCryp,
|
||||||
|
} = props;
|
||||||
|
|
||||||
function Cryp(cryp, sendVboxApply, setInfo, activeVar) {
|
|
||||||
const skills = range(0, 4).map(i => {
|
const skills = range(0, 4).map(i => {
|
||||||
const s = cryp.skills[i]
|
const s = cryp.skills[i]
|
||||||
? cryp.skills[i].skill
|
? cryp.skills[i].skill
|
||||||
: (<span> </span>);
|
: (<span> </span>);
|
||||||
return <button key={i} className="cryp-skill-btn right" onClick={() => setInfo('skill', { skill: s, cryp })}>{s}</button>;
|
|
||||||
|
function skillClick() {
|
||||||
|
setInfo('skill', { skill: s, cryp });
|
||||||
|
setActiveCryp(cryp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return <button key={i} className="cryp-skill-btn right" onClick={skillClick} >{s}</button>;
|
||||||
});
|
});
|
||||||
|
|
||||||
// needed for ondrop to fire
|
// needed for ondrop to fire
|
||||||
@ -35,9 +48,7 @@ function Cryp(cryp, sendVboxApply, setInfo, activeVar) {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (activeVar !== null) return sendVboxApply(cryp.id, activeVar);
|
if (activeVar !== null) return sendVboxApply(cryp.id, activeVar);
|
||||||
document.getElementsByClassName('instance-info')[0].scrollIntoView();
|
return setActiveCryp(cryp);
|
||||||
|
|
||||||
return setInfo('cryp', cryp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const specs = cryp.specs.map((s, i) => (
|
const specs = cryp.specs.map((s, i) => (
|
||||||
@ -75,19 +86,27 @@ function InstanceComponent(args) {
|
|||||||
// account,
|
// account,
|
||||||
instance,
|
instance,
|
||||||
quit,
|
quit,
|
||||||
|
// clearInfo,
|
||||||
sendInstanceReady,
|
sendInstanceReady,
|
||||||
sendVboxApply,
|
sendVboxApply,
|
||||||
setInfo,
|
setInfo,
|
||||||
activeVar,
|
activeVar,
|
||||||
setActiveVar,
|
setActiveVar,
|
||||||
|
setActiveCryp,
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
if (!instance) return <div>...</div>;
|
if (!instance) return <div>...</div>;
|
||||||
|
|
||||||
const cryps = instance.cryps.map((c, i) => Cryp(c, sendVboxApply, setInfo, activeVar));
|
const cryps = instance.cryps.map((c, i) => Cryp({
|
||||||
|
cryp: c, sendVboxApply, setInfo, activeVar, setActiveCryp,
|
||||||
|
}));
|
||||||
|
|
||||||
|
function onClick(e) {
|
||||||
|
setActiveVar(null);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="instance" onClick={() => setActiveVar(null)} >
|
<main className="instance" onClick={onClick} >
|
||||||
<div className="instance-hdr">
|
<div className="instance-hdr">
|
||||||
<button
|
<button
|
||||||
className="instance-btn instance-ui-btn menu-btn left"
|
className="instance-btn instance-ui-btn menu-btn left"
|
||||||
|
|||||||
@ -19,7 +19,7 @@ const addState = connect(
|
|||||||
return { instance, account, sendInstanceReady, sendVboxApply, activeVar };
|
return { instance, account, sendInstanceReady, sendVboxApply, activeVar };
|
||||||
},
|
},
|
||||||
|
|
||||||
function receiveDispatch(dispatch, { instance, combiner }) {
|
function receiveDispatch(dispatch) {
|
||||||
function quit() {
|
function quit() {
|
||||||
dispatch(actions.setInstance(null));
|
dispatch(actions.setInstance(null));
|
||||||
}
|
}
|
||||||
@ -32,7 +32,15 @@ const addState = connect(
|
|||||||
dispatch(actions.setActiveVar(value));
|
dispatch(actions.setActiveVar(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return { quit, setInfo, setActiveVar };
|
function setActiveCryp(value) {
|
||||||
|
dispatch(actions.setActiveCryp(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearInfo() {
|
||||||
|
return dispatch(actions.setInfo([]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return { quit, clearInfo, setInfo, setActiveVar, setActiveCryp };
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,7 +6,7 @@ const Vbox = require('./vbox.component');
|
|||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const { ws, instance, combiner, reclaiming, activeVar } = state;
|
const { ws, instance, combiner, reclaiming, activeVar, info } = state;
|
||||||
|
|
||||||
function sendVboxDiscard() {
|
function sendVboxDiscard() {
|
||||||
return ws.sendVboxDiscard(instance.instance);
|
return ws.sendVboxDiscard(instance.instance);
|
||||||
@ -29,6 +29,7 @@ const addState = connect(
|
|||||||
combiner,
|
combiner,
|
||||||
reclaiming,
|
reclaiming,
|
||||||
activeVar,
|
activeVar,
|
||||||
|
info,
|
||||||
sendVboxAccept,
|
sendVboxAccept,
|
||||||
sendVboxDiscard,
|
sendVboxDiscard,
|
||||||
sendVboxReclaim,
|
sendVboxReclaim,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user