This commit is contained in:
nora 2023-03-05 20:50:30 +01:00
parent 0b8bd50e7e
commit c8c8d47346

View file

@ -26,11 +26,11 @@
border: 1px black solid; border: 1px black solid;
} }
.item-source { .item-action {
background: rgb(188, 188, 188); background: rgb(188, 188, 188);
} }
.source-box-text { .item-text {
font-size: 18pt; font-size: 18pt;
text-align: center; text-align: center;
} }
@ -161,12 +161,6 @@
</div> </div>
</div> </div>
<div>
<button class="compile-action" disabled onclick="updateCompilers()">
update compilers
</button>
</div>
<div> <div>
<textarea id="stdout" rows="30" cols="80"></textarea> <textarea id="stdout" rows="30" cols="80"></textarea>
<textarea id="stderr" rows="30" cols="80"></textarea> <textarea id="stderr" rows="30" cols="80"></textarea>
@ -192,7 +186,7 @@
function renderItem(item) { function renderItem(item) {
const inner = document.createElement("div"); const inner = document.createElement("div");
inner.innerText = item.name; inner.innerText = item.name;
inner.classList.add("source-box-text"); inner.classList.add("item-text");
const elem = document.createElement("div"); const elem = document.createElement("div");
elem.classList.add(`item-${item.type}`); elem.classList.add(`item-${item.type}`);
elem.classList.add("center-inner"); elem.classList.add("center-inner");
@ -281,8 +275,8 @@
); );
const inventory = new Inventory([ const inventory = new Inventory([
new Item("compiler", "source"), new Item("compiler", "action"),
new Item("library", "source"), new Item("library", "action"),
]); ]);
const ws = new WebSocket("ws://localhost:3000/ws"); const ws = new WebSocket("ws://localhost:3000/ws");
@ -319,6 +313,7 @@
); );
const error = msg.Done ? "" : "an error occurred"; const error = msg.Done ? "" : "an error occurred";
setError(error); setError(error);
updateCompilers();
} }
}); });
@ -345,9 +340,9 @@
console.log("Items", item1, item2); console.log("Items", item1, item2);
const action = [item1, item2].find((item) => item.type == "source"); const action = [item1, item2].find((item) => item.type == "action");
if (!action) { if (!action) {
setError("must include a source in the crafting receipe"); setError("must include an action in the crafting receipe");
return; return;
} }
const compiler = [item1, item2].find((item) => item.type == "compiler"); const compiler = [item1, item2].find((item) => item.type == "compiler");