Browse Source

added lightning address copy button

Nostr-Signature: f0973d13a903f64895d265643390fe54bd86fe492a53c3ffea303dad8cf8a2f6 573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc 8c98969c5755bf8742733e05ca4be53f4f3ba276a2445ee7b903e443947fc53808b046c188dd91f26b6dcaecbe93585e1f2539855c8eba57e17a915e81bfa2d4
main
Silberengel 3 weeks ago
parent
commit
6871d13f5b
  1. 1
      nostr/commit-signatures.jsonl
  2. 93
      src/routes/users/[npub]/+page.svelte
  3. 3
      static/icons/lightning.svg

1
nostr/commit-signatures.jsonl

@ -35,3 +35,4 @@
{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771625218,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","bug-fix"]],"content":"Signed commit: bug-fix","id":"1cc16c438c4b1cc5170a90a7e4b540afa24d0c698538dc332fa4753437b21dfe","sig":"3caddc0d00e29995f4920bd4035ea61b4fd2d17e366bdd18889ede38a5ea960cd9f83a9f524b777b8de7bf7e4cdf59ab55c8fb4e46932655985ba8c6f3d7e7da"} {"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771625218,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","bug-fix"]],"content":"Signed commit: bug-fix","id":"1cc16c438c4b1cc5170a90a7e4b540afa24d0c698538dc332fa4753437b21dfe","sig":"3caddc0d00e29995f4920bd4035ea61b4fd2d17e366bdd18889ede38a5ea960cd9f83a9f524b777b8de7bf7e4cdf59ab55c8fb4e46932655985ba8c6f3d7e7da"}
{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771626015,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","bug-fixes"]],"content":"Signed commit: bug-fixes","id":"f5bde3d9199d8cbacca481959663f1e14c43e143ef2b5686502559408e1c526b","sig":"3ed47cd283746d290d8609cbfdefbcee31a19d8e43e1a6ebf5a2829904000d79b83d3235296af4b5f7b555051214fbf2fa5c7a6d7986dca853112bb4e122a6d5"} {"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771626015,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","bug-fixes"]],"content":"Signed commit: bug-fixes","id":"f5bde3d9199d8cbacca481959663f1e14c43e143ef2b5686502559408e1c526b","sig":"3ed47cd283746d290d8609cbfdefbcee31a19d8e43e1a6ebf5a2829904000d79b83d3235296af4b5f7b555051214fbf2fa5c7a6d7986dca853112bb4e122a6d5"}
{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771627873,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","bug-fixes"]],"content":"Signed commit: bug-fixes","id":"5726811907af73d3b478f3938cdc6421200040542cb1a586b3497c56a24c33cb","sig":"3833d05ba5a34cad78caacbc8382fcd7a85c60b56dd3b18f9a5c68c890d7a611fa6b885ef02be465f541629b0afaeec0e9d57d3b00db332c5c8ae42fd72fc83d"} {"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771627873,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","bug-fixes"]],"content":"Signed commit: bug-fixes","id":"5726811907af73d3b478f3938cdc6421200040542cb1a586b3497c56a24c33cb","sig":"3833d05ba5a34cad78caacbc8382fcd7a85c60b56dd3b18f9a5c68c890d7a611fa6b885ef02be465f541629b0afaeec0e9d57d3b00db332c5c8ae42fd72fc83d"}
{"kind":1640,"pubkey":"573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc","created_at":1771664126,"tags":[["author","Silberengel","silberengel7@protonmail.com"],["message","update profile page, dashboard, and connections"]],"content":"Signed commit: update profile page, dashboard, and connections","id":"862b888e52bf4fc3e53c80afd9f301b22ce674366f48d006bca520479394c0f9","sig":"c2e895f67ff5a68e87dcdc54a0312e169f4729a05a62f1ffbe92afd6e57b7d232b36ef4291c07969e531cdc4f22f5ac32723a2aecc57a0b613b945217ecc651a"}

93
src/routes/users/[npub]/+page.svelte

@ -280,6 +280,15 @@
} }
} }
async function copyLightningAddress(authority: string) {
try {
await navigator.clipboard.writeText(authority);
alert('Lightning address copied to clipboard!');
} catch (err) {
console.error('Failed to copy lightning address:', err);
}
}
const isOwnProfile = $derived(viewerPubkeyHex === profileOwnerPubkeyHex); const isOwnProfile = $derived(viewerPubkeyHex === profileOwnerPubkeyHex);
</script> </script>
@ -338,13 +347,24 @@
<span class="payment-type">{target.type}</span> <span class="payment-type">{target.type}</span>
</div> </div>
<code class="payment-address">{target.payto}</code> <code class="payment-address">{target.payto}</code>
<button <div class="payment-actions">
class="copy-button" {#if target.type === 'lightning'}
onclick={() => copyPaytoAddress(target.payto)} <button
title="Copy address" class="lightning-button"
> onclick={() => copyLightningAddress(target.authority)}
<img src="/icons/copy.svg" alt="Copy" class="icon-themed" /> title="Copy lightning address"
</button> >
<img src="/icons/lightning.svg" alt="Lightning" class="icon-themed" />
</button>
{/if}
<button
class="copy-button"
onclick={() => copyPaytoAddress(target.payto)}
title="Copy payto address"
>
<img src="/icons/copy.svg" alt="Copy" class="icon-themed" />
</button>
</div>
</div> </div>
{/each} {/each}
</div> </div>
@ -436,17 +456,18 @@
{@const isToViewer = viewerPubkeyHex !== null && getMessageRecipients(message).includes(viewerPubkeyHex)} {@const isToViewer = viewerPubkeyHex !== null && getMessageRecipients(message).includes(viewerPubkeyHex)}
<div class="message-card" class:from-viewer={isFromViewer} class:to-viewer={isToViewer && !isFromViewer}> <div class="message-card" class:from-viewer={isFromViewer} class:to-viewer={isToViewer && !isFromViewer}>
<div class="message-header"> <div class="message-header">
<UserBadge pubkey={message.pubkey} /> <div class="message-participants">
<span class="participants-label">From:</span>
<UserBadge pubkey={message.pubkey} />
{#if getMessageRecipients(message).length > 0}
<span class="participants-label">To:</span>
{#each getMessageRecipients(message) as recipientPubkey}
<UserBadge pubkey={recipientPubkey} />
{/each}
{/if}
</div>
<span class="message-time">{formatMessageTime(message.created_at)}</span> <span class="message-time">{formatMessageTime(message.created_at)}</span>
</div> </div>
{#if getMessageRecipients(message).length > 0}
<div class="message-recipients">
<span class="recipients-label">To:</span>
{#each getMessageRecipients(message) as recipientPubkey}
<UserBadge pubkey={recipientPubkey} />
{/each}
</div>
{/if}
<div class="message-body">{message.content}</div> <div class="message-body">{message.content}</div>
</div> </div>
{/each} {/each}
@ -695,10 +716,17 @@
flex: 1; flex: 1;
} }
.copy-button { .payment-actions {
position: absolute; position: absolute;
top: 0.75rem; top: 0.75rem;
right: 0.75rem; right: 0.75rem;
display: flex;
gap: 0.5rem;
align-items: center;
}
.copy-button,
.lightning-button {
background: transparent; background: transparent;
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 0.25rem; border-radius: 0.25rem;
@ -710,12 +738,14 @@
transition: all 0.2s ease; transition: all 0.2s ease;
} }
.copy-button:hover { .copy-button:hover,
.lightning-button:hover {
background: var(--bg-tertiary); background: var(--bg-tertiary);
border-color: var(--accent); border-color: var(--accent);
} }
.copy-button img { .copy-button img,
.lightning-button img {
width: 14px; width: 14px;
height: 14px; height: 14px;
} }
@ -751,12 +781,14 @@
opacity: 1 !important; opacity: 1 !important;
} }
.copy-button:hover .icon-themed { .copy-button:hover .icon-themed,
.lightning-button:hover .icon-themed {
filter: brightness(0) saturate(100%) invert(1) !important; filter: brightness(0) saturate(100%) invert(1) !important;
opacity: 1 !important; opacity: 1 !important;
} }
:global([data-theme="light"]) .copy-button:hover .icon-themed { :global([data-theme="light"]) .copy-button:hover .icon-themed,
:global([data-theme="light"]) .lightning-button:hover .icon-themed {
filter: brightness(0) saturate(100%) !important; filter: brightness(0) saturate(100%) !important;
opacity: 1 !important; opacity: 1 !important;
} }
@ -936,27 +968,30 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 0.75rem; margin-bottom: 0.75rem;
flex-wrap: wrap;
gap: 0.75rem;
} }
.message-time { .message-participants {
font-size: 0.875rem;
color: var(--text-muted);
}
.message-recipients {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.5rem;
margin-bottom: 0.75rem;
flex-wrap: wrap; flex-wrap: wrap;
flex: 1;
} }
.recipients-label { .participants-label {
font-size: 0.875rem; font-size: 0.875rem;
color: var(--text-muted); color: var(--text-muted);
font-weight: 500; font-weight: 500;
} }
.message-time {
font-size: 0.875rem;
color: var(--text-muted);
white-space: nowrap;
}
.message-body { .message-body {
color: var(--text-primary); color: var(--text-primary);
white-space: pre-wrap; white-space: pre-wrap;

3
static/icons/lightning.svg

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>
</svg>

After

Width:  |  Height:  |  Size: 250 B

Loading…
Cancel
Save