fix indices on album page

+ fix playing on album page
+ fix songItem responsiveness on all virtual scroll pages
This commit is contained in:
geoffrey45
2022-10-08 15:16:34 +03:00
committed by Mungai Njoroge
parent 9cde9d0aa4
commit f0df274b31
9 changed files with 97 additions and 46 deletions
+1 -7
View File
@@ -80,13 +80,7 @@ onStartTyping((e) => {
elem.value = ""; elem.value = "";
}); });
function updateContentElemSize({ function updateContentElemSize({ width }: { width: number }) {
width,
height,
}: {
width: number;
height: number;
}) {
content_width.value = width; content_width.value = width;
} }
+40 -10
View File
@@ -54,16 +54,6 @@ $g-border: solid 1px $gray5;
padding-right: calc(1rem - $small + 2px); padding-right: calc(1rem - $small + 2px);
} }
.v-scroll-page {
width: calc(100% + $medium) !important;
.scroller {
height: 100%;
width: 100%;
padding-right: $small !important;
}
}
// ====== MODIFIERS ======= // ====== MODIFIERS =======
#app-grid.extendWidth { #app-grid.extendWidth {
@@ -95,3 +85,43 @@ $g-border: solid 1px $gray5;
border-right: none; border-right: none;
border-left: none; border-left: none;
} }
.v-scroll-page {
width: calc(100% + $medium) !important;
.scroller {
height: 100%;
width: 100%;
padding-right: $small !important;
}
}
.v-scroll-page.isSmall {
// hide album and artists columns
.songlist-item {
grid-template-columns: 1.5rem 2fr 2.5rem 2.5rem;
}
.song-artists,
.song-album {
display: none !important;
}
.isSmallArtists {
display: unset !important;
font-size: small;
color: $white;
opacity: 0.67;
}
}
.v-scroll-page.isMedium {
// hide album column
.songlist-item {
grid-template-columns: 1.5rem 1.5fr 1fr 2.5rem 2.5rem;
}
.song-album {
display: none !important;
}
}
+3 -3
View File
@@ -10,7 +10,7 @@
: '', : '',
}" }"
> >
<div class="big-img no-scroll" :class="{ imgSmall: widthIsSmall }"> <div class="big-img no-scroll" :class="{ imgSmall: albumHeaderSmall }">
<img :src="imguri.thumb.large + album.image" class="rounded" /> <img :src="imguri.thumb.large + album.image" class="rounded" />
</div> </div>
<div <div
@@ -44,7 +44,7 @@
/> />
</div> </div>
</div> </div>
<div class="art" v-if="!widthIsSmall"> <div class="art" v-if="!albumHeaderSmall">
<img <img
:src="imguri.artist + album.artistimg" :src="imguri.artist + album.artistimg"
class="shadow-lg circular" class="shadow-lg circular"
@@ -59,7 +59,7 @@
import { ref } from "vue"; import { ref } from "vue";
import { paths } from "@/config"; import { paths } from "@/config";
import { isSmall as widthIsSmall } from "@/stores/content-width"; import { albumHeaderSmall } from "@/stores/content-width";
import useNavStore from "@/stores/nav"; import useNavStore from "@/stores/nav";
import useAlbumStore from "@/stores/pages/album"; import useAlbumStore from "@/stores/pages/album";
import { formatSeconds, useVisibility } from "@/utils"; import { formatSeconds, useVisibility } from "@/utils";
+3 -3
View File
@@ -36,7 +36,7 @@
<ArtistName :artists="track.artist" :albumartist="track.albumartist" /> <ArtistName :artists="track.artist" :albumartist="track.albumartist" />
</div> </div>
<router-link <router-link
v-if="!no_album" v-if="!hide_album"
class="song-album ellip" class="song-album ellip"
v-tooltip v-tooltip
:to="{ :to="{
@@ -65,7 +65,7 @@ import { ref } from "vue";
import { showTrackContextMenu as showContext } from "@/composables/context"; import { showTrackContextMenu as showContext } from "@/composables/context";
import { paths } from "@/config"; import { paths } from "@/config";
import { AlbumDisc, Track } from "@/interfaces"; import { Track } from "@/interfaces";
import { formatSeconds } from "@/utils"; import { formatSeconds } from "@/utils";
import HeartSvg from "@/assets/icons/heart.svg"; import HeartSvg from "@/assets/icons/heart.svg";
@@ -83,7 +83,7 @@ const props = defineProps<{
index: Number | String; index: Number | String;
isCurrent: Boolean; isCurrent: Boolean;
isCurrentPlaying: Boolean; isCurrentPlaying: Boolean;
no_album?: Boolean; hide_album?: Boolean;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
+4 -4
View File
@@ -1,5 +1,5 @@
<template> <template>
<!-- JUST A COMMENT: 64 is single item height, 24 is gap height --> <!-- 64 is single item height, 24 is gap height -->
<div class="header-list-layout"> <div class="header-list-layout">
<div <div
id="v-page-scrollable" id="v-page-scrollable"
@@ -42,7 +42,7 @@
style="height: 60px" style="height: 60px"
:key="t.data.trackid" :key="t.data.trackid"
:track="t.data" :track="t.data"
:no_album="on_album_page" :hide_album="on_album_page"
:index=" :index="
on_album_page on_album_page
? t.data.track ? t.data.track
@@ -74,11 +74,11 @@ import { useElementSize, useVirtualList } from "@vueuse/core";
import { computed, onMounted, ref, watch } from "vue"; import { computed, onMounted, ref, watch } from "vue";
import { Track } from "@/interfaces"; import { Track } from "@/interfaces";
import useQStore from "@/stores/queue";
import useAlbumStore from "@/stores/pages/album"; import useAlbumStore from "@/stores/pages/album";
import useQStore from "@/stores/queue";
import SongItem from "@/components/shared/SongItem.vue";
import AlbumDiscBar from "@/components/AlbumView/AlbumDiscBar.vue"; import AlbumDiscBar from "@/components/AlbumView/AlbumDiscBar.vue";
import SongItem from "@/components/shared/SongItem.vue";
// EMITS & PROPS // EMITS & PROPS
const emit = defineEmits<{ const emit = defineEmits<{
+16 -2
View File
@@ -4,8 +4,22 @@ import { ref } from "@vue/reactivity";
const content_width = ref(0); const content_width = ref(0);
const window_width = ref(0); const window_width = ref(0);
const brk = {
small: 600,
medium: 950,
album_header_small: 700,
};
const isSmall = computed(() => { const isSmall = computed(() => {
return content_width.value < 700; return content_width.value <= brk.small;
}); });
export { content_width, window_width, isSmall }; const isMedium = computed(() => {
return content_width.value > brk.small && content_width.value <= brk.medium;
});
const albumHeaderSmall = computed(() => {
return content_width.value <= brk.album_header_small;
});
export { content_width, window_width, isSmall, isMedium, albumHeaderSmall };
+19 -11
View File
@@ -1,5 +1,5 @@
<template> <template>
<div class="album-virtual-scroller v-scroll-page"> <div class="album-virtual-scroller v-scroll-page" :class="{ isSmall }">
<RecycleScroller <RecycleScroller
class="scroller" class="scroller"
:items="scrollerItems" :items="scrollerItems"
@@ -10,29 +10,32 @@
<component <component
:is="item.component" :is="item.component"
v-bind="item.props" v-bind="item.props"
@playThis="playFromAlbum(item.props.index - item.props.track.disc - 1)" @playThis="
playFromAlbum(item.props.track.index - item.props.track.disc)
"
/> />
</RecycleScroller> </RecycleScroller>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {
onBeforeRouteLeave,
onBeforeRouteUpdate,
RouteLocationNormalized,
} from "vue-router";
import { computed } from "@vue/reactivity"; import { computed } from "@vue/reactivity";
import {
onBeforeRouteLeave,
onBeforeRouteUpdate,
RouteLocationNormalized
} from "vue-router";
import { Track } from "@/interfaces"; import { Track } from "@/interfaces";
import { createTrackProps } from "@/utils"; import { createTrackProps } from "@/utils";
import useQueueStore from "@/stores/queue";
import useAlbumStore from "@/stores/pages/album"; import useAlbumStore from "@/stores/pages/album";
import useQueueStore from "@/stores/queue";
import AlbumDiscBar from "@/components/AlbumView/AlbumDiscBar.vue";
import Header from "@/components/AlbumView/Header.vue"; import Header from "@/components/AlbumView/Header.vue";
import SongItem from "@/components/shared/SongItem.vue"; import SongItem from "@/components/shared/SongItem.vue";
import AlbumDiscBar from "@/components/AlbumView/AlbumDiscBar.vue"; import { isSmall } from "@/stores/content-width";
const album = useAlbumStore(); const album = useAlbumStore();
const queue = useQueueStore(); const queue = useQueueStore();
@@ -40,7 +43,7 @@ const queue = useQueueStore();
interface ScrollerItem { interface ScrollerItem {
id: string; id: string;
component: typeof Header | typeof SongItem; component: typeof Header | typeof SongItem;
props: Record<string, unknown>; props: any;
size: number; size: number;
} }
@@ -54,7 +57,7 @@ class songItem {
this.id = Math.random(); this.id = Math.random();
this.props = track.is_album_disc_number this.props = track.is_album_disc_number
? { album_disc: track } ? { album_disc: track }
: createTrackProps(track); : { ...createTrackProps(track), hide_album: true, index: track.track };
this.component = track.is_album_disc_number ? AlbumDiscBar : SongItem; this.component = track.is_album_disc_number ? AlbumDiscBar : SongItem;
} }
} }
@@ -100,8 +103,13 @@ onBeforeRouteLeave(() => {
<style lang="scss"> <style lang="scss">
.album-virtual-scroller { .album-virtual-scroller {
height: 100%; height: 100%;
.scroller { .scroller {
padding-bottom: $content-padding-bottom; padding-bottom: $content-padding-bottom;
} }
.songlist-item {
grid-template-columns: 1.5rem 1.5fr 1fr 2.5rem 2.5rem;
}
} }
</style> </style>
+5 -4
View File
@@ -1,5 +1,5 @@
<template> <template>
<div class="folder-view v-scroll-page"> <div class="folder-view v-scroll-page" :class="{ isSmall, isMedium }">
<DynamicScroller <DynamicScroller
:items="scrollerItems" :items="scrollerItems"
:min-item-size="64" :min-item-size="64"
@@ -32,6 +32,7 @@ import { Track } from "@/interfaces";
import useQueueStore from "@/stores/queue"; import useQueueStore from "@/stores/queue";
import useLoaderStore from "@/stores/loader"; import useLoaderStore from "@/stores/loader";
import useFolderStore from "@/stores/pages/folder"; import useFolderStore from "@/stores/pages/folder";
import { isSmall, isMedium } from "@/stores/content-width";
import SongItem from "@/components/shared/SongItem.vue"; import SongItem from "@/components/shared/SongItem.vue";
import FolderList from "@/components/FolderView/FolderList.vue"; import FolderList from "@/components/FolderView/FolderList.vue";
@@ -41,18 +42,18 @@ const folder = useFolderStore();
const queue = useQueueStore(); const queue = useQueueStore();
interface ScrollerItem { interface ScrollerItem {
id: string; id: string | number;
component: typeof FolderList | typeof SongItem; component: typeof FolderList | typeof SongItem;
props: any; props: any;
} }
class songItem { class songItem {
id: string; id: number;
props: any; props: any;
component = SongItem; component = SongItem;
constructor(track: Track) { constructor(track: Track) {
this.id = track.trackid; this.id = Math.random();
this.props = { this.props = {
track, track,
index: track.index + 1, index: track.index + 1,
+5 -1
View File
@@ -1,5 +1,8 @@
<template> <template>
<div class="playlist-virtual-scroller v-scroll-page"> <div
class="playlist-virtual-scroller v-scroll-page"
:class="{ isSmall, isMedium }"
>
<RecycleScroller <RecycleScroller
class="scroller" class="scroller"
:items="scrollerItems" :items="scrollerItems"
@@ -22,6 +25,7 @@ import { onBeforeRouteLeave } from "vue-router";
import useQueueStore from "@/stores/queue"; import useQueueStore from "@/stores/queue";
import usePlaylistStore from "@/stores/pages/playlist"; import usePlaylistStore from "@/stores/pages/playlist";
import { isSmall, isMedium } from "@/stores/content-width";
import Header from "@/components/PlaylistView/Header.vue"; import Header from "@/components/PlaylistView/Header.vue";
import SongItem from "@/components/shared/SongItem.vue"; import SongItem from "@/components/shared/SongItem.vue";