fix: use consistent [x] delete buttons, add inline rename
All checks were successful
check / check (push) Successful in 8s
All checks were successful
check / check (push) Successful in 8s
- Delete buttons now use [x] with border, matching token and site removal patterns in settings - Wallet names are click-to-rename (inline input), matching the home view rename UX
This commit is contained in:
@@ -78,8 +78,8 @@ function renderWalletListSettings() {
|
|||||||
state.wallets.forEach((wallet, idx) => {
|
state.wallets.forEach((wallet, idx) => {
|
||||||
const name = escapeHtml(wallet.name || "Wallet " + (idx + 1));
|
const name = escapeHtml(wallet.name || "Wallet " + (idx + 1));
|
||||||
html += `<div class="flex justify-between items-center text-xs py-1 border-b border-border-light">`;
|
html += `<div class="flex justify-between items-center text-xs py-1 border-b border-border-light">`;
|
||||||
html += `<span>${name}</span>`;
|
html += `<span class="settings-wallet-name cursor-pointer underline decoration-dashed" data-idx="${idx}">${name}</span>`;
|
||||||
html += `<span class="btn-delete-wallet border-b border-dashed border-fg text-fg cursor-pointer" data-idx="${idx}">[delete]</span>`;
|
html += `<button class="btn-delete-wallet border border-border px-1 hover:bg-fg hover:text-bg cursor-pointer" data-idx="${idx}">[x]</button>`;
|
||||||
html += `</div>`;
|
html += `</div>`;
|
||||||
});
|
});
|
||||||
container.innerHTML = html;
|
container.innerHTML = html;
|
||||||
@@ -94,6 +94,38 @@ function renderWalletListSettings() {
|
|||||||
$("delete-wallet-confirm").classList.remove("hidden");
|
$("delete-wallet-confirm").classList.remove("hidden");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 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() {
|
function show() {
|
||||||
|
|||||||
Reference in New Issue
Block a user