route: add Search route and hook up SearchView

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-03-07 10:54:43 -08:00
parent 9edc9bf4a5
commit c2545d17e7
5 changed files with 49 additions and 1 deletions

View File

@@ -308,7 +308,10 @@ impl TimelineKind {
// the parser below as well
pub fn serialize_tokens(&self, writer: &mut TokenWriter) {
match self {
TimelineKind::Search(query) => query.serialize_tokens(writer),
TimelineKind::Search(query) => {
writer.write_token("search");
query.serialize_tokens(writer)
}
TimelineKind::List(list_kind) => list_kind.serialize_tokens(writer),
TimelineKind::Algo(algo_timeline) => algo_timeline.serialize_tokens(writer),
TimelineKind::Notifications(pk) => {
@@ -394,6 +397,11 @@ impl TimelineKind {
p.parse_token("hashtag")?;
Ok(TimelineKind::Hashtag(p.pull_token()?.to_string()))
},
|p| {
p.parse_token("search")?;
let search_query = SearchQuery::parse_from_tokens(p)?;
Ok(TimelineKind::Search(search_query))
},
],
)
}