From 191ac0bc7b8730826d402df75ec3342619270e38 Mon Sep 17 00:00:00 2001 From: geoffrey45 Date: Sat, 11 Jun 2022 10:01:16 +0300 Subject: [PATCH] fix loadmore counter not resetting - store load more counter in search store --- src/assets/css/global.scss | 7 +++--- src/components/RightSideBar/Main.vue | 7 +++--- src/components/RightSideBar/Queue.vue | 1 - .../RightSideBar/Search/AlbumGrid.vue | 8 +++--- .../RightSideBar/Search/ArtistGrid.vue | 8 +++--- .../RightSideBar/Search/TracksGrid.vue | 5 ++-- src/components/shared/ArtistCard.vue | 12 ++++++--- src/composables/usePlayFrom.ts | 1 - src/stores/search.ts | 25 +++++++++++++++++++ 9 files changed, 47 insertions(+), 27 deletions(-) diff --git a/src/assets/css/global.scss b/src/assets/css/global.scss index 35c60c8..eded3d6 100644 --- a/src/assets/css/global.scss +++ b/src/assets/css/global.scss @@ -21,8 +21,6 @@ body { image-rendering: -webkit-optimize-contrast; } - - .heading { font-size: 2rem; font-weight: bold; @@ -87,9 +85,10 @@ a { } } -.gsearch-input { +#gsearch-input { grid-area: search-input; - border-left: solid 1px $gray3; + // border-left: solid 1px $gray3; + // border-bottom: 1px solid $gray3; } .topnav { diff --git a/src/components/RightSideBar/Main.vue b/src/components/RightSideBar/Main.vue index dd431a4..d7db01f 100644 --- a/src/components/RightSideBar/Main.vue +++ b/src/components/RightSideBar/Main.vue @@ -20,10 +20,9 @@ @@ -31,7 +30,7 @@ const tabs = useTabStore(); .r-sidebar { width: 29em; background-color: rgba(4, 12, 34, 0.103); - padding: 0 0 0 $small; + padding: 0 $small; @include phone-only { display: none; diff --git a/src/components/RightSideBar/Queue.vue b/src/components/RightSideBar/Queue.vue index c13b876..2f29080 100644 --- a/src/components/RightSideBar/Queue.vue +++ b/src/components/RightSideBar/Queue.vue @@ -33,7 +33,6 @@ function playThis(track: Track) { diff --git a/src/composables/usePlayFrom.ts b/src/composables/usePlayFrom.ts index 23f6344..825a668 100644 --- a/src/composables/usePlayFrom.ts +++ b/src/composables/usePlayFrom.ts @@ -4,7 +4,6 @@ import useFStore from "@/stores/pages/folder"; import usePStore from "@/stores/pages/playlist"; import useQStore from "@/stores/queue"; - const queue = useQStore; const folder = useFStore; const album = useAStore; diff --git a/src/stores/search.ts b/src/stores/search.ts index 29a5b08..4bdcb1c 100644 --- a/src/stores/search.ts +++ b/src/stores/search.ts @@ -29,6 +29,11 @@ function scrollOnLoad() { export default defineStore("search", () => { const query = useDebouncedRef(null, 600); const currentTab = ref("tracks"); + const loadCounter = reactive({ + tracks: 0, + albums: 0, + artists: 0, + }); const tracks = reactive({ query: "", @@ -118,9 +123,27 @@ export default defineStore("search", () => { .then(() => scrollOnLoad()); } + function updateLoadCounter(type: string, value: number) { + switch (type) { + case "tracks": + loadCounter.tracks += value; + break; + case "albums": + loadCounter.albums += value; + break; + case "artists": + loadCounter.artists += value; + break; + } + } + watch( () => query.value, (newQuery) => { + for (const key in loadCounter) { + loadCounter[key] = 0; + } + const tabs = useTabStore(); if (tabs.current !== "search") { @@ -183,6 +206,8 @@ export default defineStore("search", () => { artists, query, currentTab, + loadCounter, + updateLoadCounter, loadTracks, loadAlbums, loadArtists,