Added member data copy

This commit is contained in:
sairaj mote 2023-11-09 00:17:28 +05:30
parent bbb0242166
commit a783fac9db
4 changed files with 52 additions and 5 deletions

View File

@ -470,6 +470,10 @@ ul {
height: 100%;
}
.fw-500 {
font-weight: 500;
}
.padding-block-1 {
padding-block: 1rem;
}
@ -586,6 +590,20 @@ ul {
white-space: pre-line;
}
.copy-button {
display: inline-flex;
justify-content: center;
cursor: pointer;
border: none;
padding: 0.4rem;
background-color: rgba(var(--text-color, 17, 17, 17), 0.06);
border-radius: var(--button-border-radius, 0.3rem);
font-size: 0.7rem;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.05rem;
}
.card {
background-color: rgba(var(--foreground-color), 1);
border-radius: 0.5rem;

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -432,6 +432,9 @@ ul {
.h-100 {
height: 100%;
}
.fw-500 {
font-weight: 500;
}
.padding-block-1 {
padding-block: 1rem;
@ -538,6 +541,19 @@ ul {
.ws-pre-line {
white-space: pre-line;
}
.copy-button {
display: inline-flex;
justify-content: center;
cursor: pointer;
border: none;
padding: 0.4rem;
background-color: rgba(var(--text-color, (17, 17, 17)), 0.06);
border-radius: var(--button-border-radius, 0.3rem);
font-size: 0.7rem;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.05rem;
}
.card {
background-color: rgba(var(--foreground-color), 1);

View File

@ -277,6 +277,14 @@
popupStack.peek().popup.hide()
}
function copyToClipboard(data) {
navigator.clipboard.writeText(data).then(() => {
notify('Copied to clipboard', 'success')
}).catch(() => {
notify('Failed to copy to clipboard', 'error')
})
}
document.addEventListener('popupopened', e => {
switch (e.target.id) {
case 'generate_key_path_address_popup': {
@ -335,21 +343,26 @@
renderElem(getRef('generate_script_path_address_popup__content'), html`
<fieldset class="grid gap-0-5">
<legend>Taproot script-path address</legend>
<sm-copy value="${address}"><b>${address}</b></sm-copy>
<b class="wrap-around fw-500" style="font-size:0.9rem">${address}</b>
</fieldset>
<fieldset class="grid gap-0-5">
<legend>Members</legend>
<ul class="grid gap-0-5">
${leaves.map((leaf, index) => html`
<li class="grid gap-1 taproot-member">
<h5>Member #${index + 1}</h5>
<div class="flex align-center space-between">
<h5>Member #${index + 1}</h5>
<button class="copy-button" onclick=${() => copyToClipboard(`Member #${index + 1}\n\nScript: ${hex.encode(leaf.script)}\n\nControl block: ${hex.encode(leaf.controlBlock)}`)}>
COPY
</button>
</div>
<div class="grid">
<p class="label">Script</p>
<sm-copy value="${hex.encode(leaf.script)}"></sm-copy>
<b class="wrap-around" style="font-size:0.9rem">${hex.encode(leaf.script)}</b>
</div>
<div class="grid">
<p class="label">Control block</p>
<sm-copy value="${hex.encode(leaf.controlBlock)}"></sm-copy>
<b class="wrap-around" style="font-size:0.9rem">${hex.encode(leaf.controlBlock)}</b>
</div>
</li>
`)}