NIP05 badge styling

This commit is contained in:
styppo 2023-01-13 17:31:12 +00:00
parent efc9af8bc1
commit 333404420c
No known key found for this signature in database
GPG Key ID: 3AAA685C50724C28
8 changed files with 34 additions and 47 deletions

View File

@ -47,7 +47,7 @@ export default {
opacity: .9; opacity: .9;
} }
&-value { &-value {
font-weight: 500; font-weight: 600;
} }
} }
</style> </style>

View File

@ -7,7 +7,7 @@
<div class="menu-profile-items"> <div class="menu-profile-items">
<div class="profile-info"> <div class="profile-info">
<p> <p>
<UserName :pubkey="pubkey" two-line /> <UserName :pubkey="pubkey" two-line show-verified />
</p> </p>
</div> </div>
<div class="more"> <div class="more">

View File

@ -8,7 +8,7 @@
<UserAvatar :pubkey="note.author" clickable /> <UserAvatar :pubkey="note.author" clickable />
</div> </div>
<div class="post-author-name"> <div class="post-author-name">
<UserName :pubkey="note.author" clickable two-line /> <UserName :pubkey="note.author" clickable two-line show-verified />
</div> </div>
</div> </div>
<div class="post-content"> <div class="post-content">

View File

@ -16,7 +16,7 @@
<div class="post-content"> <div class="post-content">
<div class="post-content-header"> <div class="post-content-header">
<p> <p>
<UserName :pubkey="note.author" clickable @click.stop /> <UserName :pubkey="note.author" clickable show-verified @click.stop />
<span>&#183;</span> <span>&#183;</span>
<span class="created-at">{{ formatPostDate(note.createdAt) }}</span> <span class="created-at">{{ formatPostDate(note.createdAt) }}</span>
</p> </p>

View File

@ -40,7 +40,7 @@ export default {
if (!this.profile?.nip05.url) return if (!this.profile?.nip05.url) return
return this.profile.nip05.url return this.profile.nip05.url
.split('@') .split('@')
.filter(part => part !== '_' && part !== this.profile.name) .filter(part => part !== '_' && part?.toLowerCase() !== this.profile.name?.toLowerCase())
.join('@') .join('@')
} }
}, },
@ -58,6 +58,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.nip05-badge { .nip05-badge {
font-size: 12px; font-size: 12px;
display: inline-flex;
align-items: center;
&-text { &-text {
margin-left: 2px; margin-left: 2px;
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="user-card"> <div class="user-card">
<UserAvatar :pubkey="pubkey" :clickable="clickable" /> <UserAvatar :pubkey="pubkey" :clickable="clickable" />
<UserName :pubkey="pubkey" :clickable="clickable" class="username" two-line /> <UserName :pubkey="pubkey" :clickable="clickable" class="username" two-line show-verified />
<FollowButton v-if="followButton" :pubkey="pubkey" /> <FollowButton v-if="followButton" :pubkey="pubkey" />
</div> </div>
</template> </template>

View File

@ -3,19 +3,17 @@
class="username" class="username"
:class="{'two-line': twoLine, clickable, header}" :class="{'two-line': twoLine, clickable, header}"
> >
<span class="name">
<a @click="clickable && goToProfile(pubkey)"> <a @click="clickable && goToProfile(pubkey)">
<span v-if="profile?.name" class="name"> <span v-if="profile?.name">
{{ profile.name }} {{ profile.name }}
</span> </span>
<!-- <q-icon v-if="showFollowing && isFollow" name="visibility" color="secondary">--> <Bech32Label v-else prefix="npub" :hex="pubkey" />
<!-- <q-tooltip>-->
<!-- following-->
<!-- </q-tooltip>-->
<!-- </q-icon>-->
<Bech32Label v-if="twoLine || !profile?.name" prefix="npub" :hex="pubkey" class="pubkey" />
</a> </a>
<Nip05Badge v-if="showVerified" :pubkey="pubkey" :size="header ? '18px' : '14px'" class="verified-badge" />
</span>
<Nip05Badge :pubkey="pubkey" /> <Bech32Label v-if="twoLine && profile?.name" prefix="npub" :hex="pubkey" class="pubkey" />
</span> </span>
</template> </template>
@ -48,13 +46,9 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
showFollowing: {
type: Boolean,
default: false
},
showVerified: { showVerified: {
type: Boolean, type: Boolean,
default: true default: false
}, },
}, },
setup() { setup() {
@ -66,10 +60,6 @@ export default {
profile() { profile() {
return this.nostr.getProfile(this.pubkey) return this.nostr.getProfile(this.pubkey)
}, },
isFollow() {
// FIXME
return false
},
}, },
} }
</script> </script>
@ -79,35 +69,30 @@ export default {
.username { .username {
.name { .name {
font-weight: bold; display: inline-flex;
align-items: center;
a {
font-weight: 600;
} }
> span + span { .verified-badge {
margin-left: 8px; margin-left: 4px;
}
}
.pubkey {
color: $color-dark-gray;
display: block;
} }
&.two-line { &.two-line {
display: block; display: block;
> a > span {
display: block;
margin-left: 0;
}
.pubkey:not(:first-child) {
color: $color-dark-gray;
.pubkey-value {
font-weight: normal;
}
}
} }
&.clickable { &.clickable {
cursor: pointer; cursor: pointer;
.name:hover { .name a:hover {
text-decoration: underline;
}
.pubkey:first-child:hover {
text-decoration: underline; text-decoration: underline;
} }
} }
&.header { &.header {
.name, .pubkey:first-child { .name {
font-size: 1.5rem; font-size: 1.5rem;
} }
} }

View File

@ -15,7 +15,7 @@
<strong>{{ contacts?.length || 0 }}</strong> Following <strong>{{ contacts?.length || 0 }}</strong> Following
</a> </a>
<a @click="goToFollowers('followers')"> <a @click="goToFollowers('followers')">
<strong>{{ `${followers?.length}+` || 0 }}</strong> Followers <strong>{{ followers?.length ? `${followers?.length}+` : 0 }}</strong> Followers
</a> </a>
</p> </p>
</div> </div>
@ -176,7 +176,7 @@ export default defineComponent({
} }
&-content { &-content {
flex-grow: 1; flex-grow: 1;
.username { > p.username {
display: flex; display: flex;
> span:first-child { > span:first-child {
flex-grow: 1; flex-grow: 1;