Add basic lightning tip button

This commit is contained in:
styppo 2023-01-24 17:52:37 +00:00
parent 02f0a13f2b
commit 1bea3ab24b
No known key found for this signature in database
GPG Key ID: 3AAA685C50724C28
2 changed files with 21 additions and 6 deletions

View File

@ -13,6 +13,8 @@ export default class Profile {
url: metadata.nip05, url: metadata.nip05,
verified: null, verified: null,
} }
this.lud06 = metadata.lud06
this.lud16 = metadata.lud16
} }
static from(event) { static from(event) {

View File

@ -23,7 +23,7 @@
<BaseIcon icon="messages" /> <BaseIcon icon="messages" />
<q-tooltip>Send private message</q-tooltip> <q-tooltip>Send private message</q-tooltip>
</a> </a>
<a> <a :href="lightningLink" :class="{disabled: !lightningLink}">
<q-icon name="bolt" size="sm" /> <q-icon name="bolt" size="sm" />
<q-tooltip>Tip with Bitcoin Lightning</q-tooltip> <q-tooltip>Tip with Bitcoin Lightning</q-tooltip>
</a> </a>
@ -165,6 +165,12 @@ export default defineComponent({
followers() { followers() {
return this.nostr.getFollowers(this.pubkey) return this.nostr.getFollowers(this.pubkey)
}, },
lightningLink() {
// TODO encode lud16 as lud06?
// TODO more protocols
const ln = this.profile?.lud06 || this.profile?.lud16
return ln ? `lightning:${ln}` : null
},
}, },
methods: { methods: {
loadMorePosts() { loadMorePosts() {
@ -270,18 +276,25 @@ export default defineComponent({
.actions { .actions {
display: flex; display: flex;
a { a {
text-decoration: none;
svg, i { svg, i {
width: 24px; width: 24px;
height: 24px; height: 24px;
color: $color-light-gray; color: $color-light-gray;
fill: $color-light-gray; fill: $color-light-gray;
//fill: $color-fg;
transition: 120ms ease; transition: 120ms ease;
} }
&:hover svg, &:hover i { &.disabled {
fill: $color-fg; svg, i {
color: $color-fg; color: $color-dark-gray !important;
//fill: $color-primary; fill: $color-dark-gray !important;
}
}
&:hover {
svg, i {
fill: $color-fg;
color: $color-fg;
}
} }
} }
a + a { a + a {