From 25eccde5c36cb38b24bad1528f67516fc26e83fd Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Mon, 3 Jul 2023 11:53:28 -0400 Subject: [PATCH] Loading indicator for search page in web app --- CHANGELOG.md | 3 ++- playlet-web/src/lib/ScreenSearch.svelte | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae3d1bf0..1ccd763f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- links to the app info in web app +- Links to the app info in web app +- Loading indicator for search page in web app ### Fixed diff --git a/playlet-web/src/lib/ScreenSearch.svelte b/playlet-web/src/lib/ScreenSearch.svelte index 6b02037f..4981fce3 100644 --- a/playlet-web/src/lib/ScreenSearch.svelte +++ b/playlet-web/src/lib/ScreenSearch.svelte @@ -14,6 +14,7 @@ let suggestions: { suggestions: any[] } = { suggestions: [] }; let videos = []; let searchHistory = []; + let isLoading = false; playletStateStore.subscribe((value) => { invidiousApi.instance = value?.invidious?.current_instance; @@ -76,7 +77,13 @@ return; } - videos = await invidiousApi.search(searchBoxText); + try { + isLoading = true; + videos = await invidiousApi.search(searchBoxText); + } finally { + isLoading = false; + } + const newSearchHistory = await PlayletApi.putSearchHistory(searchBoxText); searchHistoryStore.set(newSearchHistory); } @@ -134,6 +141,12 @@
+ {#if isLoading} +
+ +
+ {/if} +