diff --git a/src/popup/index.html b/src/popup/index.html index 889aa51..0818067 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -708,9 +708,7 @@

Wallets

-

- Add a new wallet from a recovery phrase or private key. -

+
+ + + `; + }); + container.innerHTML = html; + container.querySelectorAll(".btn-delete-wallet").forEach((btn) => { + btn.addEventListener("click", () => { + const idx = parseInt(btn.dataset.idx, 10); + deleteWallet.show(idx); + }); + }); + + // Inline rename on click + container.querySelectorAll(".settings-wallet-name").forEach((span) => { + span.addEventListener("click", () => { + const idx = parseInt(span.dataset.idx, 10); + const wallet = state.wallets[idx]; + const input = document.createElement("input"); + input.type = "text"; + input.className = + "border border-border p-0 text-xs bg-bg text-fg w-full"; + input.value = wallet.name || "Wallet " + (idx + 1); + span.replaceWith(input); + input.focus(); + input.select(); + const finish = async () => { + const val = input.value.trim(); + if (val && val !== wallet.name) { + wallet.name = val; + await saveState(); + } + renderWalletListSettings(); + }; + input.addEventListener("blur", finish); + input.addEventListener("keydown", (e) => { + if (e.key === "Enter") input.blur(); + if (e.key === "Escape") { + input.value = wallet.name || "Wallet " + (idx + 1); + input.blur(); + } + }); + }); + }); +} + function show() { $("settings-rpc").value = state.rpcUrl; $("settings-blockscout").value = state.blockscoutUrl; renderTrackedTokens(); renderSiteLists(); + renderWalletListSettings(); + showView("settings"); } @@ -83,6 +141,8 @@ function renderSiteLists() { } function init(ctx) { + deleteWallet.init(ctx); + $("btn-save-rpc").addEventListener("click", async () => { const url = $("settings-rpc").value.trim(); if (!url) {