likes, mention parsing, lots of stuff

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-05-04 16:26:10 -07:00
parent 403fa74f8d
commit f42bc2e91e
25 changed files with 608 additions and 118 deletions

View File

@@ -40,7 +40,7 @@ struct EventView: View {
let event: NostrEvent
let highlight: Highlight
let has_action_bar: Bool
let pool: RelayPool
let damus: DamusState
@EnvironmentObject var profiles: Profiles
@EnvironmentObject var action_bar: ActionBarModel
@@ -49,7 +49,7 @@ struct EventView: View {
let profile = profiles.lookup(id: event.pubkey)
HStack {
VStack {
let pv = ProfileView(pool: pool, profile: ProfileModel(pubkey: event.pubkey, pool: pool))
let pv = ProfileView(damus: damus, profile: ProfileModel(pubkey: event.pubkey, damus: damus))
.environmentObject(profiles)
NavigationLink(destination: pv) {
@@ -81,7 +81,7 @@ struct EventView: View {
Spacer()
if has_action_bar {
EventActionBar(event: event)
EventActionBar(event: event, our_pubkey: damus.pubkey, bar: make_actionbar_model(ev: event, counter: damus.likes))
.environmentObject(profiles)
}
@@ -152,3 +152,11 @@ func reply_others_desc(n: Int, n_pubkeys: Int) -> String {
}
func make_actionbar_model(ev: NostrEvent, counter: EventCounter) -> ActionBarModel {
let likes = counter.counts[ev.id]
let our_like = counter.our_events[ev.id]
let our_boost: NostrEvent? = nil
return ActionBarModel(likes: likes ?? 0, our_like: our_like, our_boost: our_boost)
}