From d8a921189800508276a267d38b2559379e7f56dd Mon Sep 17 00:00:00 2001 From: Phan An Date: Wed, 20 Apr 2022 12:20:09 +0200 Subject: [PATCH] fix: make song context work again --- .../__tests__/components/song/add-to-menu.spec.ts | 2 +- .../components/song/context-menu.spec.ts | 2 +- resources/assets/js/app.vue | 8 +++----- .../song/{add-to-menu.vue => AddToMenu.vue} | 8 ++++---- .../{context-menu.vue => SongContextMenu.vue} | 10 +++++----- .../assets/js/components/song/list-controls.vue | 2 +- resources/assets/js/composables/useContextMenu.ts | 15 ++++++++++++--- .../assets/js/composables/useSongMenuMethods.ts | 15 +++++++-------- 8 files changed, 34 insertions(+), 28 deletions(-) rename resources/assets/js/components/song/{add-to-menu.vue => AddToMenu.vue} (92%) rename resources/assets/js/components/song/{context-menu.vue => SongContextMenu.vue} (95%) diff --git a/resources/assets/js/__tests__/components/song/add-to-menu.spec.ts b/resources/assets/js/__tests__/components/song/add-to-menu.spec.ts index 096aa9dc..3b391556 100644 --- a/resources/assets/js/__tests__/components/song/add-to-menu.spec.ts +++ b/resources/assets/js/__tests__/components/song/add-to-menu.spec.ts @@ -1,5 +1,5 @@ import _ from 'lodash' -import Component from '@/components/song/add-to-menu.vue' +import Component from '@/components/song/AddToMenu.vue' import factory from '@/__tests__/factory' import { playlistStore, queueStore, favoriteStore } from '@/stores' import { mock } from '@/__tests__/__helpers__' diff --git a/resources/assets/js/__tests__/components/song/context-menu.spec.ts b/resources/assets/js/__tests__/components/song/context-menu.spec.ts index 1323b59b..7ac5e130 100644 --- a/resources/assets/js/__tests__/components/song/context-menu.spec.ts +++ b/resources/assets/js/__tests__/components/song/context-menu.spec.ts @@ -1,4 +1,4 @@ -import Component from '@/components/song/context-menu.vue' +import Component from '@/components/song/SongContextMenu.vue' import { download } from '@/services' import { songStore, playlistStore, queueStore, favoriteStore, sharedStore, userStore } from '@/stores' import { eventBus } from '@/utils' diff --git a/resources/assets/js/app.vue b/resources/assets/js/app.vue index ea229c85..f62dac01 100644 --- a/resources/assets/js/app.vue +++ b/resources/assets/js/app.vue @@ -15,7 +15,7 @@ - + @@ -35,13 +35,12 @@ import { $, eventBus, hideOverlay, showOverlay, arrayify } from '@/utils' import { favoriteStore, preferenceStore as preferences, queueStore, sharedStore } from '@/stores' import { auth, playback, socket } from '@/services' -const SongContextMenu = defineAsyncComponent(() => import('@/components/song/context-menu.vue')) +const SongContextMenu = defineAsyncComponent(() => import('@/components/song/SongContextMenu.vue')) const AlbumContextMenu = defineAsyncComponent(() => import('@/components/album/context-menu.vue')) const ArtistContextMenu = defineAsyncComponent(() => import('@/components/artist/context-menu.vue')) const SupportKoel = defineAsyncComponent(() => import('@/components/meta/support-koel.vue')) const authenticated = ref(false) -const contextMenuSongs = ref([]) const contextMenuAlbum = ref() const contextMenuArtist = ref() @@ -85,9 +84,8 @@ onMounted(async () => { }) eventBus.on('SONG_CONTEXT_MENU_REQUESTED', async (e: MouseEvent, songs: Song | Song[]) => { - contextMenuSongs.value = arrayify(songs) await nextTick() - songContextMenu.value?.open(e.pageY, e.pageX) + songContextMenu.value?.open(e.pageY, e.pageX, { songs: arrayify(songs) }) }) eventBus.on('ALBUM_CONTEXT_MENU_REQUESTED', async (e: MouseEvent, album: Album) => { diff --git a/resources/assets/js/components/song/add-to-menu.vue b/resources/assets/js/components/song/AddToMenu.vue similarity index 92% rename from resources/assets/js/components/song/add-to-menu.vue rename to resources/assets/js/components/song/AddToMenu.vue index f293cc33..df5eb251 100644 --- a/resources/assets/js/components/song/add-to-menu.vue +++ b/resources/assets/js/components/song/AddToMenu.vue @@ -13,9 +13,9 @@
  • songs.value.length || close()) diff --git a/resources/assets/js/components/song/context-menu.vue b/resources/assets/js/components/song/SongContextMenu.vue similarity index 95% rename from resources/assets/js/components/song/context-menu.vue rename to resources/assets/js/components/song/SongContextMenu.vue index 78945fb7..aaab06e9 100644 --- a/resources/assets/js/components/song/context-menu.vue +++ b/resources/assets/js/components/song/SongContextMenu.vue @@ -39,30 +39,30 @@