Skip to content

Commit

Permalink
use hashtag icon in hashtag col header
Browse files Browse the repository at this point in the history
Signed-off-by: kernelkind <[email protected]>
  • Loading branch information
kernelkind committed Dec 23, 2024
1 parent d7e7c75 commit 588bb8c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/notedeck_columns/src/timeline/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}
}
}
Expand Down
18 changes: 16 additions & 2 deletions crates/notedeck_columns/src/ui/column/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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) => {}
Expand Down

0 comments on commit 588bb8c

Please sign in to comment.