Browse Source

clickable boost links

Changelog-Added: Clicking boost text will go to that users profile
Signed-off-by: William Casarin <jb55@jb55.com>
profiles-everywhere
William Casarin 3 years ago
parent
commit
03e68b3a10
  1. 15
      damus/Views/EventView.swift

15
damus/Views/EventView.swift

@ -73,23 +73,30 @@ struct EventView: View {
return Group { return Group {
if event.known_kind == .boost, let inner_ev = event.inner_event { if event.known_kind == .boost, let inner_ev = event.inner_event {
VStack(alignment: .leading) { VStack(alignment: .leading) {
let prof_model = ProfileModel(pubkey: event.pubkey, damus: damus)
let follow_model = FollowersModel(damus_state: damus, target: event.pubkey)
let booster_profile = ProfileView(damus_state: damus, profile: prof_model, followers: follow_model)
NavigationLink(destination: booster_profile) {
HStack { HStack {
Label("", systemImage: "arrow.2.squarepath") Label("", systemImage: "arrow.2.squarepath")
.foregroundColor(Color.gray) .foregroundColor(Color.gray)
ProfileName(pubkey: pubkey, profile: damus.profiles.lookup(id: pubkey)) ProfileName(pubkey: event.pubkey, profile: damus.profiles.lookup(id: event.pubkey))
.foregroundColor(Color.gray) .foregroundColor(Color.gray)
Text(" Boosted") Text(" Boosted")
.foregroundColor(Color.gray) .foregroundColor(Color.gray)
} }
TextEvent(inner_ev) }
.buttonStyle(PlainButtonStyle())
TextEvent(inner_ev, pubkey: inner_ev.pubkey)
} }
} else { } else {
TextEvent(event) TextEvent(event, pubkey: pubkey)
} }
} }
} }
func TextEvent(_ event: NostrEvent) -> some View { func TextEvent(_ event: NostrEvent, pubkey: String) -> some View {
let content = event.get_content(damus.keypair.privkey) let content = event.get_content(damus.keypair.privkey)
return HStack(alignment: .top) { return HStack(alignment: .top) {
let profile = damus.profiles.lookup(id: pubkey) let profile = damus.profiles.lookup(id: pubkey)

Loading…
Cancel
Save