Update interface.html to add confirmation before track delete

Instead of showing another popup for track delete confirmation, it now simply changes the button text to “Confirm Delete” for 3 seconds and a second tap will actually perform the delete.
master
stweedo 2025-06-28 11:44:13 -05:00 committed by GitHub
parent ae661f30de
commit 78eca5030a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 5 deletions

View File

@ -829,11 +829,29 @@ ${trackData.Latitude ? `
switch(task) { switch(task) {
case "delete": case "delete":
if (button.dataset.confirmDelete === "true") {
// Second click - proceed with deletion
Util.showModal(`Deleting ${filename}...`); Util.showModal(`Deleting ${filename}...`);
Util.eraseStorageFile(filename, () => { Util.eraseStorageFile(filename, () => {
Util.hideModal(); Util.hideModal();
getTrackList(); getTrackList();
}); });
} else {
// First click - change to confirm state
const originalText = button.textContent;
button.textContent = "Confirm Delete";
button.classList.add("btn-error");
button.dataset.confirmDelete = "true";
// Reset after 3 seconds
setTimeout(() => {
if (button.dataset.confirmDelete === "true") {
button.textContent = originalText;
button.classList.remove("btn-error");
delete button.dataset.confirmDelete;
}
}, 3000);
}
break; break;
case "downloadkml": case "downloadkml":
downloadTrack(filename, track => saveKML(track, `Bangle.js Track ${trackid}`)); downloadTrack(filename, track => saveKML(track, `Bangle.js Track ${trackid}`));