vbox accept
This commit is contained in:
@@ -9,6 +9,7 @@ function Vbox(args) {
|
||||
const {
|
||||
instance,
|
||||
combiner,
|
||||
sendVboxAccept,
|
||||
sendVboxDiscard,
|
||||
sendVboxReclaim,
|
||||
sendVboxCombine,
|
||||
@@ -18,17 +19,25 @@ function Vbox(args) {
|
||||
if (!instance.vbox) return false;
|
||||
|
||||
const free = [];
|
||||
for (let i = 0 ; i < vbox.free[0].length; i++) {
|
||||
for (let i = 0 ; i < 6; i++) {
|
||||
free.push([vbox.free[0][i], vbox.free[1][i], vbox.free[2][i]]);
|
||||
}
|
||||
|
||||
const freeRows = free.map((row, i) => (
|
||||
<tr key={i}>
|
||||
<td>{convertVar(row[0])}</td>
|
||||
<td>{convertVar(row[1])}</td>
|
||||
<td>{convertVar(row[2])}</td>
|
||||
</tr>
|
||||
));
|
||||
const freeRows = free.map((row, i) => {
|
||||
const cells = row.map((c, j) => (
|
||||
<td
|
||||
key={j}
|
||||
onClick={() => c && sendVboxAccept(j, i)} >
|
||||
{convertVar(c)}
|
||||
</td>
|
||||
));
|
||||
|
||||
return (
|
||||
<tr key={i}>
|
||||
{cells}
|
||||
</tr>
|
||||
);
|
||||
});
|
||||
|
||||
const boundRows = [
|
||||
<tr key={0} >
|
||||
@@ -62,7 +71,7 @@ function Vbox(args) {
|
||||
|
||||
return (
|
||||
<div className="three columns">
|
||||
<span>vBox</span>
|
||||
<h3>vBox - {vbox.bits}b</h3>
|
||||
<button
|
||||
className="instance-btn instance-ui-btn vbox-btn"
|
||||
onClick={() => sendVboxDiscard()}>
|
||||
|
||||
@@ -12,6 +12,10 @@ const addState = connect(
|
||||
return ws.sendVboxDiscard(instance.instance);
|
||||
}
|
||||
|
||||
function sendVboxAccept(group, index) {
|
||||
return ws.sendVboxAccept(instance.instance, group, index);
|
||||
}
|
||||
|
||||
function sendVboxCombine() {
|
||||
return console.log('combine', combiner);
|
||||
return ws.sendVboxDiscard(instance.instance);
|
||||
@@ -25,6 +29,7 @@ const addState = connect(
|
||||
return {
|
||||
instance,
|
||||
combiner,
|
||||
sendVboxAccept,
|
||||
sendVboxDiscard,
|
||||
sendVboxReclaim,
|
||||
sendVboxCombine,
|
||||
|
||||
Reference in New Issue
Block a user