Move client tag display from feed to note detail view
Remove client tag from EventTop (feed header) and display it inline next to the timestamp in SelectedEventView instead. Removes unused ClientTagLabel struct. Applies lineLimit(1) with tail truncation to guard against unbounded client tag names. Closes: https://github.com/damus-io/damus/issues/3672 Signed-off-by: alltheseas Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
7937accfb3
commit
1768432a1e
@@ -35,10 +35,7 @@ struct EventTop: View {
|
|||||||
ProfileName(is_anon: is_anon)
|
ProfileName(is_anon: is_anon)
|
||||||
TimeDot()
|
TimeDot()
|
||||||
RelativeTime(time: state.events.get_cache_data(event.id).relative_time, size: size, font_size: state.settings.font_size)
|
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()
|
Spacer()
|
||||||
if !options.contains(.no_context_menu) {
|
if !options.contains(.no_context_menu) {
|
||||||
EventMenuContext(damus: state, event: event)
|
EventMenuContext(damus: state, event: event)
|
||||||
@@ -53,17 +50,3 @@ struct EventTop_Previews: PreviewProvider {
|
|||||||
EventTop(state: test_damus_state, event: test_note, pubkey: test_note.pubkey, is_anon: false, size: .normal, options: [])
|
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -58,10 +58,19 @@ struct SelectedEventView: View {
|
|||||||
|
|
||||||
Mention
|
Mention
|
||||||
|
|
||||||
|
HStack {
|
||||||
Text(verbatim: "\(format_date(created_at: event.created_at))")
|
Text(verbatim: "\(format_date(created_at: event.created_at))")
|
||||||
.padding([.top, .leading, .trailing])
|
|
||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
|
if let clientTag = event.clientTag {
|
||||||
|
Text(String(format: NSLocalizedString("via %@", comment: "Label indicating which client published the event"), clientTag.name))
|
||||||
|
.font(.footnote)
|
||||||
|
.foregroundColor(.gray)
|
||||||
|
.lineLimit(1)
|
||||||
|
.truncationMode(.tail)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding([.top, .leading, .trailing])
|
||||||
|
|
||||||
Divider()
|
Divider()
|
||||||
.padding([.bottom], 4)
|
.padding([.bottom], 4)
|
||||||
|
|||||||
Reference in New Issue
Block a user