Files
damus/damus/Views/Events/Components/ReplyPart.swift
ericholguin 1b8e3fe184 highlight: fixes and improvements
This patch allows highlights to be included in posts as well as removes context
when creating a highlight. Highlights now route as the root and selecting the
highlight in root routes to the highlighted event.

Signed-off-by: ericholguin <ericholguin@apache.org>
2024-07-15 19:58:59 -06:00

34 lines
993 B
Swift

//
// ReplyPart.swift
// damus
//
// Created by William Casarin on 2023-06-01.
//
import SwiftUI
struct ReplyPart: View {
let events: EventCache
let event: NostrEvent
let keypair: Keypair
let ndb: Ndb
var body: some View {
Group {
if event.known_kind == .highlight {
let highlighted_note = event.highlighted_note_id().flatMap { events.lookup($0) }
HighlightDescription(event: event, highlighted_event: highlighted_note, ndb: ndb)
} else if let reply_ref = event.thread_reply()?.reply {
let replying_to = events.lookup(reply_ref.note_id)
ReplyDescription(event: event, replying_to: replying_to, ndb: ndb)
}
}
}
}
struct ReplyPart_Previews: PreviewProvider {
static var previews: some View {
ReplyPart(events: test_damus_state.events, event: test_note, keypair: Keypair(pubkey: .empty, privkey: nil), ndb: test_damus_state.ndb)
}
}