Show client tags on events
Display "via ClientName" indicator beside timestamps when an event has a client tag, allowing users to see which nostr app published it. Changelog-Added: Show client name on events when available Closes: https://github.com/damus-io/damus/issues/3323 Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
f3361e6eae
commit
af3bb212c3
@@ -35,6 +35,10 @@ struct EventTop: View {
|
||||
ProfileName(is_anon: is_anon)
|
||||
TimeDot()
|
||||
RelativeTime(time: state.events.get_cache_data(event.id).relative_time, size: size, font_size: state.settings.font_size)
|
||||
if let clientTag = event.clientTag {
|
||||
TimeDot()
|
||||
ClientTagLabel(clientTag: clientTag, size: size, font_size: state.settings.font_size)
|
||||
}
|
||||
Spacer()
|
||||
if !options.contains(.no_context_menu) {
|
||||
EventMenuContext(damus: state, event: event)
|
||||
@@ -49,3 +53,17 @@ struct EventTop_Previews: PreviewProvider {
|
||||
EventTop(state: test_damus_state, event: test_note, pubkey: test_note.pubkey, is_anon: false, size: .normal, options: [])
|
||||
}
|
||||
}
|
||||
|
||||
/// Displays the client name that published an event (e.g., "via Damus").
|
||||
struct ClientTagLabel: View {
|
||||
let clientTag: ClientTagMetadata
|
||||
let size: EventViewKind
|
||||
let font_size: Double
|
||||
|
||||
var body: some View {
|
||||
Text(String(format: NSLocalizedString("via %@", comment: "Label indicating which client published the event"), clientTag.name))
|
||||
.font(eventviewsize_to_font(size, font_size: font_size))
|
||||
.foregroundColor(.gray)
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user