mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
feat: add a cranky scroll to current in queue method
+ fix: media notification image url
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, onMounted } from "vue";
|
import { computed, ref, onMounted, onBeforeUnmount } from "vue";
|
||||||
import { useVirtualList } from "@vueuse/core";
|
import { useVirtualList } from "@vueuse/core";
|
||||||
|
|
||||||
// import { focusElem } from "@/utils";
|
// import { focusElem } from "@/utils";
|
||||||
@@ -53,6 +53,11 @@ const {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
scrollTo(queue.currentindex);
|
scrollTo(queue.currentindex);
|
||||||
|
queue.setQueueFunction(scrollTo, mouseover);
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
queue.setQueueFunction(() => {}, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Handle focusing current track on song end
|
// TODO: Handle focusing current track on song end
|
||||||
@@ -64,7 +69,6 @@ onMounted(() => {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
.inner {
|
.inner {
|
||||||
// scrollbar-color: grey transparent;
|
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<input
|
<input
|
||||||
id="globalsearch"
|
id="globalsearch"
|
||||||
v-model.trim="search.query"
|
v-model.trim="search.query"
|
||||||
placeholder="Search your library"
|
placeholder="Type to search"
|
||||||
type="search"
|
type="search"
|
||||||
@blur.prevent="removeFocusedClass"
|
@blur.prevent="removeFocusedClass"
|
||||||
@focus.prevent="addFocusedClass"
|
@focus.prevent="addFocusedClass"
|
||||||
|
|||||||
@@ -6,38 +6,39 @@ export default () => {
|
|||||||
if ("mediaSession" in navigator) {
|
if ("mediaSession" in navigator) {
|
||||||
const queue = useQueueStore();
|
const queue = useQueueStore();
|
||||||
const { currenttrack: track } = queue;
|
const { currenttrack: track } = queue;
|
||||||
|
const url = paths.images.thumb.large
|
||||||
|
|
||||||
navigator.mediaSession.metadata = new window.MediaMetadata({
|
navigator.mediaSession.metadata = new window.MediaMetadata({
|
||||||
title: track.title,
|
title: track.title,
|
||||||
artist: track.artist.join(", "),
|
artist: track.artist.join(", "),
|
||||||
artwork: [
|
artwork: [
|
||||||
{
|
{
|
||||||
src: paths.images.thumb + track.image,
|
src: url + track.image,
|
||||||
sizes: "96x96",
|
sizes: "96x96",
|
||||||
type: "image/jpeg",
|
type: "image/jpeg",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: paths.images.thumb + track.image,
|
src: url + track.image,
|
||||||
sizes: "128x128",
|
sizes: "128x128",
|
||||||
type: "image/webp",
|
type: "image/webp",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: paths.images.thumb + track.image,
|
src: url + track.image,
|
||||||
sizes: "192x192",
|
sizes: "192x192",
|
||||||
type: "image/webp",
|
type: "image/webp",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: paths.images.thumb + track.image,
|
src: url + track.image,
|
||||||
sizes: "256x256",
|
sizes: "256x256",
|
||||||
type: "image/webp",
|
type: "image/webp",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: paths.images.thumb + track.image,
|
src: url + track.image,
|
||||||
sizes: "384x384",
|
sizes: "384x384",
|
||||||
type: "image/webp",
|
type: "image/webp",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: paths.images.thumb + track.image,
|
src: url + track.image,
|
||||||
sizes: "512x512",
|
sizes: "512x512",
|
||||||
type: "image/webp",
|
type: "image/webp",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { Ref } from "vue";
|
||||||
import { focusElem } from "@/utils";
|
import { focusElem } from "@/utils";
|
||||||
import { paths } from "@/config";
|
import { paths } from "@/config";
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
@@ -38,11 +39,18 @@ export default defineStore("Queue", {
|
|||||||
playing: false,
|
playing: false,
|
||||||
from: {} as From,
|
from: {} as From,
|
||||||
tracklist: [] as Track[],
|
tracklist: [] as Track[],
|
||||||
|
queueScrollFunction: (index: number) => {},
|
||||||
|
mousover: <Ref | null>null,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
play(index: number = 0) {
|
play(index: number = 0) {
|
||||||
if (this.tracklist.length === 0) return;
|
if (this.tracklist.length === 0) return;
|
||||||
this.currentindex = index;
|
this.currentindex = index;
|
||||||
|
|
||||||
|
if (!this.mousover) {
|
||||||
|
this.queueScrollFunction(this.currentindex - 1);
|
||||||
|
}
|
||||||
|
|
||||||
const track = this.tracklist[index];
|
const track = this.tracklist[index];
|
||||||
this.currentid = track.trackid;
|
this.currentid = track.trackid;
|
||||||
const uri = `${paths.api.files}/${track.hash}`;
|
const uri = `${paths.api.files}/${track.hash}`;
|
||||||
@@ -237,6 +245,13 @@ export default defineStore("Queue", {
|
|||||||
removeFromQueue(index: number = 0) {
|
removeFromQueue(index: number = 0) {
|
||||||
this.tracklist.splice(index, 1);
|
this.tracklist.splice(index, 1);
|
||||||
},
|
},
|
||||||
|
setQueueFunction(
|
||||||
|
cb: (index: number) => void,
|
||||||
|
mousover: Ref<boolean> | null
|
||||||
|
) {
|
||||||
|
this.queueScrollFunction = cb;
|
||||||
|
this.mousover = mousover;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
next(): Track {
|
next(): Track {
|
||||||
|
|||||||
Reference in New Issue
Block a user