refactor: simplify NFC tag assignment logic and enhance info message styling

This commit is contained in:
Manuel Weiser 2025-02-16 09:29:09 +01:00
parent 269f54b2b3
commit 2fb2a2f183
2 changed files with 6 additions and 12 deletions

View File

@ -239,16 +239,6 @@ function updateNfcInfo() {
`${spool.id} | ${spool.filament.name} (${spool.filament.material})` === selectedText `${spool.id} | ${spool.filament.name} (${spool.filament.material})` === selectedText
); );
if (selectedSpool && selectedSpool.extra.nfc_id) {
nfcInfo.textContent = "NFC Tag assigned";
nfcInfo.classList.add("nfc-success");
nfcInfo.classList.remove("nfc-error");
} else {
nfcInfo.textContent = "No NFC-Tag assigned";
nfcInfo.classList.add("nfc-error");
nfcInfo.classList.remove("nfc-success");
}
if (selectedSpool) { if (selectedSpool) {
writeButton.classList.remove("hidden"); writeButton.classList.remove("hidden");
} else { } else {
@ -526,7 +516,7 @@ function updateNfcData(data) {
} }
} else { } else {
nfcDataDiv.innerHTML = '<div style="margin-top: 10px;"></div>'; nfcDataDiv.innerHTML = '<div class="info-message-inner" style="margin-top: 10px;"></div>';
} }
nfcStatusContainer.appendChild(nfcDataDiv); nfcStatusContainer.appendChild(nfcDataDiv);
return; return;

View File

@ -480,11 +480,15 @@ a:hover {
.info-message { .info-message {
padding: 10px; padding: 10px;
background-color: #fff3f3; background-color: var(--header-bg);
border-radius: 4px; border-radius: 4px;
border-left: 4px solid #39d82e; border-left: 4px solid #39d82e;
} }
.info-message-inner {
background-color: var(--header-bg) !important;
}
.nfc-header { .nfc-header {
display: grid; display: grid;
grid-template-columns: 40px 1fr 40px; grid-template-columns: 40px 1fr 40px;