notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 588bb8c5b22cc890506d00cff9473eced07a4eea
parent d7e7c75b8945374d566e35dbb301dff0e5e7c27b
Author: kernelkind <kernelkind@gmail.com>
Date:   Mon, 23 Dec 2024 16:15:08 -0500

use hashtag icon in hashtag col header

Signed-off-by: kernelkind <kernelkind@gmail.com>

Diffstat:
Mcrates/notedeck_columns/src/timeline/kind.rs | 2+-
Mcrates/notedeck_columns/src/ui/column/header.rs | 18++++++++++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/crates/notedeck_columns/src/timeline/kind.rs b/crates/notedeck_columns/src/timeline/kind.rs @@ -215,7 +215,7 @@ impl TimelineKind { TimelineKind::Profile(_pubkey_source) => ColumnTitle::needs_db(self), TimelineKind::Universe => ColumnTitle::simple("Universe"), TimelineKind::Generic => ColumnTitle::simple("Custom"), - TimelineKind::Hashtag(hashtag) => ColumnTitle::formatted(format!("#{}", hashtag)), + TimelineKind::Hashtag(hashtag) => ColumnTitle::formatted(hashtag.to_string()), } } } diff --git a/crates/notedeck_columns/src/ui/column/header.rs b/crates/notedeck_columns/src/ui/column/header.rs @@ -2,7 +2,7 @@ use crate::{ column::Columns, nav::RenderNavAction, route::Route, - timeline::{ColumnTitle, TimelineId, TimelineRoute}, + timeline::{ColumnTitle, TimelineId, TimelineKind, TimelineRoute}, ui::{ self, anim::{AnimationHelper, ICON_EXPANSION_MULTIPLE}, @@ -195,7 +195,21 @@ impl<'a> NavTitle<'a> { match top { Route::Timeline(tlr) => match tlr { TimelineRoute::Timeline(tlid) => { - self.timeline_pfp(ui, *tlid, pfp_size); + let is_hashtag = self + .columns + .find_timeline(*tlid) + .map_or(false, |tl| matches!(tl.kind, TimelineKind::Hashtag(_))); + + if is_hashtag { + ui.add( + egui::Image::new(egui::include_image!( + "../../../../../assets/icons/hashtag_icon_4x.png" + )) + .fit_to_exact_size(egui::vec2(pfp_size, pfp_size)), + ); + } else { + self.timeline_pfp(ui, *tlid, pfp_size); + } } TimelineRoute::Thread(_note_id) => {}