diff --git a/src/popup/views/home.js b/src/popup/views/home.js index 3b98219..7e22d5b 100644 --- a/src/popup/views/home.js +++ b/src/popup/views/home.js @@ -4,6 +4,7 @@ const { showFlash, balanceLinesForAddress, addressDotHtml, + escapeHtml, } = require("./helpers"); const { state, saveState, currentAddress } = require("../../shared/state"); const { updateSendBalance, renderSendTokenSelect } = require("./send"); @@ -21,12 +22,27 @@ function renderTotalValue() { el.textContent = formatUsd(getTotalValueUsd(state.wallets)); } +const EXT_ICON = + `` + + `` + + `` + + `` + + ``; + function renderActiveAddress() { const el = $("active-address-display"); if (!el) return; if (state.activeAddress) { - const dot = addressDotHtml(state.activeAddress); - el.innerHTML = dot + state.activeAddress; + const addr = state.activeAddress; + const dot = addressDotHtml(addr); + const link = `https://etherscan.io/address/${addr}`; + el.innerHTML = + `${dot}${escapeHtml(addr)}` + + `${EXT_ICON}`; + $("active-addr-copy").addEventListener("click", () => { + navigator.clipboard.writeText(addr); + showFlash("Copied!"); + }); } else { el.textContent = ""; }