ssb: Better search feedback.

This commit is contained in:
2025-12-09 18:43:52 -05:00
parent 192e9e0955
commit d67297c35b
2 changed files with 14 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🦀", "emoji": "🦀",
"previous": "&Do4vIjdE5vJgJ+fIZ10zOeDQcqNd+VUacQl2wzRjGhw=.sha256" "previous": "&8uDmJfrjfiVcvxJlkYli5PqLnO8Xje/1qDVtzAXA7A4=.sha256"
} }

View File

@@ -1,4 +1,4 @@
import {LitElement, html, unsafeHTML} from './lit-all.min.js'; import {LitElement, html, unsafeHTML, until} from './lit-all.min.js';
import * as tfrpc from '/static/tfrpc.js'; import * as tfrpc from '/static/tfrpc.js';
import {styles, generate_theme} from './tf-styles.js'; import {styles, generate_theme} from './tf-styles.js';
@@ -133,17 +133,25 @@ class TfTabSearchElement extends LitElement {
} }
} }
render() { async query_results() {
if (this.query !== this.last_query) { if (this.query !== this.last_query) {
this.last_query = this.query; this.last_query = this.query;
this.search(this.query); this._query = this.search(this.query);
} }
let self = this; await this._query;
}
render() {
return html` return html`
<style> <style>
${generate_theme()} ${generate_theme()}
</style> </style>
<div class="w3-padding">${this.render_results()}</div> <div class="w3-padding">
${until(
this.query_results().then(this.render_results.bind(this)),
html`<p>Searching...<span class="w3-animate-fading">🦀</span></p>`
)}
</div>
`; `;
} }
} }