stabilize track components

This commit is contained in:
geoffrey45
2022-09-23 14:11:06 +03:00
committed by Mungai Njoroge
parent 9cbaa7ecff
commit eb8c4e5628
7 changed files with 28 additions and 27 deletions
+4 -5
View File
@@ -14,7 +14,7 @@
:key="t.index"
:track="t.data"
:index="t.index"
:isPlaying="queue.playing"
:isCurrentPlaying="t.index === queue.currentindex && queue.playing"
:isCurrent="t.index === queue.currentindex"
:isQueueTrack="true"
@PlayThis="playFromQueue(t.index)"
@@ -24,10 +24,9 @@
</template>
<script setup lang="ts">
import { computed, ref, onMounted, onBeforeUnmount } from "vue";
import { useVirtualList } from "@vueuse/core";
import { computed, onBeforeUnmount, onMounted, ref } from "vue";
// import { focusElem } from "@/utils";
import useQStore from "@/stores/queue";
import TrackItem from "../shared/TrackItem.vue";
@@ -53,11 +52,11 @@ const {
onMounted(() => {
scrollTo(queue.currentindex);
queue.setQueueFunction(scrollTo, mouseover);
queue.setScrollFunction(scrollTo, mouseover);
});
onBeforeUnmount(() => {
queue.setQueueFunction(() => {}, null);
queue.setScrollFunction(() => {}, null);
});
// TODO: Handle focusing current track on song end
@@ -4,9 +4,9 @@
<TrackComponent
v-for="(track, index) in search.tracks.value"
:key="track.trackid"
:isCurrent="queue.currentid == track.trackid"
:isCurrent="queue.currentid === track.trackid"
:isHighlighted="false"
:isPlaying="queue.playing"
:isCurrentPlaying="queue.currentid === track.trackid && queue.playing"
:track="track"
@playThis="updateQueue(index)"
:index="index + 1"
@@ -18,13 +18,13 @@
</template>
<script setup lang="ts">
import { computed } from "vue";
import LoadMore from "./LoadMore.vue";
import TrackItem from "@/components/shared/TrackItem.vue";
import { computed } from "vue";
import SongItem from "@/components/shared/SongItem.vue";
import TrackItem from "@/components/shared/TrackItem.vue";
import useQStore from "@/stores/queue";
import useSearchStore from "@/stores/search";
import LoadMore from "./LoadMore.vue";
const queue = useQStore();
const search = useSearchStore();