Add onlyzap badges to usernames

This commit is contained in:
William Casarin
2023-04-20 14:40:39 -07:00
parent 8a20b7e4a7
commit bbfe5380e0
2 changed files with 26 additions and 1 deletions

View File

@@ -50,7 +50,15 @@ struct EventProfileName: View {
var current_display_name: DisplayName {
return display_name ?? Profile.displayName(profile: profile, pubkey: pubkey)
}
var onlyzapper: Bool {
guard let profile else {
return false
}
return profile.reactions == false
}
var body: some View {
HStack(spacing: 2) {
switch current_display_name {
@@ -74,6 +82,11 @@ struct EventProfileName: View {
if current_nip05 == nil, let frend = friend_type {
FriendIcon(friend: frend)
}
if onlyzapper {
Image("zap-hashtag")
.frame(width: 14, height: 14)
}
}
.onReceive(handle_notify(.profile_updated)) { notif in
let update = notif.object as! ProfileUpdate

View File

@@ -70,6 +70,14 @@ struct ProfileName: View {
return prefix == "@" ? current_display_name.username : current_display_name.display_name
}
var onlyzapper: Bool {
guard let profile else {
return false
}
return profile.reactions == false
}
var body: some View {
HStack(spacing: 2) {
Text(verbatim: "\(prefix)\(name_choice)")
@@ -81,6 +89,10 @@ struct ProfileName: View {
if let friend = friend_type, current_nip05 == nil {
FriendIcon(friend: friend)
}
if onlyzapper {
Image("zap-hashtag")
.frame(width: 14, height: 14)
}
}
.onReceive(handle_notify(.profile_updated)) { notif in
let update = notif.object as! ProfileUpdate