update mine 4
This commit is contained in:
parent
c961711408
commit
401c16ddab
@ -4,7 +4,7 @@
|
||||
Produktionsanzeige + Abholen-Button
|
||||
================================ */
|
||||
|
||||
/* showNotification() kommt aus dem globalen Scope (launcher.ejs) */
|
||||
/* window.showNotification() kommt aus dem globalen Scope (launcher.ejs) */
|
||||
|
||||
export async function loadMine(buildingId) {
|
||||
const actionsTab = document.getElementById("tab-actions");
|
||||
@ -34,18 +34,7 @@ async function renderMineStatus(buildingId) {
|
||||
const minutesLeft = Math.floor(data.next_cycle_in_seconds / 60);
|
||||
const secondsLeft = data.next_cycle_in_seconds % 60;
|
||||
|
||||
/* Produktion pro Zyklus */
|
||||
const cycleMinutes = Math.floor((data.cycle_seconds ?? 3600) / 60);
|
||||
const productionRows = (data.production ?? [])
|
||||
.map((r) => `
|
||||
<div class="mine-resource-row">
|
||||
<span class="mine-resource-icon">${resourceIcon(r.resource)}</span>
|
||||
<span class="mine-resource-label">${resourceLabel(r.resource)}</span>
|
||||
<span class="mine-resource-amount">+${r.amount} / ${cycleMinutes}min</span>
|
||||
</div>`)
|
||||
.join("");
|
||||
|
||||
/* Abgebaut (bereit zum Abholen) */
|
||||
/* Ressourcen-Zeilen */
|
||||
const resourceRows = data.available
|
||||
.map((r) => {
|
||||
const icon = resourceIcon(r.resource);
|
||||
@ -70,13 +59,6 @@ async function renderMineStatus(buildingId) {
|
||||
|
||||
<div class="mine-divider"></div>
|
||||
|
||||
<p class="mine-section-title">Produktion pro Zyklus</p>
|
||||
<div class="mine-resources">
|
||||
${productionRows}
|
||||
</div>
|
||||
|
||||
<div class="mine-divider"></div>
|
||||
|
||||
<p class="mine-section-title">Abgebaut</p>
|
||||
<div class="mine-resources">
|
||||
${resourceRows}
|
||||
@ -131,7 +113,7 @@ document.addEventListener("click", async (e) => {
|
||||
const data = await res.json();
|
||||
|
||||
if (data.error) {
|
||||
showNotification(
|
||||
window.showNotification(
|
||||
data.ready_in_display
|
||||
? `Die Mine ist noch nicht bereit.\nBereit in: ${data.ready_in_display}`
|
||||
: data.error,
|
||||
@ -147,7 +129,7 @@ document.addEventListener("click", async (e) => {
|
||||
.map((c) => `${resourceIcon(c.resource)} ${resourceLabel(c.resource)}: +${c.amount}`)
|
||||
.join("\n");
|
||||
|
||||
showNotification(
|
||||
window.showNotification(
|
||||
`Erfolgreich abgeholt!\n\n${lines}`,
|
||||
"Mine",
|
||||
"⛏️"
|
||||
@ -157,7 +139,7 @@ document.addEventListener("click", async (e) => {
|
||||
|
||||
} catch (err) {
|
||||
console.error("Abholen Fehler:", err);
|
||||
showNotification(
|
||||
window.showNotification(
|
||||
"Fehler beim Abholen. Bitte erneut versuchen.",
|
||||
"Fehler",
|
||||
"⚠️"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user