From 03e68b3a10a67b84d37fc1372f97d9641c3d629c Mon Sep 17 00:00:00 2001 From: William Casarin Date: Sun, 3 Jul 2022 09:23:21 -0700 Subject: [PATCH] clickable boost links Changelog-Added: Clicking boost text will go to that users profile Signed-off-by: William Casarin --- damus/Views/EventView.swift | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/damus/Views/EventView.swift b/damus/Views/EventView.swift index a9f424ba..eb967c87 100644 --- a/damus/Views/EventView.swift +++ b/damus/Views/EventView.swift @@ -73,23 +73,30 @@ struct EventView: View { return Group { if event.known_kind == .boost, let inner_ev = event.inner_event { VStack(alignment: .leading) { - HStack { - Label("", systemImage: "arrow.2.squarepath") - .foregroundColor(Color.gray) - ProfileName(pubkey: pubkey, profile: damus.profiles.lookup(id: pubkey)) - .foregroundColor(Color.gray) - Text(" Boosted") - .foregroundColor(Color.gray) + 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 { + Label("", systemImage: "arrow.2.squarepath") + .foregroundColor(Color.gray) + ProfileName(pubkey: event.pubkey, profile: damus.profiles.lookup(id: event.pubkey)) + .foregroundColor(Color.gray) + Text(" Boosted") + .foregroundColor(Color.gray) + } } - TextEvent(inner_ev) + .buttonStyle(PlainButtonStyle()) + TextEvent(inner_ev, pubkey: inner_ev.pubkey) } } 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) return HStack(alignment: .top) { let profile = damus.profiles.lookup(id: pubkey)