mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
enable album nav play button
This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
<template>
|
||||
<div class="play-btn rounded shadow-sm" @click="playThis"></div>
|
||||
<div
|
||||
class="play-btn rounded shadow-sm"
|
||||
@click="usePlayFrom(source, useQStore, store)"
|
||||
></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
function playThis(e: Event) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
import { playSources } from "@/composables/enums";
|
||||
import useAlbumStore from "@/stores/album";
|
||||
import usePlaylistStore from "@/stores/p.ptracks";
|
||||
import usePlayFrom from "@/composables/usePlayFrom";
|
||||
import useQStore from "@/stores/queue";
|
||||
|
||||
defineProps<{
|
||||
source: playSources;
|
||||
store: typeof useAlbumStore | typeof usePlaylistStore;
|
||||
}>();
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.play-btn {
|
||||
|
||||
@@ -1,48 +1,29 @@
|
||||
<template>
|
||||
<div class="playbtnrect rounded" @click="play">
|
||||
<div
|
||||
class="playbtnrect rounded"
|
||||
@click="usePlayFrom(source, useQStore, store)"
|
||||
>
|
||||
<div class="icon image"></div>
|
||||
<div class="text">Play</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { playSources } from "../../composables/enums";
|
||||
import { playSources } from "@/composables/enums";
|
||||
import usePlayFrom from "@/composables/usePlayFrom";
|
||||
import useQStore from "@/stores/queue";
|
||||
import useFStore from "@/stores/folder";
|
||||
import useAStore from "@/stores/album";
|
||||
import usePStore from "@/stores/p.ptracks";
|
||||
|
||||
import useQStore from "../../stores/queue";
|
||||
import useFStore from "../../stores/folder";
|
||||
import useAStore from "../../stores/album";
|
||||
import usePStore from "../../stores/p.ptracks";
|
||||
|
||||
const props = defineProps<{
|
||||
defineProps<{
|
||||
source: playSources;
|
||||
store:
|
||||
| typeof useQStore
|
||||
| typeof useFStore
|
||||
| typeof useAStore
|
||||
| typeof usePStore;
|
||||
}>();
|
||||
|
||||
const queue = useQStore();
|
||||
const folder = useFStore();
|
||||
const album = useAStore();
|
||||
const playlist = usePStore();
|
||||
|
||||
function play() {
|
||||
switch (props.source) {
|
||||
// check which route the play request come from
|
||||
case playSources.folder:
|
||||
queue.playFromFolder(folder.path, folder.tracks);
|
||||
queue.play(queue.tracks[0]);
|
||||
break;
|
||||
case playSources.album:
|
||||
queue.playFromAlbum(album.info.title, album.info.artist, album.tracks);
|
||||
queue.play(album.tracks[0]);
|
||||
break;
|
||||
case playSources.playlist:
|
||||
queue.playFromPlaylist(
|
||||
playlist.info.name,
|
||||
playlist.info.playlistid,
|
||||
playlist.tracks
|
||||
);
|
||||
queue.play(playlist.tracks[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user