render cryp info from instance object, clear obj info on cryp click
This commit is contained in:
parent
c597dc63a1
commit
b98004755d
@ -98,7 +98,7 @@ function Info(args) {
|
|||||||
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" onClick={skillClick} >{s}</button>;
|
return <button key={i} alt={s} className="cryp-skill-btn" onClick={skillClick} >{s}</button>;
|
||||||
});
|
});
|
||||||
|
|
||||||
const stats = Object.values(STATS).map((s, j) => (
|
const stats = Object.values(STATS).map((s, j) => (
|
||||||
@ -139,7 +139,7 @@ function Info(args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const infoCryp = activeCryp
|
const infoCryp = activeCryp
|
||||||
? infoCrypElement(activeCryp)
|
? infoCrypElement(instance.cryps.find(c => c.id === activeCryp.id))
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const otherInfo = info.length
|
const otherInfo = info.length
|
||||||
|
|||||||
@ -51,6 +51,7 @@ function Cryp(props) {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (activeVar !== null) return sendVboxApply(cryp.id, activeVar);
|
if (activeVar !== null) return sendVboxApply(cryp.id, activeVar);
|
||||||
|
setInfo(null);
|
||||||
return setActiveCryp(cryp);
|
return setActiveCryp(cryp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +74,13 @@ function Cryp(props) {
|
|||||||
return Math.floor(c / cTotal * 255);
|
return Math.floor(c / cTotal * 255);
|
||||||
});
|
});
|
||||||
const alpha = cTotal === 0 ? 1 : 0.75;
|
const alpha = cTotal === 0 ? 1 : 0.75;
|
||||||
const border = { border: `1px solid rgba(${colours.red}, ${colours.green}, ${colours.blue}, ${alpha})` };
|
const thickness = total => {
|
||||||
|
if (total < 3) return 1;
|
||||||
|
if (total < 6) return 2;
|
||||||
|
if (total < 9) return 3;
|
||||||
|
return 4;
|
||||||
|
};
|
||||||
|
const border = { border: `${thickness(cTotal)}px solid rgba(${colours.red}, ${colours.green}, ${colours.blue}, ${alpha})` };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user