Fix relock popup visibility and buttons

This commit is contained in:
2026-02-06 23:09:58 +01:00
parent f112e7d483
commit 2814548ea2
2 changed files with 17 additions and 7 deletions

View File

@@ -729,7 +729,7 @@ export function openResultsRelockModal() {
title: t("results.relockedTitle"),
body: t("results.relockedBody"),
confirmLabel: t("results.relockedConfirm"),
cancelLabel: t("modal.close"),
cancelLabel: null,
onConfirm: (close) => close(),
});
}
@@ -752,11 +752,15 @@ export function openConfirmModal({ title, body, confirmLabel, cancelLabel = t("m
actions.className = "stack horizontal";
const confirmBtn = document.createElement("button");
confirmBtn.textContent = confirmLabel ?? t("modal.confirm");
const cancelBtn = document.createElement("button");
cancelBtn.className = "ghost";
cancelBtn.type = "button";
cancelBtn.textContent = cancelLabel;
actions.append(confirmBtn, cancelBtn);
actions.append(confirmBtn);
if (cancelLabel !== null && cancelLabel !== undefined) {
const cancelBtn = document.createElement("button");
cancelBtn.className = "ghost";
cancelBtn.type = "button";
cancelBtn.textContent = cancelLabel;
actions.append(cancelBtn);
cancelBtn.addEventListener("click", close);
}
panel.querySelector(".edit-body")?.appendChild(actions);
const close = () => overlay.remove();
@@ -767,7 +771,6 @@ export function openConfirmModal({ title, body, confirmLabel, cancelLabel = t("m
)
close();
});
cancelBtn.addEventListener("click", close);
confirmBtn.addEventListener("click", async () => {
try {
await onConfirm?.(close);