From a37835a9c2c86d9c85301f082fa4f56394ddccd4 Mon Sep 17 00:00:00 2001 From: wvffle Date: Sun, 17 Jul 2022 13:18:55 +0000 Subject: [PATCH] Allow displaying multiple same tracks in track list Well, there was some error with `@mouseleave` not firing in some cases for some weird reason, so I decided to handle the `hover` prop in the container --- front/src/components/audio/track/Row.vue | 43 ++- front/src/components/audio/track/Table.vue | 260 ++++++++++-------- .../components/playlists/PlaylistModal.vue | 6 +- front/src/composables/audio/usePlayOptions.ts | 17 +- front/src/views/playlists/Detail.vue | 1 + 5 files changed, 180 insertions(+), 147 deletions(-) diff --git a/front/src/components/audio/track/Row.vue b/front/src/components/audio/track/Row.vue index c119a6155..35273905a 100644 --- a/front/src/components/audio/track/Row.vue +++ b/front/src/components/audio/track/Row.vue @@ -9,10 +9,9 @@ import PlayButton from '~/components/audio/PlayButton.vue' import usePlayOptions from '~/composables/audio/usePlayOptions' import useQueue from '~/composables/audio/useQueue' import usePlayer from '~/composables/audio/usePlayer' -import { ref } from 'vue' +import { computed } from 'vue' interface Props extends PlayOptionsProps { - tracks: Track[] track: Track index: number @@ -23,7 +22,10 @@ interface Props extends PlayOptionsProps { showPosition?: boolean displayActions?: boolean + hover: boolean + // TODO(wvffle): Remove after https://github.com/vuejs/core/pull/4512 is merged + tracks: Track[] isPlayable?: boolean artist?: Artist | null album?: Album | null @@ -42,22 +44,16 @@ const props = withDefaults(defineProps(), { displayActions: true }) -const hover = ref(null) - -const { playing } = usePlayer() +const { playing, loading } = usePlayer() const { currentTrack } = useQueue() const { activateTrack } = usePlayOptions(props) +const active = computed(() => props.track.id === currentTrack.value?.id && props.track.position === currentTrack.value?.position)