mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
modify queue page to use the correct track component
This commit is contained in:
@@ -122,11 +122,11 @@ function updateQueue(track: Track) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
switch (routename) {
|
switch (routename) {
|
||||||
case "FolderView":
|
case Routes.folder:
|
||||||
queue.playFromFolder(props.path || "", props.tracks);
|
queue.playFromFolder(props.path || "", props.tracks);
|
||||||
queue.play(index);
|
queue.play(index);
|
||||||
break;
|
break;
|
||||||
case "AlbumView":
|
case Routes.album:
|
||||||
const tindex = album.tracks.findIndex((t) => t.trackid === track.trackid);
|
const tindex = album.tracks.findIndex((t) => t.trackid === track.trackid);
|
||||||
|
|
||||||
queue.playFromAlbum(
|
queue.playFromAlbum(
|
||||||
@@ -137,7 +137,7 @@ function updateQueue(track: Track) {
|
|||||||
);
|
);
|
||||||
queue.play(tindex);
|
queue.play(tindex);
|
||||||
break;
|
break;
|
||||||
case "PlaylistView":
|
case Routes.playlist:
|
||||||
queue.playFromPlaylist(
|
queue.playFromPlaylist(
|
||||||
props.pname || "",
|
props.pname || "",
|
||||||
props.playlistid || "",
|
props.playlistid || "",
|
||||||
|
|||||||
@@ -3,20 +3,15 @@
|
|||||||
<div class="r-grid">
|
<div class="r-grid">
|
||||||
<div class="scrollable-r rounded">
|
<div class="scrollable-r rounded">
|
||||||
<QueueActions />
|
<QueueActions />
|
||||||
<div
|
<div class="inner">
|
||||||
class="inner"
|
<TrackComponent
|
||||||
@mouseenter="setMouseOver(true)"
|
|
||||||
@mouseleave="setMouseOver(false)"
|
|
||||||
>
|
|
||||||
<TrackItem
|
|
||||||
v-for="(t, index) in queue.tracklist"
|
v-for="(t, index) in queue.tracklist"
|
||||||
:key="index"
|
:key="index"
|
||||||
:track="t"
|
:track="t"
|
||||||
@playThis="queue.play(index)"
|
:index="index + 1"
|
||||||
:isCurrent="index === queue.currentindex"
|
|
||||||
:isPlaying="queue.playing"
|
:isPlaying="queue.playing"
|
||||||
:isQueueTrack="true"
|
:isHighlighted="false"
|
||||||
:index="index"
|
:isCurrent="index === queue.currentindex"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -25,14 +20,27 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onUpdated, ref } from "vue";
|
import { computed, onUpdated, ref } from "vue";
|
||||||
|
|
||||||
import useQStore from "@/stores/queue";
|
import useQStore from "@/stores/queue";
|
||||||
import { focusElem } from "@/utils";
|
import { focusElem } from "@/utils";
|
||||||
|
|
||||||
import TrackItem from "../shared/TrackItem.vue";
|
import TrackItem from "../shared/TrackItem.vue";
|
||||||
|
import SongItem from "../shared/SongItem.vue";
|
||||||
import QueueActions from "./Queue/QueueActions.vue";
|
import QueueActions from "./Queue/QueueActions.vue";
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
isOnQueuePage?: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const TrackComponent = computed(() => {
|
||||||
|
if (props.isOnQueuePage) {
|
||||||
|
return SongItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TrackItem;
|
||||||
|
});
|
||||||
|
|
||||||
const queue = useQStore();
|
const queue = useQStore();
|
||||||
const mouseover = ref(false);
|
const mouseover = ref(false);
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="tracks-results">
|
<div id="tracks-results">
|
||||||
<div v-if="search.tracks.value.length">
|
<div v-if="search.tracks.value.length">
|
||||||
<div v-if="use_song_item">
|
<div>
|
||||||
<SongItem
|
<TrackComponent
|
||||||
v-for="track 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"
|
:isPlaying="queue.playing"
|
||||||
:track="track"
|
:track="track"
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<TrackItem
|
|
||||||
v-for="(track, index) in search.tracks.value"
|
|
||||||
:key="track.trackid"
|
|
||||||
:track="track"
|
|
||||||
:isPlaying="queue.playing"
|
|
||||||
:isCurrent="queue.currentid == track.trackid"
|
|
||||||
:isSearchTrack="true"
|
|
||||||
@PlayThis="updateQueue(index)"
|
@PlayThis="updateQueue(index)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -34,6 +24,7 @@ import TrackItem from "@/components/shared/TrackItem.vue";
|
|||||||
import SongItem from "@/components/shared/SongItem.vue";
|
import SongItem from "@/components/shared/SongItem.vue";
|
||||||
import useQStore from "../../../stores/queue";
|
import useQStore from "../../../stores/queue";
|
||||||
import useSearchStore from "../../../stores/search";
|
import useSearchStore from "../../../stores/search";
|
||||||
|
import { computed } from "vue";
|
||||||
|
|
||||||
const queue = useQStore();
|
const queue = useQStore();
|
||||||
const search = useSearchStore();
|
const search = useSearchStore();
|
||||||
@@ -47,6 +38,14 @@ const props = defineProps<{
|
|||||||
isOnSearchPage?: boolean;
|
isOnSearchPage?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const TrackComponent = computed(() => {
|
||||||
|
if (props.isOnSearchPage) {
|
||||||
|
return SongItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TrackItem;
|
||||||
|
});
|
||||||
|
|
||||||
let use_song_item: boolean = false;
|
let use_song_item: boolean = false;
|
||||||
|
|
||||||
if (props.isOnSearchPage) {
|
if (props.isOnSearchPage) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="queue-view">
|
<div class="queue-view">
|
||||||
<Queue />
|
<Queue :isOnQueuePage="true" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user