mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
fix ArtistName component width calculation in vTooltip
+ add tracklist breakpoints to virtual scroll page layout
This commit is contained in:
committed by
Mungai Njoroge
parent
1c3998aa25
commit
61750f7126
@@ -157,25 +157,6 @@ function getTrackList() {
|
|||||||
background-color: $gray4;
|
background-color: $gray4;
|
||||||
color: $white !important;
|
color: $white !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.highlighted {
|
|
||||||
color: $white !important;
|
|
||||||
animation: blinker 1.5s ease 1s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes blinker {
|
|
||||||
25% {
|
|
||||||
background-color: $gray4;
|
|
||||||
}
|
|
||||||
|
|
||||||
50% {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
75% {
|
|
||||||
background-color: $gray4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
<ArtistName
|
<ArtistName
|
||||||
:artists="track?.artist || []"
|
:artists="track?.artist || []"
|
||||||
:albumartist="track?.albumartist || 'Play something'"
|
:albumartist="track?.albumartist || 'Play something'"
|
||||||
|
:small="true"
|
||||||
class="artists"
|
class="artists"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -106,9 +107,8 @@ const imguri = paths.images.thumb.large;
|
|||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.artists {
|
.artists {
|
||||||
font-size: 0.85rem;
|
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-tooltip style="width: auto">
|
<div
|
||||||
<div class="ellip" v-if="artists === null || artists.length === 0">
|
v-tooltip
|
||||||
|
style="width: fit-content"
|
||||||
|
class="ellip"
|
||||||
|
:style="{
|
||||||
|
fontSize: small ? '0.85rem' : smaller ? 'small' : '',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<div v-if="artists === null || artists.length === 0">
|
||||||
<span>{{ albumartist }}</span>
|
<span>{{ albumartist }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ellip" v-else>
|
<div v-else>
|
||||||
<span v-for="artist in putCommas(artists)" :key="artist">{{
|
<span v-for="artist in putCommas(artists)" :key="artist">{{
|
||||||
artist
|
artist
|
||||||
}}</span>
|
}}</span>
|
||||||
@@ -17,5 +24,7 @@ import { putCommas } from "@/utils";
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
artists: string[] | null;
|
artists: string[] | null;
|
||||||
albumartist: string | undefined;
|
albumartist: string | undefined;
|
||||||
|
small?: boolean;
|
||||||
|
smaller?: boolean;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -28,7 +28,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="artist">
|
<div class="artist">
|
||||||
<ArtistName :artists="track.artist" :albumartist="track.albumartist" />
|
<ArtistName
|
||||||
|
:artists="track.artist"
|
||||||
|
:albumartist="track.albumartist"
|
||||||
|
:smaller="true"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -140,7 +144,6 @@ const playThis = (track: Track) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.artist {
|
.artist {
|
||||||
font-size: small;
|
|
||||||
opacity: 0.67;
|
opacity: 0.67;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ function hideTooltip() {
|
|||||||
tooltip.style.visibility = "hidden";
|
tooltip.style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFullWidth(el: HTMLElement) {
|
function getElFullWidth(el: HTMLElement) {
|
||||||
// display el as inline-block to get the correct width
|
|
||||||
el.style.display = "inline-block";
|
el.style.display = "inline-block";
|
||||||
el.style.visibility = "hidden";
|
el.style.visibility = "hidden";
|
||||||
document.getElementsByTagName("body")[0].appendChild(el);
|
document.getElementsByTagName("body")[0].appendChild(el);
|
||||||
|
|
||||||
const width = el.offsetWidth;
|
const width = el.offsetWidth;
|
||||||
el.remove();
|
el.remove();
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ function getFullWidth(el: HTMLElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default (el: HTMLElement) => {
|
export default (el: HTMLElement) => {
|
||||||
const fullWidth = getFullWidth(el.cloneNode(true) as HTMLElement);
|
const fullWidth = getElFullWidth(el.cloneNode(true) as HTMLElement);
|
||||||
if (fullWidth <= el.offsetWidth) return;
|
if (fullWidth <= el.offsetWidth) return;
|
||||||
|
|
||||||
if (!tooltip) {
|
if (!tooltip) {
|
||||||
@@ -89,13 +89,4 @@ export default (el: HTMLElement) => {
|
|||||||
hideTooltip();
|
hideTooltip();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// } as Directive;
|
|
||||||
|
|
||||||
// beforeUnmount(el: HTMLElement) {
|
|
||||||
// // hideTooltip();
|
|
||||||
|
|
||||||
// el.removeEventListener("mouseover", () => {});
|
|
||||||
// el.removeEventListener("mouseout", () => {});
|
|
||||||
// },
|
|
||||||
@@ -6,7 +6,15 @@
|
|||||||
:style="{ paddingTop: !no_header ? headerHeight - 64 + 16 + 'px' : 0 }"
|
:style="{ paddingTop: !no_header ? headerHeight - 64 + 16 + 'px' : 0 }"
|
||||||
@scroll="handleScroll"
|
@scroll="handleScroll"
|
||||||
>
|
>
|
||||||
<div v-bind="wrapperProps" class="scrollable">
|
<div
|
||||||
|
v-bind="wrapperProps"
|
||||||
|
class="scrollable"
|
||||||
|
ref="scrollable"
|
||||||
|
:class="{
|
||||||
|
isSmall: isSmall,
|
||||||
|
isMedium: isMedium,
|
||||||
|
}"
|
||||||
|
>
|
||||||
<div class="header rounded" style="height: 64px" v-if="!no_header">
|
<div class="header rounded" style="height: 64px" v-if="!no_header">
|
||||||
<div
|
<div
|
||||||
ref="header"
|
ref="header"
|
||||||
@@ -29,7 +37,9 @@
|
|||||||
: t.index + 1
|
: t.index + 1
|
||||||
"
|
"
|
||||||
:isCurrent="queue.currentid === t.data.trackid"
|
:isCurrent="queue.currentid === t.data.trackid"
|
||||||
:isCurrentPlaying="queue.currentid === t.data.trackid && queue.playing"
|
:isCurrentPlaying="
|
||||||
|
queue.currentid === t.data.trackid && queue.playing
|
||||||
|
"
|
||||||
@playThis="
|
@playThis="
|
||||||
updateQueue(t.data.index !== undefined ? t.data.index : t.index)
|
updateQueue(t.data.index !== undefined ? t.data.index : t.index)
|
||||||
"
|
"
|
||||||
@@ -59,9 +69,23 @@ const emit = defineEmits<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const queue = useQStore();
|
const queue = useQStore();
|
||||||
const header = ref<HTMLElement>();
|
|
||||||
const source = computed(() => props.tracks);
|
const source = computed(() => props.tracks);
|
||||||
|
|
||||||
|
// element refs + sizes
|
||||||
|
const header = ref<HTMLElement>();
|
||||||
|
const scrollable = ref<HTMLElement>();
|
||||||
|
|
||||||
const { height: headerHeight } = useElementSize(header);
|
const { height: headerHeight } = useElementSize(header);
|
||||||
|
const { width } = useElementSize(scrollable);
|
||||||
|
|
||||||
|
const brk = {
|
||||||
|
sm: 500,
|
||||||
|
md: 800,
|
||||||
|
};
|
||||||
|
|
||||||
|
const isSmall = computed(() => width.value < brk.sm);
|
||||||
|
const isMedium = computed(() => width.value > brk.sm && width.value < brk.md);
|
||||||
|
// ---
|
||||||
|
|
||||||
const {
|
const {
|
||||||
list: tracks,
|
list: tracks,
|
||||||
@@ -96,6 +120,34 @@ function handleScroll(e: Event) {
|
|||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scrollable.isSmall {
|
||||||
|
.songlist-item {
|
||||||
|
grid-template-columns: 1.5rem 2fr 2rem 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.song-artists,
|
||||||
|
.song-album {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.isSmallArtists {
|
||||||
|
display: unset !important;
|
||||||
|
font-size: small;
|
||||||
|
color: $white;
|
||||||
|
opacity: 0.67;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollable.isMedium {
|
||||||
|
.songlist-item {
|
||||||
|
grid-template-columns: 1.5rem 2fr 1fr 2rem 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.song-album {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user