mirror of
git://jb55.com/damus
synced 2024-09-18 19:23:49 +00:00
show who we're replying to
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
parent
5aa19be82a
commit
4ff6719961
@ -7,12 +7,33 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
func all_referenced_pubkeys(_ ev: NostrEvent) -> [ReferencedId] {
|
||||
var keys = ev.referenced_pubkeys
|
||||
let ref = ReferencedId(ref_id: ev.pubkey, relay_id: nil, key: "p")
|
||||
keys.insert(ref, at: 0)
|
||||
return keys
|
||||
}
|
||||
|
||||
struct ReplyView: View {
|
||||
let replying_to: NostrEvent
|
||||
|
||||
@EnvironmentObject var profiles: Profiles
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text("Replying to:")
|
||||
HStack {
|
||||
let names = all_referenced_pubkeys(replying_to)
|
||||
.map { pubkey in
|
||||
let pk = pubkey.ref_id
|
||||
let prof = profiles.lookup(id: pk)
|
||||
return Profile.displayName(profile: prof, pubkey: pk)
|
||||
}
|
||||
.joined(separator: ", ")
|
||||
Text(names)
|
||||
.foregroundColor(.gray)
|
||||
.font(.footnote)
|
||||
}
|
||||
EventView(event: replying_to, highlight: .none, has_action_bar: false)
|
||||
PostView(references: replying_to.reply_ids(pubkey: replying_to.pubkey))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user