Compare commits
1 Commits
feature/co
...
issue-99-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d1d584b52 |
@@ -15,21 +15,6 @@
|
|||||||
--color-section: #dddddd;
|
--color-section: #dddddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes copy-flash {
|
|
||||||
0% {
|
|
||||||
background-color: var(--color-fg);
|
|
||||||
color: var(--color-bg);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
background-color: transparent;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.copy-flash {
|
|
||||||
animation: copy-flash 500ms ease-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
width: 396px;
|
width: 396px;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ const {
|
|||||||
$,
|
$,
|
||||||
showView,
|
showView,
|
||||||
showFlash,
|
showFlash,
|
||||||
flashCopyElement,
|
|
||||||
balanceLinesForAddress,
|
balanceLinesForAddress,
|
||||||
addressDotHtml,
|
addressDotHtml,
|
||||||
addressTitle,
|
addressTitle,
|
||||||
@@ -238,11 +237,9 @@ function renderTransactions(txs) {
|
|||||||
function init(_ctx) {
|
function init(_ctx) {
|
||||||
ctx = _ctx;
|
ctx = _ctx;
|
||||||
$("address-full").addEventListener("click", () => {
|
$("address-full").addEventListener("click", () => {
|
||||||
const el = $("address-full");
|
const addr = $("address-full").dataset.full;
|
||||||
const addr = el.dataset.full;
|
|
||||||
if (addr) {
|
if (addr) {
|
||||||
navigator.clipboard.writeText(addr);
|
navigator.clipboard.writeText(addr);
|
||||||
flashCopyElement(el);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -357,21 +354,17 @@ function init(_ctx) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("export-privkey-value").addEventListener("click", () => {
|
$("export-privkey-value").addEventListener("click", () => {
|
||||||
const el = $("export-privkey-value");
|
const key = $("export-privkey-value").textContent;
|
||||||
const key = el.textContent;
|
|
||||||
if (key) {
|
if (key) {
|
||||||
navigator.clipboard.writeText(key);
|
navigator.clipboard.writeText(key);
|
||||||
flashCopyElement(el);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("export-privkey-address").addEventListener("click", () => {
|
$("export-privkey-address").addEventListener("click", () => {
|
||||||
const el = $("export-privkey-address");
|
const full = $("export-privkey-address").dataset.full;
|
||||||
const full = el.dataset.full;
|
|
||||||
if (full) {
|
if (full) {
|
||||||
navigator.clipboard.writeText(full);
|
navigator.clipboard.writeText(full);
|
||||||
flashCopyElement(el);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ const {
|
|||||||
$,
|
$,
|
||||||
showView,
|
showView,
|
||||||
showFlash,
|
showFlash,
|
||||||
flashCopyElement,
|
|
||||||
addressDotHtml,
|
addressDotHtml,
|
||||||
addressTitle,
|
addressTitle,
|
||||||
escapeHtml,
|
escapeHtml,
|
||||||
@@ -314,11 +313,9 @@ function renderTransactions(txs) {
|
|||||||
function init(_ctx) {
|
function init(_ctx) {
|
||||||
ctx = _ctx;
|
ctx = _ctx;
|
||||||
$("address-token-full").addEventListener("click", () => {
|
$("address-token-full").addEventListener("click", () => {
|
||||||
const el = $("address-token-full");
|
const addr = $("address-token-full").dataset.full;
|
||||||
const addr = el.dataset.full;
|
|
||||||
if (addr) {
|
if (addr) {
|
||||||
navigator.clipboard.writeText(addr);
|
navigator.clipboard.writeText(addr);
|
||||||
flashCopyElement(el);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -327,7 +324,6 @@ function init(_ctx) {
|
|||||||
const copyEl = e.target.closest("[data-copy]");
|
const copyEl = e.target.closest("[data-copy]");
|
||||||
if (copyEl) {
|
if (copyEl) {
|
||||||
navigator.clipboard.writeText(copyEl.dataset.copy);
|
navigator.clipboard.writeText(copyEl.dataset.copy);
|
||||||
flashCopyElement(copyEl);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -376,7 +372,6 @@ function init(_ctx) {
|
|||||||
if (copyEl) {
|
if (copyEl) {
|
||||||
copyEl.addEventListener("click", () => {
|
copyEl.addEventListener("click", () => {
|
||||||
navigator.clipboard.writeText(copyEl.dataset.copy);
|
navigator.clipboard.writeText(copyEl.dataset.copy);
|
||||||
flashCopyElement(copyEl);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ const {
|
|||||||
hideError,
|
hideError,
|
||||||
showView,
|
showView,
|
||||||
showFlash,
|
showFlash,
|
||||||
flashCopyElement,
|
|
||||||
addressTitle,
|
addressTitle,
|
||||||
addressDotHtml,
|
addressDotHtml,
|
||||||
escapeHtml,
|
escapeHtml,
|
||||||
@@ -117,7 +116,6 @@ function show(txInfo) {
|
|||||||
if (copyEl) {
|
if (copyEl) {
|
||||||
copyEl.onclick = () => {
|
copyEl.onclick = () => {
|
||||||
navigator.clipboard.writeText(copyEl.dataset.copy);
|
navigator.clipboard.writeText(copyEl.dataset.copy);
|
||||||
flashCopyElement(copyEl);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,18 +76,6 @@ function clearFlash() {
|
|||||||
$("flash-msg").textContent = "";
|
$("flash-msg").textContent = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function flashCopyElement(el) {
|
|
||||||
el.classList.remove("copy-flash");
|
|
||||||
// Force reflow so re-adding the class restarts the animation.
|
|
||||||
void el.offsetWidth;
|
|
||||||
el.classList.add("copy-flash");
|
|
||||||
el.addEventListener(
|
|
||||||
"animationend",
|
|
||||||
() => el.classList.remove("copy-flash"),
|
|
||||||
{ once: true },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function showFlash(msg, duration = 2000) {
|
function showFlash(msg, duration = 2000) {
|
||||||
clearFlash();
|
clearFlash();
|
||||||
$("flash-msg").textContent = msg;
|
$("flash-msg").textContent = msg;
|
||||||
@@ -277,7 +265,6 @@ module.exports = {
|
|||||||
hideError,
|
hideError,
|
||||||
showView,
|
showView,
|
||||||
showFlash,
|
showFlash,
|
||||||
flashCopyElement,
|
|
||||||
balanceLine,
|
balanceLine,
|
||||||
balanceLinesForAddress,
|
balanceLinesForAddress,
|
||||||
addressColor,
|
addressColor,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ const {
|
|||||||
$,
|
$,
|
||||||
showView,
|
showView,
|
||||||
showFlash,
|
showFlash,
|
||||||
flashCopyElement,
|
|
||||||
balanceLinesForAddress,
|
balanceLinesForAddress,
|
||||||
isoDate,
|
isoDate,
|
||||||
timeAgo,
|
timeAgo,
|
||||||
@@ -86,9 +85,8 @@ function renderActiveAddress() {
|
|||||||
el.innerHTML =
|
el.innerHTML =
|
||||||
`<span class="underline decoration-dashed cursor-pointer" id="active-addr-copy">${dot}${escapeHtml(addr)}</span>` +
|
`<span class="underline decoration-dashed cursor-pointer" id="active-addr-copy">${dot}${escapeHtml(addr)}</span>` +
|
||||||
`<a href="${link}" target="_blank" rel="noopener" class="inline-flex items-center">${EXT_ICON}</a>`;
|
`<a href="${link}" target="_blank" rel="noopener" class="inline-flex items-center">${EXT_ICON}</a>`;
|
||||||
$("active-addr-copy").addEventListener("click", (e) => {
|
$("active-addr-copy").addEventListener("click", () => {
|
||||||
navigator.clipboard.writeText(addr);
|
navigator.clipboard.writeText(addr);
|
||||||
flashCopyElement(e.currentTarget);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ const {
|
|||||||
$,
|
$,
|
||||||
showView,
|
showView,
|
||||||
showFlash,
|
showFlash,
|
||||||
flashCopyElement,
|
|
||||||
formatAddressHtml,
|
formatAddressHtml,
|
||||||
addressTitle,
|
addressTitle,
|
||||||
} = require("./helpers");
|
} = require("./helpers");
|
||||||
@@ -62,21 +61,17 @@ function show() {
|
|||||||
|
|
||||||
function init(ctx) {
|
function init(ctx) {
|
||||||
$("receive-address-block").addEventListener("click", () => {
|
$("receive-address-block").addEventListener("click", () => {
|
||||||
const el = $("receive-address-block");
|
const addr = $("receive-address-block").dataset.full;
|
||||||
const addr = el.dataset.full;
|
|
||||||
if (addr) {
|
if (addr) {
|
||||||
navigator.clipboard.writeText(addr);
|
navigator.clipboard.writeText(addr);
|
||||||
flashCopyElement(el);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("btn-receive-copy").addEventListener("click", () => {
|
$("btn-receive-copy").addEventListener("click", () => {
|
||||||
const block = $("receive-address-block");
|
const addr = $("receive-address-block").dataset.full;
|
||||||
const addr = block.dataset.full;
|
|
||||||
if (addr) {
|
if (addr) {
|
||||||
navigator.clipboard.writeText(addr);
|
navigator.clipboard.writeText(addr);
|
||||||
flashCopyElement(block);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ const {
|
|||||||
$,
|
$,
|
||||||
showView,
|
showView,
|
||||||
showFlash,
|
showFlash,
|
||||||
flashCopyElement,
|
|
||||||
addressDotHtml,
|
addressDotHtml,
|
||||||
addressTitle,
|
addressTitle,
|
||||||
escapeHtml,
|
escapeHtml,
|
||||||
@@ -159,9 +158,8 @@ function render() {
|
|||||||
loadCalldata(tx.hash, tx.to);
|
loadCalldata(tx.hash, tx.to);
|
||||||
}
|
}
|
||||||
|
|
||||||
const isoStr = isoDate(tx.timestamp);
|
$("tx-detail-time").textContent =
|
||||||
$("tx-detail-time").innerHTML =
|
isoDate(tx.timestamp) + " (" + timeAgo(tx.timestamp) + ")";
|
||||||
copyableHtml(isoStr) + " (" + escapeHtml(timeAgo(tx.timestamp)) + ")";
|
|
||||||
$("tx-detail-status").textContent = tx.isError ? "Failed" : "Success";
|
$("tx-detail-status").textContent = tx.isError ? "Failed" : "Success";
|
||||||
showView("transaction");
|
showView("transaction");
|
||||||
|
|
||||||
@@ -171,7 +169,6 @@ function render() {
|
|||||||
.forEach((el) => {
|
.forEach((el) => {
|
||||||
el.onclick = () => {
|
el.onclick = () => {
|
||||||
navigator.clipboard.writeText(el.dataset.copy);
|
navigator.clipboard.writeText(el.dataset.copy);
|
||||||
flashCopyElement(el);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -249,7 +246,6 @@ async function loadCalldata(txHash, toAddress) {
|
|||||||
container.querySelectorAll("[data-copy]").forEach((el) => {
|
container.querySelectorAll("[data-copy]").forEach((el) => {
|
||||||
el.onclick = () => {
|
el.onclick = () => {
|
||||||
navigator.clipboard.writeText(el.dataset.copy);
|
navigator.clipboard.writeText(el.dataset.copy);
|
||||||
flashCopyElement(el);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const {
|
|||||||
$,
|
$,
|
||||||
showView,
|
showView,
|
||||||
showFlash,
|
showFlash,
|
||||||
flashCopyElement,
|
|
||||||
addressDotHtml,
|
addressDotHtml,
|
||||||
addressTitle,
|
addressTitle,
|
||||||
escapeHtml,
|
escapeHtml,
|
||||||
@@ -77,7 +76,6 @@ function attachCopyHandlers(viewId) {
|
|||||||
.forEach((el) => {
|
.forEach((el) => {
|
||||||
el.onclick = () => {
|
el.onclick = () => {
|
||||||
navigator.clipboard.writeText(el.dataset.copy);
|
navigator.clipboard.writeText(el.dataset.copy);
|
||||||
flashCopyElement(el);
|
|
||||||
showFlash("Copied!");
|
showFlash("Copied!");
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user