diff --git a/web/src/page/search.rs b/web/src/page/search.rs index e32444e..accad30 100644 --- a/web/src/page/search.rs +++ b/web/src/page/search.rs @@ -1,5 +1,6 @@ use std::sync::Arc; +use apb::{Base, Collection}; use leptos::*; use leptos_router::*; use crate::prelude::*; @@ -24,6 +25,14 @@ pub fn SearchPage() -> impl IntoView { } ); + let text_search = create_local_resource( + move || use_query_map().get().get("q").cloned().unwrap_or_default(), + move |q| { + let search = format!("{URL_BASE}/search?q={q}"); + async move { Http::fetch::(&search, auth).await.ok() } + } + ); + view! {
@@ -54,5 +63,24 @@ pub fn SearchPage() -> impl IntoView {
+ + {move || match text_search.get() { + None => Some(view! {

searching...

}.into_view()), + Some(None) => None, + Some(Some(items)) => Some(view! { + // TODO this is jank af! i should do the same thing i do for timelines, aka first process + // all items and store in cache and then pass a vec of strings here!!! + +
+ }.into_view() + } + / > + }.into_view()) + }} } }