Fix approval popup: init listeners before early return, rename view, space buttons
Some checks failed
check / check (push) Has been cancelled
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:
@@ -593,8 +593,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ============ APPROVAL ============ -->
|
<!-- ============ SITE APPROVAL ============ -->
|
||||||
<div id="view-approve" class="view hidden">
|
<div id="view-approve-site" class="view hidden">
|
||||||
<h2 class="font-bold mb-2">Connection Request</h2>
|
<h2 class="font-bold mb-2">Connection Request</h2>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<p class="mb-2">
|
<p class="mb-2">
|
||||||
@@ -617,7 +617,7 @@
|
|||||||
Remember my choice for this site
|
Remember my choice for this site
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex justify-between">
|
||||||
<button
|
<button
|
||||||
id="btn-approve"
|
id="btn-approve"
|
||||||
class="border border-border px-2 py-1 hover:bg-fg hover:text-bg cursor-pointer"
|
class="border border-border px-2 py-1 hover:bg-fg hover:text-bg cursor-pointer"
|
||||||
|
|||||||
@@ -73,12 +73,15 @@ async function init() {
|
|||||||
await saveState();
|
await saveState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always init approval — it may run in its own popup window
|
||||||
|
approval.init(ctx);
|
||||||
|
|
||||||
// Check for approval mode
|
// Check for approval mode
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
const approvalId = params.get("approval");
|
const approvalId = params.get("approval");
|
||||||
if (approvalId) {
|
if (approvalId) {
|
||||||
approval.show(parseInt(approvalId, 10));
|
approval.show(parseInt(approvalId, 10));
|
||||||
showView("approve");
|
showView("approve-site");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +102,6 @@ async function init() {
|
|||||||
receive.init(ctx);
|
receive.init(ctx);
|
||||||
addToken.init(ctx);
|
addToken.init(ctx);
|
||||||
settings.init(ctx);
|
settings.init(ctx);
|
||||||
approval.init(ctx);
|
|
||||||
|
|
||||||
if (!state.hasWallet) {
|
if (!state.hasWallet) {
|
||||||
showView("welcome");
|
showView("welcome");
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const VIEWS = [
|
|||||||
"add-token",
|
"add-token",
|
||||||
"settings",
|
"settings",
|
||||||
"transaction",
|
"transaction",
|
||||||
"approve",
|
"approve-site",
|
||||||
];
|
];
|
||||||
|
|
||||||
function $(id) {
|
function $(id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user