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
+1 -1
View File
@@ -27,7 +27,7 @@
: index + 1
"
@playThis="updateQueue(track.index !== undefined ? track.index : index)"
:isPlaying="queue.playing"
:isCurrentPlaying="queue.playing"
:isCurrent="queue.currentid == track.trackid"
/>
</div>
+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();
+9 -6
View File
@@ -22,7 +22,7 @@
<div
class="now-playing-track-indicator image"
v-if="isCurrent"
:class="{ last_played: !isPlaying }"
:class="{ last_played: !isCurrentPlaying }"
></div>
</div>
<div v-tooltip class="song-title">
@@ -67,16 +67,16 @@
</template>
<script setup lang="ts">
import { ref } from "vue";
import { onUpdated, ref } from "vue";
import { showTrackContextMenu as showContext } from "@/composables/context";
import { paths } from "@/config";
import { Track } from "@/interfaces";
import { formatSeconds } from "@/utils";
import { showTrackContextMenu as showContext } from "@/composables/context";
import ArtistName from "./ArtistName.vue";
import HeartSvg from "@/assets/icons/heart.svg";
import OptionSvg from "@/assets/icons/more.svg";
import ArtistName from "./ArtistName.vue";
const context_on = ref(false);
const imguri = paths.images.thumb.small;
@@ -87,8 +87,8 @@ const artisttitle = ref<HTMLElement | null>(null);
const props = defineProps<{
track: Track;
index: number | string;
isPlaying: Boolean;
isCurrent: Boolean;
isCurrentPlaying: Boolean;
}>();
const emit = defineEmits<{
@@ -102,6 +102,10 @@ function emitUpdate(track: Track) {
function showMenu(e: Event) {
showContext(e, props.track, options_button_clicked);
}
onUpdated(() => {
console.log(artisttitle.value);
});
</script>
<style lang="scss">
@@ -155,7 +159,6 @@ function showMenu(e: Event) {
width: 100%;
position: relative;
height: 3rem;
// border: solid 1px;
.text {
opacity: 1;
+2 -2
View File
@@ -19,7 +19,7 @@
<div
class="now-playing-track-indicator image"
v-if="isCurrent"
:class="{ last_played: !isPlaying }"
:class="{ last_played: !isCurrentPlaying }"
></div>
</div>
<div class="tags">
@@ -54,7 +54,7 @@ import ArtistName from "./ArtistName.vue";
const props = defineProps<{
track: Track;
isCurrent: boolean;
isPlaying: boolean;
isCurrentPlaying: boolean;
isQueueTrack?: boolean;
index?: number;
}>();