search: improve search column header

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-02-22 20:01:23 -08:00
parent f7c1a39bc1
commit d19e4b1d2b
4 changed files with 11 additions and 5 deletions

View File

@@ -6,7 +6,7 @@ use tokenator::{ParseError, TokenParser, TokenSerializable, TokenWriter};
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
pub struct SearchQuery {
author: Option<Pubkey>,
search: String,
pub search: String,
}
impl TokenSerializable for SearchQuery {

View File

@@ -588,7 +588,9 @@ impl TimelineKind {
pub fn to_title(&self) -> ColumnTitle<'_> {
match self {
TimelineKind::Search(_query) => ColumnTitle::simple("Search"),
TimelineKind::Search(query) => {
ColumnTitle::formatted(format!("Search \"{}\"", query.search))
}
TimelineKind::List(list_kind) => match list_kind {
ListKind::Contact(_pubkey_source) => ColumnTitle::simple("Contacts"),
},

View File

@@ -434,9 +434,14 @@ impl<'a> NavTitle<'a> {
// no pfp for threads
}
TimelineKind::Search(_sq) => {
// TODO: show author pfp if author field set?
ui.add(ui::side_panel::search_button());
}
TimelineKind::Universe
| TimelineKind::Algo(_)
| TimelineKind::Search(_)
| TimelineKind::Notifications(_)
| TimelineKind::Generic(_)
| TimelineKind::List(_) => {

View File

@@ -487,8 +487,7 @@ fn compose_note_button(interactive: bool, dark_mode: bool) -> impl Widget {
}
}
#[allow(unused)]
fn search_button() -> impl Widget {
pub fn search_button() -> impl Widget {
|ui: &mut egui::Ui| -> egui::Response {
let max_size = ICON_WIDTH * ICON_EXPANSION_MULTIPLE; // max size of the widget
let min_line_width_circle = 1.5; // width of the magnifying glass