Merge branch 'return-of-react' of ssh://cryps.gg:40022/~/cryps into return-of-react
This commit is contained in:
@@ -1,7 +1,49 @@
|
||||
const preact = require('preact');
|
||||
// const key = require('keymaster');
|
||||
const range = require('lodash/range');
|
||||
|
||||
const VboxContainer = require('./vbox.container');
|
||||
const molecule = require('./molecule');
|
||||
const saw = require('./saw.component');
|
||||
|
||||
function Cryp(cryp) {
|
||||
const skills = range(0, 4).map((i) => {
|
||||
const s = cryp.skills[i]
|
||||
? cryp.skills[i].skill
|
||||
: (<span> </span>);
|
||||
|
||||
return <button key={i} className="cryp-skill-btn" >{s}</button>;
|
||||
});
|
||||
|
||||
const stats = [
|
||||
{ stat: 'hp', colour: '#1FF01F' },
|
||||
{ stat: 'green_damage', colour: '#1FF01F' },
|
||||
{ stat: 'red_shield', colour: '#a52a2a' },
|
||||
{ stat: 'red_damage', colour: '#a52a2a' },
|
||||
{ stat: 'blue_shield', colour: '#3498db' },
|
||||
{ stat: 'blue_damage', colour: '#3498db' },
|
||||
{ stat: 'speed', colour: '#FFD123' },
|
||||
].map((s, i) => (
|
||||
<figure key={i} >
|
||||
{saw(s.colour)}
|
||||
<figcaption>{cryp[s.stat].value}</figcaption>
|
||||
</figure>
|
||||
));
|
||||
|
||||
return (
|
||||
<div className="cryp-box">
|
||||
<figure className="img">
|
||||
{molecule}
|
||||
</figure>
|
||||
<div className="skills">
|
||||
{skills}
|
||||
</div>
|
||||
<div className="stats">
|
||||
{stats}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function InstanceComponent(args) {
|
||||
const {
|
||||
@@ -13,6 +55,8 @@ function InstanceComponent(args) {
|
||||
|
||||
if (!instance) return <div>...</div>;
|
||||
|
||||
const cryps = instance.cryps.map(Cryp);
|
||||
|
||||
return (
|
||||
<section>
|
||||
<div className="row">
|
||||
@@ -24,7 +68,7 @@ function InstanceComponent(args) {
|
||||
</button>
|
||||
</div>
|
||||
<div className="six columns">
|
||||
<h4>next game against: mmmmmashy</h4>
|
||||
<div> </div>
|
||||
</div>
|
||||
<div className="three columns">
|
||||
<button
|
||||
@@ -37,7 +81,7 @@ function InstanceComponent(args) {
|
||||
<div className="row">
|
||||
<VboxContainer />
|
||||
<div className="three columns">
|
||||
{JSON.stringify(instance.cryps)}
|
||||
{cryps}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
const preact = require('preact');
|
||||
// const key = require('keymaster');
|
||||
|
||||
function Vbox(args) {
|
||||
const {
|
||||
instance,
|
||||
combiner,
|
||||
sendVboxAccept,
|
||||
sendVboxDiscard,
|
||||
sendVboxReclaim,
|
||||
sendVboxCombine,
|
||||
} = args;
|
||||
|
||||
const { cryps } = instance;
|
||||
|
||||
return (
|
||||
<div className="three columns">
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = Vbox;
|
||||
@@ -1,14 +1,13 @@
|
||||
// eslint-disable-next-line
|
||||
const preact = require('preact');
|
||||
|
||||
const saw = require('./saw.component');
|
||||
|
||||
function renderLogin({ account, submitLogin, submitRegister }) {
|
||||
if (account) return (
|
||||
<div className="header-status">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" className="ping-svg">
|
||||
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
|
||||
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
|
||||
</svg>
|
||||
<h3 className="header-username">{account.name}</h3>
|
||||
{saw('whitesmoke')}
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
|
||||
const preact = require('preact');
|
||||
|
||||
module.exports = function saw(colour) {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" style={{ stroke: colour }}>
|
||||
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
|
||||
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -71,7 +71,10 @@ function Vbox(args) {
|
||||
|
||||
return (
|
||||
<div className="three columns">
|
||||
<h3>vBox - {vbox.bits}b</h3>
|
||||
<div className="vbox-hdr">
|
||||
<div>VBOX</div>
|
||||
<h3>{vbox.bits}b</h3>
|
||||
</div>
|
||||
<button
|
||||
className="instance-btn instance-ui-btn vbox-btn"
|
||||
onClick={() => sendVboxDiscard()}>
|
||||
@@ -93,7 +96,7 @@ function Vbox(args) {
|
||||
{boundRows}
|
||||
</tbody>
|
||||
</table>
|
||||
<span>iCombinator</span>
|
||||
<span>I-COMBINATOR</span>
|
||||
<button
|
||||
className="instance-btn instance-ui-btn vbox-btn"
|
||||
onClick={() => sendVboxCombine()}>
|
||||
|
||||
Reference in New Issue
Block a user