mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 13:03:02 +00:00
stabilize track components
This commit is contained in:
committed by
Mungai Njoroge
parent
9cbaa7ecff
commit
eb8c4e5628
@@ -27,7 +27,7 @@
|
|||||||
: index + 1
|
: index + 1
|
||||||
"
|
"
|
||||||
@playThis="updateQueue(track.index !== undefined ? track.index : index)"
|
@playThis="updateQueue(track.index !== undefined ? track.index : index)"
|
||||||
:isPlaying="queue.playing"
|
:isCurrentPlaying="queue.playing"
|
||||||
:isCurrent="queue.currentid == track.trackid"
|
:isCurrent="queue.currentid == track.trackid"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
:key="t.index"
|
:key="t.index"
|
||||||
:track="t.data"
|
:track="t.data"
|
||||||
:index="t.index"
|
:index="t.index"
|
||||||
:isPlaying="queue.playing"
|
:isCurrentPlaying="t.index === queue.currentindex && queue.playing"
|
||||||
:isCurrent="t.index === queue.currentindex"
|
:isCurrent="t.index === queue.currentindex"
|
||||||
:isQueueTrack="true"
|
:isQueueTrack="true"
|
||||||
@PlayThis="playFromQueue(t.index)"
|
@PlayThis="playFromQueue(t.index)"
|
||||||
@@ -24,10 +24,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, onMounted, onBeforeUnmount } from "vue";
|
|
||||||
import { useVirtualList } from "@vueuse/core";
|
import { useVirtualList } from "@vueuse/core";
|
||||||
|
import { computed, onBeforeUnmount, onMounted, ref } from "vue";
|
||||||
|
|
||||||
// import { focusElem } from "@/utils";
|
|
||||||
import useQStore from "@/stores/queue";
|
import useQStore from "@/stores/queue";
|
||||||
|
|
||||||
import TrackItem from "../shared/TrackItem.vue";
|
import TrackItem from "../shared/TrackItem.vue";
|
||||||
@@ -53,11 +52,11 @@ const {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
scrollTo(queue.currentindex);
|
scrollTo(queue.currentindex);
|
||||||
queue.setQueueFunction(scrollTo, mouseover);
|
queue.setScrollFunction(scrollTo, mouseover);
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
queue.setQueueFunction(() => {}, null);
|
queue.setScrollFunction(() => {}, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Handle focusing current track on song end
|
// TODO: Handle focusing current track on song end
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
<TrackComponent
|
<TrackComponent
|
||||||
v-for="(track, index) in search.tracks.value"
|
v-for="(track, index) in search.tracks.value"
|
||||||
:key="track.trackid"
|
:key="track.trackid"
|
||||||
:isCurrent="queue.currentid == track.trackid"
|
:isCurrent="queue.currentid === track.trackid"
|
||||||
:isHighlighted="false"
|
:isHighlighted="false"
|
||||||
:isPlaying="queue.playing"
|
:isCurrentPlaying="queue.currentid === track.trackid && queue.playing"
|
||||||
:track="track"
|
:track="track"
|
||||||
@playThis="updateQueue(index)"
|
@playThis="updateQueue(index)"
|
||||||
:index="index + 1"
|
:index="index + 1"
|
||||||
@@ -20,11 +20,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
|
|
||||||
import LoadMore from "./LoadMore.vue";
|
|
||||||
import TrackItem from "@/components/shared/TrackItem.vue";
|
|
||||||
import SongItem from "@/components/shared/SongItem.vue";
|
import SongItem from "@/components/shared/SongItem.vue";
|
||||||
|
import TrackItem from "@/components/shared/TrackItem.vue";
|
||||||
import useQStore from "@/stores/queue";
|
import useQStore from "@/stores/queue";
|
||||||
import useSearchStore from "@/stores/search";
|
import useSearchStore from "@/stores/search";
|
||||||
|
import LoadMore from "./LoadMore.vue";
|
||||||
|
|
||||||
const queue = useQStore();
|
const queue = useQStore();
|
||||||
const search = useSearchStore();
|
const search = useSearchStore();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<div
|
<div
|
||||||
class="now-playing-track-indicator image"
|
class="now-playing-track-indicator image"
|
||||||
v-if="isCurrent"
|
v-if="isCurrent"
|
||||||
:class="{ last_played: !isPlaying }"
|
:class="{ last_played: !isCurrentPlaying }"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div v-tooltip class="song-title">
|
<div v-tooltip class="song-title">
|
||||||
@@ -67,16 +67,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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 { paths } from "@/config";
|
||||||
import { Track } from "@/interfaces";
|
import { Track } from "@/interfaces";
|
||||||
import { formatSeconds } from "@/utils";
|
import { formatSeconds } from "@/utils";
|
||||||
import { showTrackContextMenu as showContext } from "@/composables/context";
|
|
||||||
|
|
||||||
import ArtistName from "./ArtistName.vue";
|
|
||||||
import HeartSvg from "@/assets/icons/heart.svg";
|
import HeartSvg from "@/assets/icons/heart.svg";
|
||||||
import OptionSvg from "@/assets/icons/more.svg";
|
import OptionSvg from "@/assets/icons/more.svg";
|
||||||
|
import ArtistName from "./ArtistName.vue";
|
||||||
|
|
||||||
const context_on = ref(false);
|
const context_on = ref(false);
|
||||||
const imguri = paths.images.thumb.small;
|
const imguri = paths.images.thumb.small;
|
||||||
@@ -87,8 +87,8 @@ const artisttitle = ref<HTMLElement | null>(null);
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
track: Track;
|
track: Track;
|
||||||
index: number | string;
|
index: number | string;
|
||||||
isPlaying: Boolean;
|
|
||||||
isCurrent: Boolean;
|
isCurrent: Boolean;
|
||||||
|
isCurrentPlaying: Boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -102,6 +102,10 @@ function emitUpdate(track: Track) {
|
|||||||
function showMenu(e: Event) {
|
function showMenu(e: Event) {
|
||||||
showContext(e, props.track, options_button_clicked);
|
showContext(e, props.track, options_button_clicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onUpdated(() => {
|
||||||
|
console.log(artisttitle.value);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@@ -155,7 +159,6 @@ function showMenu(e: Event) {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
// border: solid 1px;
|
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<div
|
<div
|
||||||
class="now-playing-track-indicator image"
|
class="now-playing-track-indicator image"
|
||||||
v-if="isCurrent"
|
v-if="isCurrent"
|
||||||
:class="{ last_played: !isPlaying }"
|
:class="{ last_played: !isCurrentPlaying }"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
@@ -54,7 +54,7 @@ import ArtistName from "./ArtistName.vue";
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
track: Track;
|
track: Track;
|
||||||
isCurrent: boolean;
|
isCurrent: boolean;
|
||||||
isPlaying: boolean;
|
isCurrentPlaying: boolean;
|
||||||
isQueueTrack?: boolean;
|
isQueueTrack?: boolean;
|
||||||
index?: number;
|
index?: number;
|
||||||
}>();
|
}>();
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
? t.data.index + 1
|
? t.data.index + 1
|
||||||
: t.index + 1
|
: t.index + 1
|
||||||
"
|
"
|
||||||
:isPlaying="queue.playing"
|
:isCurrent="queue.currentid === t.data.trackid"
|
||||||
:isCurrent="queue.currentid == t.data.trackid"
|
:isCurrentPlaying="queue.currentid === t.data.trackid && queue.playing"
|
||||||
@playThis="
|
@playThis="
|
||||||
updateQueue(t.data.index !== undefined ? t.data.index : t.index)
|
updateQueue(t.data.index !== undefined ? t.data.index : t.index)
|
||||||
"
|
"
|
||||||
@@ -40,8 +40,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from "vue";
|
|
||||||
import { useElementSize, useVirtualList } from "@vueuse/core";
|
import { useElementSize, useVirtualList } from "@vueuse/core";
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
|
||||||
import { Track } from "@/interfaces";
|
import { Track } from "@/interfaces";
|
||||||
import useQStore from "@/stores/queue";
|
import useQStore from "@/stores/queue";
|
||||||
|
|||||||
+3
-4
@@ -1,7 +1,6 @@
|
|||||||
import { Ref } from "vue";
|
|
||||||
import { focusElem } from "@/utils";
|
|
||||||
import { paths } from "@/config";
|
import { paths } from "@/config";
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
|
import { Ref } from "vue";
|
||||||
import { NotifType, useNotifStore } from "./notification";
|
import { NotifType, useNotifStore } from "./notification";
|
||||||
|
|
||||||
import { FromOptions } from "../composables/enums";
|
import { FromOptions } from "../composables/enums";
|
||||||
@@ -12,7 +11,7 @@ import {
|
|||||||
fromFolder,
|
fromFolder,
|
||||||
fromPlaylist,
|
fromPlaylist,
|
||||||
fromSearch,
|
fromSearch,
|
||||||
Track,
|
Track
|
||||||
} from "../interfaces";
|
} from "../interfaces";
|
||||||
|
|
||||||
function shuffle(tracks: Track[]) {
|
function shuffle(tracks: Track[]) {
|
||||||
@@ -245,7 +244,7 @@ export default defineStore("Queue", {
|
|||||||
removeFromQueue(index: number = 0) {
|
removeFromQueue(index: number = 0) {
|
||||||
this.tracklist.splice(index, 1);
|
this.tracklist.splice(index, 1);
|
||||||
},
|
},
|
||||||
setQueueFunction(
|
setScrollFunction(
|
||||||
cb: (index: number) => void,
|
cb: (index: number) => void,
|
||||||
mousover: Ref<boolean> | null
|
mousover: Ref<boolean> | null
|
||||||
) {
|
) {
|
||||||
|
|||||||
Reference in New Issue
Block a user