ssb: Canceling loads, more mobile-friendly sidebar, and respond to channel subscription changes.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 16m30s

This commit is contained in:
2024-11-30 17:49:27 -05:00
parent 8e0d91dcf5
commit 3ca2b19502
4 changed files with 25 additions and 10 deletions

View File

@ -146,9 +146,10 @@ class TfTabNewsFeedElement extends LitElement {
async load_more() {
this.loading++;
this.loading_canceled = false;
try {
let more = [];
while (!more.length) {
while (!more.length && !this.loading_canceled) {
let last_start_time = this.start_time;
this.start_time = last_start_time - 7 * 24 * 60 * 60 * 1000;
more = await this.fetch_messages(this.start_time, last_start_time);
@ -160,6 +161,10 @@ class TfTabNewsFeedElement extends LitElement {
}
}
cancel_load() {
this.loading_canceled = true;
}
async decrypt(messages) {
console.log('decrypt');
let result = [];
@ -254,6 +259,9 @@ class TfTabNewsFeedElement extends LitElement {
<button ?disabled=${this.loading} class="w3-button w3-theme-d1" @click=${this.load_more}>
Load More
</button>
<button class=${'w3-button w3-theme-d1' + (this.loading ? '' : ' w3-hide')} @click=${this.cancel_load}>
Cancel
</button>
<span>Showing ${new Date(this.time_range[0]).toLocaleDateString()} - ${new Date(this.time_range[1]).toLocaleDateString()}.</span>
</p>
`;