feat(web): compressable results for text search too

This commit is contained in:
əlemi 2024-08-11 15:23:21 +02:00
parent 01de917bdb
commit a4e807fc3b
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -45,7 +45,7 @@ pub fn SearchPage() -> impl IntoView {
<blockquote class="mt-3 mb-3"> <blockquote class="mt-3 mb-3">
<details open> <details open>
<summary class="mb-2"> <summary class="mb-2">
<code class="cw center color ml-s w-100">users</code> <code class="cw center color ml-s w-100">actor</code>
</summary> </summary>
<div class="pb-1"> <div class="pb-1">
{move || match user.get() { {move || match user.get() {
@ -60,7 +60,7 @@ pub fn SearchPage() -> impl IntoView {
<blockquote class="mt-3 mb-3"> <blockquote class="mt-3 mb-3">
<details open> <details open>
<summary class="mb-2"> <summary class="mb-2">
<code class="cw center color ml-s w-100">objects</code> <code class="cw center color ml-s w-100">object</code>
</summary> </summary>
<div class="pb-1"> <div class="pb-1">
{move || match object.get() { {move || match object.get() {
@ -72,24 +72,33 @@ pub fn SearchPage() -> impl IntoView {
</details> </details>
</blockquote> </blockquote>
{move || match text_search.get() { <blockquote class="mt-3 mb-3">
None => Some(view! { <p class="center"><small>searching...</small></p> }.into_view()), <details open>
Some(None) => None, <summary class="mb-2">
Some(Some(items)) => Some(view! { <code class="cw center color ml-s w-100">full text</code>
// TODO ughhh too many clones </summary>
<For <div class="pb-1">
each=move || items.clone() {move || match text_search.get() {
key=|id| id.clone() None => Some(view! { <p class="center"><small>searching...</small></p> }.into_view()),
children=move |item| { Some(None) => None,
cache::OBJECTS.get(&item) Some(Some(items)) => Some(view! {
.map(|x| view! { // TODO ughhh too many clones
<Item item=x /> <For
<hr /> each=move || items.clone()
}.into_view() key=|id| id.clone()
) children=move |item| {
} cache::OBJECTS.get(&item)
/ > .map(|x| view! {
}.into_view()) <Item item=x />
}} <hr />
}.into_view()
)
}
/ >
}.into_view())
}}
</div>
</details>
</blockquote>
} }
} }