mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
add bottom padding to v-scroll-page class instead of individual pages
+ Rewrite queue page with @Akryum/vue-virtual-scroller
This commit is contained in:
committed by
Mungai Njoroge
parent
858e59f81c
commit
ed7f26c12b
@@ -93,6 +93,7 @@ $g-border: solid 1px $gray5;
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-right: $small !important;
|
padding-right: $small !important;
|
||||||
|
padding-bottom: $content-padding-bottom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<QueueActions />
|
<QueueActions />
|
||||||
<div
|
<div
|
||||||
class="queue-virtual-scroller"
|
class="queue-virtual-scroller"
|
||||||
style="height: 100%"
|
|
||||||
@mouseover="mouseover = true"
|
@mouseover="mouseover = true"
|
||||||
@mouseout="mouseover = false"
|
@mouseout="mouseover = false"
|
||||||
>
|
>
|
||||||
@@ -39,8 +38,8 @@ const mouseover = ref(false);
|
|||||||
|
|
||||||
const scrollerItems = computed(() => {
|
const scrollerItems = computed(() => {
|
||||||
return queue.tracklist.map((track) => ({
|
return queue.tracklist.map((track) => ({
|
||||||
|
track,
|
||||||
id: Math.random(),
|
id: Math.random(),
|
||||||
track: track,
|
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -100,8 +100,6 @@ function showMenu(e: Event) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
||||||
|
|
||||||
.songlist-item {
|
.songlist-item {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1.5rem 2fr 1fr 1.5fr 2.5rem 2.5rem;
|
grid-template-columns: 1.5rem 2fr 1fr 1.5fr 2.5rem 2.5rem;
|
||||||
@@ -233,4 +231,8 @@ function showMenu(e: Event) {
|
|||||||
border-radius: 0 $small $small 0;
|
border-radius: 0 $small $small 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.songlist-item.current {
|
||||||
|
background-color: $gray;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="album-tracks rounded">
|
|
||||||
<div v-for="(disc, key) in discs" class="album-disc">
|
|
||||||
<SongList
|
|
||||||
:key="key"
|
|
||||||
:tracks="disc"
|
|
||||||
:on_album_page="true"
|
|
||||||
:disc="key"
|
|
||||||
:copyright="isLastDisc(key) ? copyright : null"
|
|
||||||
@playFromPage="playFromAlbumPage"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// @stores
|
|
||||||
import useQueueStore from "@/stores/queue";
|
|
||||||
import useAlbumStore from "@/stores/pages/album";
|
|
||||||
|
|
||||||
// @utils
|
|
||||||
import { Track } from "@/interfaces";
|
|
||||||
|
|
||||||
// @components
|
|
||||||
import SongList from "@/components/FolderView/SongList.vue";
|
|
||||||
|
|
||||||
// @setup
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
discs: {
|
|
||||||
[key: string]: Track[];
|
|
||||||
};
|
|
||||||
copyright?: string;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const queue = useQueueStore();
|
|
||||||
const album = useAlbumStore();
|
|
||||||
|
|
||||||
// check if the disc is the last disc
|
|
||||||
const isLastDisc = (disc: string | number) => {
|
|
||||||
const discs = Object.keys(props.discs);
|
|
||||||
return discs[discs.length - 1] === disc;
|
|
||||||
};
|
|
||||||
|
|
||||||
function playFromAlbumPage(index: number) {
|
|
||||||
const { title, artist, hash } = album.info;
|
|
||||||
queue.playFromAlbum(title, artist, hash, album.allTracks);
|
|
||||||
queue.play(index);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.album-tracks {
|
|
||||||
display: grid;
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -21,9 +21,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from "@vue/reactivity";
|
import { computed } from "@vue/reactivity";
|
||||||
import {
|
import {
|
||||||
onBeforeRouteLeave,
|
onBeforeRouteLeave,
|
||||||
onBeforeRouteUpdate,
|
onBeforeRouteUpdate,
|
||||||
RouteLocationNormalized
|
RouteLocationNormalized,
|
||||||
} from "vue-router";
|
} from "vue-router";
|
||||||
|
|
||||||
import { Track } from "@/interfaces";
|
import { Track } from "@/interfaces";
|
||||||
@@ -104,10 +104,6 @@ onBeforeRouteLeave(() => {
|
|||||||
.album-virtual-scroller {
|
.album-virtual-scroller {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
.scroller {
|
|
||||||
padding-bottom: $content-padding-bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
.songlist-item {
|
.songlist-item {
|
||||||
grid-template-columns: 1.5rem 1.5fr 1fr 2.5rem 2.5rem;
|
grid-template-columns: 1.5rem 1.5fr 1fr 2.5rem 2.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="folder-view v-scroll-page" :class="{ isSmall, isMedium }">
|
<div
|
||||||
|
class="folder-view v-scroll-page"
|
||||||
|
style="height: 100%"
|
||||||
|
:class="{ isSmall, isMedium }"
|
||||||
|
>
|
||||||
<DynamicScroller
|
<DynamicScroller
|
||||||
:items="scrollerItems"
|
:items="scrollerItems"
|
||||||
:min-item-size="64"
|
:min-item-size="64"
|
||||||
class="scroller"
|
class="scroller"
|
||||||
|
style="height: 100%"
|
||||||
>
|
>
|
||||||
<template v-slot="{ item, index, active }">
|
<template v-slot="{ item, index, active }">
|
||||||
<DynamicScrollerItem
|
<DynamicScrollerItem
|
||||||
@@ -106,14 +111,3 @@ onBeforeRouteLeave(() => {
|
|||||||
setTimeout(() => folder.resetQuery(), 500);
|
setTimeout(() => folder.resetQuery(), 500);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.folder-view {
|
|
||||||
height: 100%;
|
|
||||||
|
|
||||||
.scroller {
|
|
||||||
height: 100%;
|
|
||||||
padding-bottom: $content-padding-bottom !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
class="playlist-virtual-scroller v-scroll-page"
|
class="playlist-virtual-scroller v-scroll-page"
|
||||||
:class="{ isSmall, isMedium }"
|
:class="{ isSmall, isMedium }"
|
||||||
|
style="height: 100%"
|
||||||
>
|
>
|
||||||
<RecycleScroller
|
<RecycleScroller
|
||||||
class="scroller"
|
class="scroller"
|
||||||
@@ -9,6 +10,7 @@
|
|||||||
:item-size="null"
|
:item-size="null"
|
||||||
key-field="id"
|
key-field="id"
|
||||||
v-slot="{ item }"
|
v-slot="{ item }"
|
||||||
|
style="height: 100%"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
:is="item.component"
|
:is="item.component"
|
||||||
@@ -80,16 +82,3 @@ onBeforeRouteLeave(() => {
|
|||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.playlist-virtual-scroller {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
.scroller {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
padding-bottom: $content-padding-bottom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
+51
-12
@@ -1,29 +1,60 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="queue-view" style="height: 100%">
|
<div
|
||||||
<Layout
|
class="queue-view-virtual-scroller v-scroll-page"
|
||||||
:tracks="queue.tracklist"
|
:class="{ isSmall, isMedium }"
|
||||||
:no_header="true"
|
style="height: 100%"
|
||||||
@playFromPage="playFromQueue"
|
>
|
||||||
|
<RecycleScroller
|
||||||
|
class="scroller"
|
||||||
|
id="queue-page-scrollable"
|
||||||
|
style="height: 100%"
|
||||||
|
:items="scrollerItems"
|
||||||
|
:item-size="itemHeight"
|
||||||
|
key-field="id"
|
||||||
|
v-slot="{ item, index }"
|
||||||
>
|
>
|
||||||
</Layout>
|
<SongItem
|
||||||
|
:track="item.track"
|
||||||
|
:index="index + 1"
|
||||||
|
:isCurrent="queue.currenttrack?.hash === item.track.hash"
|
||||||
|
:isCurrentPlaying="
|
||||||
|
queue.currenttrack?.hash === item.track.hash && queue.playing
|
||||||
|
"
|
||||||
|
@playThis="playFromQueue(index)"
|
||||||
|
/>
|
||||||
|
</RecycleScroller>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import useQStore from "@/stores/queue";
|
import { computed, onMounted } from "vue";
|
||||||
import Layout from "@/layouts/HeaderAndVList.vue";
|
|
||||||
import { onBeforeMount, onMounted } from "vue";
|
|
||||||
|
|
||||||
|
import useQStore from "@/stores/queue";
|
||||||
|
import { createTrackProps } from "@/utils";
|
||||||
|
import SongItem from "@/components/shared/SongItem.vue";
|
||||||
|
import { isSmall, isMedium } from "@/stores/content-width";
|
||||||
|
|
||||||
|
const itemHeight = 64;
|
||||||
const queue = useQStore();
|
const queue = useQStore();
|
||||||
|
|
||||||
|
const scrollerItems = computed(() => {
|
||||||
|
return queue.tracklist.map((track) => {
|
||||||
|
return {
|
||||||
|
track,
|
||||||
|
id: Math.random(),
|
||||||
|
props: createTrackProps(track),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function playFromQueue(index: number) {
|
function playFromQueue(index: number) {
|
||||||
queue.play(index);
|
queue.play(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollToCurrent() {
|
function scrollToCurrent() {
|
||||||
const scrollable = document.getElementById("v-page-scrollable");
|
const scrollable = document.getElementById("queue-page-scrollable");
|
||||||
const itemHeight = 64;
|
const itemHeight = 64;
|
||||||
const top = queue.currentindex * itemHeight - 290;
|
const top = queue.currentindex * itemHeight - itemHeight;
|
||||||
|
|
||||||
scrollable?.scrollTo({
|
scrollable?.scrollTo({
|
||||||
top,
|
top,
|
||||||
@@ -31,9 +62,17 @@ function scrollToCurrent() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onMounted(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
scrollToCurrent();
|
scrollToCurrent();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.queue-view-virtual-scroller {
|
||||||
|
.songlist-item.current {
|
||||||
|
background-color: $darkestblue !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user