Fix approval popup: init listeners before early return, rename view, space buttons
Some checks failed
check / check (push) Has been cancelled

The Allow/Deny buttons did nothing because approval.init(ctx) was
called after the early return for approval mode, so listeners were
never attached. Move it before the check.

Rename view from "approve" to "approve-site" to avoid ambiguity with
future transaction approval. Space Allow and Deny buttons apart with
justify-between to prevent misclicks.
This commit is contained in:
2026-02-26 03:51:51 +07:00
parent 2d328c7389
commit 21ccecab46
3 changed files with 8 additions and 6 deletions

View File

@@ -593,8 +593,8 @@
</div>
</div>
<!-- ============ APPROVAL ============ -->
<div id="view-approve" class="view hidden">
<!-- ============ SITE APPROVAL ============ -->
<div id="view-approve-site" class="view hidden">
<h2 class="font-bold mb-2">Connection Request</h2>
<div class="mb-3">
<p class="mb-2">
@@ -617,7 +617,7 @@
Remember my choice for this site
</label>
</div>
<div class="flex gap-2">
<div class="flex justify-between">
<button
id="btn-approve"
class="border border-border px-2 py-1 hover:bg-fg hover:text-bg cursor-pointer"

View File

@@ -73,12 +73,15 @@ async function init() {
await saveState();
}
// Always init approval — it may run in its own popup window
approval.init(ctx);
// Check for approval mode
const params = new URLSearchParams(window.location.search);
const approvalId = params.get("approval");
if (approvalId) {
approval.show(parseInt(approvalId, 10));
showView("approve");
showView("approve-site");
return;
}
@@ -99,7 +102,6 @@ async function init() {
receive.init(ctx);
addToken.init(ctx);
settings.init(ctx);
approval.init(ctx);
if (!state.hasWallet) {
showView("welcome");

View File

@@ -19,7 +19,7 @@ const VIEWS = [
"add-token",
"settings",
"transaction",
"approve",
"approve-site",
];
function $(id) {