mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
chore: remove unnecessary reactive() calls
This commit is contained in:
parent
78e8b0ea74
commit
734a9936c2
15 changed files with 81 additions and 88 deletions
|
@ -6,7 +6,7 @@
|
||||||
<li class="separator"></li>
|
<li class="separator"></li>
|
||||||
<li data-test="view-album" @click="viewAlbumDetails" v-if="isStandardAlbum">Go to Album</li>
|
<li data-test="view-album" @click="viewAlbumDetails" v-if="isStandardAlbum">Go to Album</li>
|
||||||
<li data-test="view-artist" @click="viewArtistDetails" v-if="isStandardArtist">Go to Artist</li>
|
<li data-test="view-artist" @click="viewArtistDetails" v-if="isStandardArtist">Go to Artist</li>
|
||||||
<template v-if="isStandardAlbum && sharedState.allowDownload">
|
<template v-if="isStandardAlbum && allowDownload">
|
||||||
<li class="separator"></li>
|
<li class="separator"></li>
|
||||||
<li data-test="download" @click="download">Download</li>
|
<li data-test="download" @click="download">Download</li>
|
||||||
</template>
|
</template>
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, reactive, Ref, toRef } from 'vue'
|
import { computed, Ref, toRef } from 'vue'
|
||||||
import { albumStore, artistStore, commonStore } from '@/stores'
|
import { albumStore, artistStore, commonStore } from '@/stores'
|
||||||
import { downloadService, playbackService } from '@/services'
|
import { downloadService, playbackService } from '@/services'
|
||||||
import { useContextMenu } from '@/composables'
|
import { useContextMenu } from '@/composables'
|
||||||
|
@ -24,8 +24,7 @@ import router from '@/router'
|
||||||
const { context, base, ContextMenuBase, open, close } = useContextMenu()
|
const { context, base, ContextMenuBase, open, close } = useContextMenu()
|
||||||
|
|
||||||
const album = toRef(context, 'album') as Ref<Album>
|
const album = toRef(context, 'album') as Ref<Album>
|
||||||
|
const allowDownload = toRef(commonStore.state, 'allowDownload')
|
||||||
const sharedState = reactive(commonStore.state)
|
|
||||||
|
|
||||||
const isStandardAlbum = computed(() => !albumStore.isUnknownAlbum(album.value))
|
const isStandardAlbum = computed(() => !albumStore.isUnknownAlbum(album.value))
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<li class="separator"></li>
|
<li class="separator"></li>
|
||||||
<li data-test="view-artist" @click="viewArtistDetails">Go to Artist</li>
|
<li data-test="view-artist" @click="viewArtistDetails">Go to Artist</li>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="isStandardArtist && sharedState.allowDownload">
|
<template v-if="isStandardArtist && allowDownload">
|
||||||
<li class="separator"></li>
|
<li class="separator"></li>
|
||||||
<li data-test="download" @click="download">Download</li>
|
<li data-test="download" @click="download">Download</li>
|
||||||
</template>
|
</template>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, reactive, Ref, toRef } from 'vue'
|
import { computed, Ref, toRef } from 'vue'
|
||||||
import { artistStore, commonStore } from '@/stores'
|
import { artistStore, commonStore } from '@/stores'
|
||||||
import { downloadService, playbackService } from '@/services'
|
import { downloadService, playbackService } from '@/services'
|
||||||
import { useContextMenu } from '@/composables'
|
import { useContextMenu } from '@/composables'
|
||||||
|
@ -25,8 +25,7 @@ import router from '@/router'
|
||||||
const { context, base, ContextMenuBase, open, close } = useContextMenu()
|
const { context, base, ContextMenuBase, open, close } = useContextMenu()
|
||||||
|
|
||||||
const artist = toRef(context, 'artist') as Ref<Artist>
|
const artist = toRef(context, 'artist') as Ref<Artist>
|
||||||
|
const allowDownload = toRef(commonStore.state, 'allowDownload')
|
||||||
const sharedState = reactive(commonStore.state)
|
|
||||||
|
|
||||||
const isStandardArtist = computed(() =>
|
const isStandardArtist = computed(() =>
|
||||||
!artistStore.isUnknownArtist(artist.value)
|
!artistStore.isUnknownArtist(artist.value)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent, ref } from 'vue'
|
import { defineAsyncComponent, ref } from 'vue'
|
||||||
import { eventBus } from '@/utils'
|
import { eventBus, arrayify } from '@/utils'
|
||||||
|
|
||||||
interface ModalWrapperBoundData {
|
interface ModalWrapperBoundData {
|
||||||
playlist?: Playlist
|
playlist?: Playlist
|
||||||
|
@ -67,8 +67,8 @@ eventBus.on({
|
||||||
showingModalName.value = 'edit-user-form'
|
showingModalName.value = 'edit-user-form'
|
||||||
},
|
},
|
||||||
|
|
||||||
MODAL_SHOW_EDIT_SONG_FORM (songs: Song[], initialTab = 'details') {
|
MODAL_SHOW_EDIT_SONG_FORM (songs: Song | Song[], initialTab = 'details') {
|
||||||
boundData.value.songs = songs
|
boundData.value.songs = arrayify(songs)
|
||||||
boundData.value.initialTab = initialTab
|
boundData.value.initialTab = initialTab
|
||||||
showingModalName.value = 'edit-song-form'
|
showingModalName.value = 'edit-song-form'
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent, reactive, ref, toRef, toRefs } from 'vue'
|
import { defineAsyncComponent, ref, toRef, toRefs } from 'vue'
|
||||||
import isMobile from 'ismobilejs'
|
import isMobile from 'ismobilejs'
|
||||||
import { socketService } from '@/services'
|
import { socketService } from '@/services'
|
||||||
import { eventBus, isAudioContextSupported as useEqualizer } from '@/utils'
|
import { eventBus, isAudioContextSupported as useEqualizer } from '@/utils'
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
<template>
|
<template>
|
||||||
<section id="extra" :class="{ showing: state.showExtraPanel }" class="text-secondary" data-testid="extra-panel">
|
<section id="extra" :class="{ showing }" class="text-secondary" data-testid="extra-panel">
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<div class="clear" role="tablist">
|
<div class="clear" role="tablist">
|
||||||
<button
|
<button
|
||||||
:aria-selected="currentTab === 'Lyrics'"
|
|
||||||
@click.prevent="currentTab = 'Lyrics'"
|
|
||||||
aria-controls="extraPanelLyrics"
|
|
||||||
id="extraTabLyrics"
|
id="extraTabLyrics"
|
||||||
|
:aria-selected="currentTab === 'Lyrics'"
|
||||||
|
aria-controls="extraPanelLyrics"
|
||||||
role="tab"
|
role="tab"
|
||||||
|
@click.prevent="currentTab = 'Lyrics'"
|
||||||
>
|
>
|
||||||
Lyrics
|
Lyrics
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
:aria-selected="currentTab === 'Artist'"
|
|
||||||
@click.prevent="currentTab = 'Artist'"
|
|
||||||
aria-controls="extraPanelArtist"
|
|
||||||
id="extraTabArtist"
|
id="extraTabArtist"
|
||||||
|
:aria-selected="currentTab === 'Artist'"
|
||||||
|
aria-controls="extraPanelArtist"
|
||||||
role="tab"
|
role="tab"
|
||||||
|
@click.prevent="currentTab = 'Artist'"
|
||||||
>
|
>
|
||||||
Artist
|
Artist
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
:aria-selected="currentTab === 'Album'"
|
|
||||||
@click.prevent="currentTab = 'Album'"
|
|
||||||
aria-controls="extraPanelAlbum"
|
|
||||||
id="extraTabAlbum"
|
id="extraTabAlbum"
|
||||||
|
:aria-selected="currentTab === 'Album'"
|
||||||
|
aria-controls="extraPanelAlbum"
|
||||||
role="tab"
|
role="tab"
|
||||||
|
@click.prevent="currentTab = 'Album'"
|
||||||
>
|
>
|
||||||
Album
|
Album
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
:aria-selected="currentTab === 'YouTube'"
|
v-if="useYouTube"
|
||||||
@click.prevent="currentTab = 'YouTube'"
|
|
||||||
aria-controls="extraPanelYouTube"
|
|
||||||
id="extraTabYouTube"
|
id="extraTabYouTube"
|
||||||
|
:aria-selected="currentTab === 'YouTube'"
|
||||||
|
aria-controls="extraPanelYouTube"
|
||||||
role="tab"
|
role="tab"
|
||||||
title="YouTube"
|
title="YouTube"
|
||||||
v-if="sharedState.useYouTube"
|
@click.prevent="currentTab = 'YouTube'"
|
||||||
>
|
>
|
||||||
<i class="fa fa-youtube-play"></i>
|
<i class="fa fa-youtube-play"></i>
|
||||||
</button>
|
</button>
|
||||||
|
@ -44,43 +44,43 @@
|
||||||
|
|
||||||
<div class="panes">
|
<div class="panes">
|
||||||
<div
|
<div
|
||||||
aria-labelledby="extraTabLyrics"
|
v-show="currentTab === 'Lyrics'"
|
||||||
id="extraPanelLyrics"
|
id="extraPanelLyrics"
|
||||||
|
aria-labelledby="extraTabLyrics"
|
||||||
role="tabpanel"
|
role="tabpanel"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
v-show="currentTab === 'Lyrics'"
|
|
||||||
>
|
>
|
||||||
<lyrics-pane :song="song"/>
|
<lyrics-pane :song="song"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
aria-labelledby="extraTabArtist"
|
v-show="currentTab === 'Artist'"
|
||||||
id="extraPanelArtist"
|
id="extraPanelArtist"
|
||||||
|
aria-labelledby="extraTabArtist"
|
||||||
role="tabpanel"
|
role="tabpanel"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
v-show="currentTab === 'Artist'"
|
|
||||||
>
|
>
|
||||||
<ArtistInfo v-if="artist" :artist="artist" mode="sidebar"/>
|
<ArtistInfo v-if="artist" :artist="artist" mode="sidebar"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
aria-labelledby="extraTabAlbum"
|
v-show="currentTab === 'Album'"
|
||||||
id="extraPanelAlbum"
|
id="extraPanelAlbum"
|
||||||
|
aria-labelledby="extraTabAlbum"
|
||||||
role="tabpanel"
|
role="tabpanel"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
v-show="currentTab === 'Album'"
|
|
||||||
>
|
>
|
||||||
<AlbumInfo v-if="album" :album="album" mode="sidebar"/>
|
<AlbumInfo v-if="album" :album="album" mode="sidebar"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
aria-labelledby="extraTabYouTube"
|
v-show="currentTab === 'YouTube'"
|
||||||
id="extraPanelYouTube"
|
id="extraPanelYouTube"
|
||||||
|
aria-labelledby="extraTabYouTube"
|
||||||
role="tabpanel"
|
role="tabpanel"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
v-show="currentTab === 'YouTube'"
|
|
||||||
>
|
>
|
||||||
<YouTubeVideoList v-if="sharedState.useYouTube && song" :song="song"/>
|
<YouTubeVideoList v-if="useYouTube && song" :song="song"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -89,9 +89,9 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import isMobile from 'ismobilejs'
|
import isMobile from 'ismobilejs'
|
||||||
import { computed, defineAsyncComponent, reactive, ref, watch } from 'vue'
|
import { computed, defineAsyncComponent, ref, toRef, watch } from 'vue'
|
||||||
import { $, eventBus } from '@/utils'
|
import { $, eventBus } from '@/utils'
|
||||||
import { preferenceStore as preferences, commonStore, songStore } from '@/stores'
|
import { commonStore, preferenceStore as preferences, songStore } from '@/stores'
|
||||||
import { songInfo } from '@/services'
|
import { songInfo } from '@/services'
|
||||||
|
|
||||||
type Tab = 'Lyrics' | 'Artist' | 'Album' | 'YouTube'
|
type Tab = 'Lyrics' | 'Artist' | 'Album' | 'YouTube'
|
||||||
|
@ -103,14 +103,14 @@ const AlbumInfo = defineAsyncComponent(() => import('@/components/album/AlbumInf
|
||||||
const YouTubeVideoList = defineAsyncComponent(() => import('@/components/ui/YouTubeVideoList.vue'))
|
const YouTubeVideoList = defineAsyncComponent(() => import('@/components/ui/YouTubeVideoList.vue'))
|
||||||
|
|
||||||
const song = ref<Song | null>(null)
|
const song = ref<Song | null>(null)
|
||||||
const state = reactive(preferences.state)
|
const showing = toRef(preferences.state, 'showExtraPanel')
|
||||||
const sharedState = reactive(commonStore.state)
|
const useYouTube = toRef(commonStore.state, 'useYouTube')
|
||||||
const currentTab = ref(defaultTab)
|
const currentTab = ref(defaultTab)
|
||||||
|
|
||||||
const artist = computed(() => song.value?.artist)
|
const artist = computed(() => song.value?.artist)
|
||||||
const album = computed(() => song.value?.album)
|
const album = computed(() => song.value?.album)
|
||||||
|
|
||||||
watch(() => state.showExtraPanel, (showingExtraPanel) => {
|
watch(showing, (showingExtraPanel) => {
|
||||||
if (showingExtraPanel && !isMobile.any) {
|
if (showingExtraPanel && !isMobile.any) {
|
||||||
$.addClass(document.documentElement, 'with-extra-panel')
|
$.addClass(document.documentElement, 'with-extra-panel')
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,7 +123,7 @@ const resetState = () => {
|
||||||
song.value = songStore.stub
|
song.value = songStore.stub
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchSongInfo = async (_song: Song) =>{
|
const fetchSongInfo = async (_song: Song) => {
|
||||||
try {
|
try {
|
||||||
song.value = await songInfo.fetch(_song)
|
song.value = await songInfo.fetch(_song)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -139,7 +139,7 @@ eventBus.on({
|
||||||
isMobile.any || $.addClass(document.documentElement, 'with-extra-panel')
|
isMobile.any || $.addClass(document.documentElement, 'with-extra-panel')
|
||||||
|
|
||||||
// Hide the extra panel if on mobile
|
// Hide the extra panel if on mobile
|
||||||
isMobile.phone && (state.showExtraPanel = false)
|
isMobile.phone && (showing.value = false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent, reactive, ref, toRef } from 'vue'
|
import { defineAsyncComponent, ref, toRef } from 'vue'
|
||||||
import { eventBus } from '@/utils'
|
import { eventBus } from '@/utils'
|
||||||
import { preferenceStore, commonStore } from '@/stores'
|
import { commonStore, preferenceStore } from '@/stores'
|
||||||
import HomeScreen from '@/components/screens/HomeScreen.vue'
|
import HomeScreen from '@/components/screens/HomeScreen.vue'
|
||||||
import QueueScreen from '@/components/screens/QueueScreen.vue'
|
import QueueScreen from '@/components/screens/QueueScreen.vue'
|
||||||
import AlbumListScreen from '@/components/screens/AlbumListScreen.vue'
|
import AlbumListScreen from '@/components/screens/AlbumListScreen.vue'
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
•
|
•
|
||||||
{{ duration }}
|
{{ duration }}
|
||||||
|
|
||||||
<template v-if="sharedState.useLastfm">
|
<template v-if="useLastfm">
|
||||||
•
|
•
|
||||||
<a class="info" href title="View album's extra information" @click.prevent="showInfo">Info</a>
|
<a class="info" href title="View album's extra information" @click.prevent="showInfo">Info</a>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="sharedState.allowDownload">
|
<template v-if="allowDownload">
|
||||||
•
|
•
|
||||||
<a class="download" href role="button" title="Download all songs in album" @click.prevent="download">
|
<a class="download" href role="button" title="Download all songs in album" @click.prevent="download">
|
||||||
Download All
|
Download All
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
<SongList ref="songList" :config="listConfig" :items="songs" type="album" @press:enter="onPressEnter"/>
|
<SongList ref="songList" :config="listConfig" :items="songs" type="album" @press:enter="onPressEnter"/>
|
||||||
|
|
||||||
<section v-if="sharedState.useLastfm && showing" class="info-wrapper">
|
<section v-if="useLastfm && showing" class="info-wrapper">
|
||||||
<CloseModalBtn @click="showing = false"/>
|
<CloseModalBtn @click="showing = false"/>
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<div class="loading" v-if="loading">
|
<div class="loading" v-if="loading">
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineAsyncComponent, reactive, ref, toRefs, watch } from 'vue'
|
import { computed, defineAsyncComponent, ref, toRef, toRefs, watch } from 'vue'
|
||||||
import { pluralize } from '@/utils'
|
import { pluralize } from '@/utils'
|
||||||
import { artistStore, commonStore } from '@/stores'
|
import { artistStore, commonStore } from '@/stores'
|
||||||
import { albumInfoService, downloadService } from '@/services'
|
import { albumInfoService, downloadService } from '@/services'
|
||||||
|
@ -92,7 +92,8 @@ const {
|
||||||
} = useSongList(ref(album.value.songs))
|
} = useSongList(ref(album.value.songs))
|
||||||
|
|
||||||
const listConfig: Partial<SongListConfig> = { columns: ['track', 'title', 'length'] }
|
const listConfig: Partial<SongListConfig> = { columns: ['track', 'title', 'length'] }
|
||||||
const sharedState = reactive(commonStore.state)
|
const useLastfm = toRef(commonStore.state, 'useLastfm')
|
||||||
|
const allowDownload = toRef(commonStore.state, 'allowDownload')
|
||||||
const showing = ref(false)
|
const showing = ref(false)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
•
|
•
|
||||||
{{ duration }}
|
{{ duration }}
|
||||||
|
|
||||||
<template v-if="sharedState.useLastfm">
|
<template v-if="useLastfm">
|
||||||
•
|
•
|
||||||
<a class="info" href title="View artist's extra information" @click.prevent="showInfo">Info</a>
|
<a class="info" href title="View artist's extra information" @click.prevent="showInfo">Info</a>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="sharedState.allowDownload">
|
<template v-if="allowDownload">
|
||||||
•
|
•
|
||||||
<a
|
<a
|
||||||
class="download"
|
class="download"
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
<SongList ref="songList" :config="listConfig" :items="songs" type="artist" @press:enter="onPressEnter"/>
|
<SongList ref="songList" :config="listConfig" :items="songs" type="artist" @press:enter="onPressEnter"/>
|
||||||
|
|
||||||
<section class="info-wrapper" v-if="sharedState.useLastfm && showing">
|
<section class="info-wrapper" v-if="useLastfm && showing">
|
||||||
<CloseModalBtn @click="showing = false"/>
|
<CloseModalBtn @click="showing = false"/>
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<div class="loading" v-if="loading">
|
<div class="loading" v-if="loading">
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent, reactive, ref, toRefs, watch } from 'vue'
|
import { defineAsyncComponent, ref, toRef, toRefs, watch } from 'vue'
|
||||||
import { pluralize } from '@/utils'
|
import { pluralize } from '@/utils'
|
||||||
import { commonStore } from '@/stores'
|
import { commonStore } from '@/stores'
|
||||||
import { artistInfoService, downloadService } from '@/services'
|
import { artistInfoService, downloadService } from '@/services'
|
||||||
|
@ -97,7 +97,8 @@ const ArtistThumbnail = defineAsyncComponent(() => import('@/components/ui/Album
|
||||||
const CloseModalBtn = defineAsyncComponent(() => import('@/components/ui/BtnCloseModal.vue'))
|
const CloseModalBtn = defineAsyncComponent(() => import('@/components/ui/BtnCloseModal.vue'))
|
||||||
|
|
||||||
const listConfig: Partial<SongListConfig> = { columns: ['track', 'title', 'album', 'length'] }
|
const listConfig: Partial<SongListConfig> = { columns: ['track', 'title', 'album', 'length'] }
|
||||||
const sharedState = reactive(commonStore.state)
|
const useLastfm = toRef(commonStore.state, 'useLastfm')
|
||||||
|
const allowDownload = toRef(commonStore.state, 'allowDownload')
|
||||||
|
|
||||||
const showing = ref(false)
|
const showing = ref(false)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineAsyncComponent, reactive, toRef } from 'vue'
|
import { computed, defineAsyncComponent, toRef } from 'vue'
|
||||||
import { pluralize } from '@/utils'
|
import { pluralize } from '@/utils'
|
||||||
import { queueStore, songStore } from '@/stores'
|
import { queueStore, songStore } from '@/stores'
|
||||||
import { playbackService } from '@/services'
|
import { playbackService } from '@/services'
|
||||||
|
@ -72,9 +72,7 @@ const {
|
||||||
toggleControls
|
toggleControls
|
||||||
} = useSongList(toRef(queueStore.state, 'songs'), { clearQueue: true })
|
} = useSongList(toRef(queueStore.state, 'songs'), { clearQueue: true })
|
||||||
|
|
||||||
const songState = reactive(songStore.state)
|
const showShuffleLibraryButton = computed(() => songs.value.length > 0)
|
||||||
|
|
||||||
const showShuffleLibraryButton = computed(() => songState.songs.length > 0)
|
|
||||||
|
|
||||||
const playAll = (shuffle: boolean) => playbackService.queueAndPlay(songs.value.length ? songs.value : songStore.all, shuffle)
|
const playAll = (shuffle: boolean) => playbackService.queueAndPlay(songs.value.length ? songs.value : songStore.all, shuffle)
|
||||||
const clearQueue = () => queueStore.clear()
|
const clearQueue = () => queueStore.clear()
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineAsyncComponent, nextTick, reactive, ref, toRefs, watch } from 'vue'
|
import { computed, defineAsyncComponent, nextTick, ref, toRef, toRefs, watch } from 'vue'
|
||||||
import { alerts, pluralize } from '@/utils'
|
import { alerts, pluralize } from '@/utils'
|
||||||
import { playlistStore } from '@/stores'
|
import { playlistStore } from '@/stores'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
@ -72,7 +72,9 @@ const props = defineProps<{ songs: Song[], showing: Boolean, config: AddToMenuCo
|
||||||
const { songs, showing, config } = toRefs(props)
|
const { songs, showing, config } = toRefs(props)
|
||||||
|
|
||||||
const newPlaylistName = ref('')
|
const newPlaylistName = ref('')
|
||||||
const playlistState = reactive(playlistStore.state)
|
|
||||||
|
const allPlaylists = toRef(playlistStore.state, 'playlists')
|
||||||
|
const playlists = computed(() => allPlaylists.value.filter(playlist => !playlist.is_smart))
|
||||||
|
|
||||||
const emit = defineEmits(['closing'])
|
const emit = defineEmits(['closing'])
|
||||||
const close = () => emit('closing')
|
const close = () => emit('closing')
|
||||||
|
@ -87,8 +89,6 @@ const {
|
||||||
|
|
||||||
watch(songs, () => songs.value.length || close())
|
watch(songs, () => songs.value.length || close())
|
||||||
|
|
||||||
const playlists = computed(() => playlistState.playlists.filter(playlist => !playlist.is_smart))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the selected songs as a playlist.
|
* Save the selected songs as a playlist.
|
||||||
* As of current we don't have selective save.
|
* As of current we don't have selective save.
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="open-edit-form" v-if="isAdmin" @click="openEditForm">Edit</li>
|
<li class="open-edit-form" v-if="isAdmin" @click="openEditForm">Edit</li>
|
||||||
<li class="download" v-if="sharedState.allowDownload" @click="download">Download</li>
|
<li class="download" v-if="allowDownload" @click="download">Download</li>
|
||||||
<li
|
<li
|
||||||
class="copy-url"
|
class="copy-url"
|
||||||
v-if="copyable && onlyOneSongSelected"
|
v-if="copyable && onlyOneSongSelected"
|
||||||
|
@ -39,9 +39,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, reactive, Ref, toRef, toRefs, watchEffect } from 'vue'
|
import { computed, Ref, toRef } from 'vue'
|
||||||
import { alerts, copyText, eventBus, isClipboardSupported as copyable } from '@/utils'
|
import { alerts, copyText, eventBus, isClipboardSupported as copyable } from '@/utils'
|
||||||
import { playlistStore, queueStore, commonStore, songStore, userStore } from '@/stores'
|
import { commonStore, playlistStore, queueStore, songStore, userStore } from '@/stores'
|
||||||
import { downloadService, playbackService } from '@/services'
|
import { downloadService, playbackService } from '@/services'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import { useContextMenu, useSongMenuMethods } from '@/composables'
|
import { useContextMenu, useSongMenuMethods } from '@/composables'
|
||||||
|
@ -64,14 +64,14 @@ const {
|
||||||
addSongsToExistingPlaylist
|
addSongsToExistingPlaylist
|
||||||
} = useSongMenuMethods(songs, close)
|
} = useSongMenuMethods(songs, close)
|
||||||
|
|
||||||
const playlistState = reactive(playlistStore.state)
|
const playlists = toRef(playlistStore.state, 'playlists')
|
||||||
const sharedState = reactive(commonStore.state)
|
const allowDownload = toRef(commonStore.state, 'allowDownload')
|
||||||
const userState = reactive(userStore.state)
|
const user = toRef(userStore.state, 'current')
|
||||||
|
|
||||||
const onlyOneSongSelected = computed(() => songs.value.length === 1)
|
const onlyOneSongSelected = computed(() => songs.value.length === 1)
|
||||||
const firstSongPlaying = computed(() => songs.value.length ? songs.value[0].playbackState === 'Playing' : false)
|
const firstSongPlaying = computed(() => songs.value.length ? songs.value[0].playbackState === 'Playing' : false)
|
||||||
const normalPlaylists = computed(() => playlistState.playlists.filter(playlist => !playlist.is_smart))
|
const normalPlaylists = computed(() => playlists.value.filter(playlist => !playlist.is_smart))
|
||||||
const isAdmin = computed(() => userState.current.is_admin)
|
const isAdmin = computed(() => user.value.is_admin)
|
||||||
|
|
||||||
const doPlayback = () => {
|
const doPlayback = () => {
|
||||||
if (!songs.value.length) return
|
if (!songs.value.length) return
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { orderBy } from 'lodash'
|
import { orderBy } from 'lodash'
|
||||||
import { computed, reactive, ref, toRefs } from 'vue'
|
import { computed, ref, toRef, toRefs } from 'vue'
|
||||||
import { albumStore, artistStore, queueStore, userStore } from '@/stores'
|
import { albumStore, artistStore, queueStore, userStore } from '@/stores'
|
||||||
import { playbackService } from '@/services'
|
import { playbackService } from '@/services'
|
||||||
import { defaultCover, fileReader } from '@/utils'
|
import { defaultCover, fileReader } from '@/utils'
|
||||||
|
@ -28,7 +28,7 @@ const props = defineProps<{ entity: Album | Artist }>()
|
||||||
const { entity } = toRefs(props)
|
const { entity } = toRefs(props)
|
||||||
|
|
||||||
const droppable = ref(false)
|
const droppable = ref(false)
|
||||||
const userState = reactive(userStore.state)
|
const user = toRef(userStore.state, 'current')
|
||||||
|
|
||||||
const forAlbum = computed(() => 'artist' in entity.value)
|
const forAlbum = computed(() => 'artist' in entity.value)
|
||||||
const sortFields = computed(() => forAlbum.value ? ['disc', 'track'] : ['album_id', 'disc', 'track'])
|
const sortFields = computed(() => forAlbum.value ? ['disc', 'track'] : ['album_id', 'disc', 'track'])
|
||||||
|
@ -64,7 +64,7 @@ const buttonLabel = computed(() => forAlbum.value
|
||||||
|
|
||||||
const playbackFunc = computed(() => forAlbum.value ? playbackService.playAllInAlbum : playbackService.playAllByArtist)
|
const playbackFunc = computed(() => forAlbum.value ? playbackService.playAllInAlbum : playbackService.playAllByArtist)
|
||||||
|
|
||||||
const allowsUpload = computed(() => userState.current.is_admin)
|
const allowsUpload = computed(() => user.value.is_admin)
|
||||||
|
|
||||||
const playOrQueue = (event: KeyboardEvent) => {
|
const playOrQueue = (event: KeyboardEvent) => {
|
||||||
if (event.metaKey || event.ctrlKey) {
|
if (event.metaKey || event.ctrlKey) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<template v-if="song">
|
<template v-if="song">
|
||||||
<div v-show="song.lyrics">
|
<div v-show="song.lyrics">
|
||||||
<div ref="lyricsContainer" v-html="song.lyrics"></div>
|
<div ref="lyricsContainer" v-html="song.lyrics"></div>
|
||||||
<TextZoomer :target="textZoomTarget"/>
|
<Magnifier :target="lyricsContainer"/>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="song.id && !song.lyrics" class="none text-secondary">
|
<p v-if="song.id && !song.lyrics" class="none text-secondary">
|
||||||
<template v-if="isAdmin">
|
<template v-if="isAdmin">
|
||||||
|
@ -22,27 +22,21 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineAsyncComponent, onUpdated, reactive, ref, toRefs } from 'vue'
|
import { computed, defineAsyncComponent, ref, toRef, toRefs } from 'vue'
|
||||||
import { eventBus } from '@/utils'
|
import { eventBus } from '@/utils'
|
||||||
import { userStore } from '@/stores'
|
import { userStore } from '@/stores'
|
||||||
|
|
||||||
const TextZoomer = defineAsyncComponent(() => import('@/components/ui/TextMagnifier.vue'))
|
const Magnifier = defineAsyncComponent(() => import('@/components/ui/TextMagnifier.vue'))
|
||||||
|
|
||||||
const props = defineProps<{ song: Song | null }>()
|
const props = defineProps<{ song: Song | null }>()
|
||||||
const { song } = toRefs(props)
|
const { song } = toRefs(props)
|
||||||
|
|
||||||
const lyricsContainer = ref(null as unknown as HTMLElement)
|
const lyricsContainer = ref<HTMLElement>()
|
||||||
const textZoomTarget = ref(null as unknown as HTMLElement)
|
const user = toRef(userStore.state, 'current')
|
||||||
const userState = reactive(userStore.state)
|
|
||||||
|
|
||||||
const showEditSongForm = () => eventBus.emit('MODAL_SHOW_EDIT_SONG_FORM', [song.value], 'lyrics')
|
const isAdmin = computed(() => user.value.is_admin)
|
||||||
|
|
||||||
const isAdmin = computed(() => userState.current.is_admin)
|
const showEditSongForm = () => eventBus.emit('MODAL_SHOW_EDIT_SONG_FORM', song.value, 'lyrics')
|
||||||
|
|
||||||
onUpdated(() => {
|
|
||||||
// Since Vue's $refs are not reactive, we work around by assigning to a data property
|
|
||||||
textZoomTarget.value = lyricsContainer.value
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Axios, { AxiosInstance, Method } from 'axios'
|
||||||
import NProgress from 'nprogress'
|
import NProgress from 'nprogress'
|
||||||
|
|
||||||
import { eventBus } from '@/utils'
|
import { eventBus } from '@/utils'
|
||||||
import { authService, localStorageService } from '@/services'
|
import { authService } from '@/services'
|
||||||
|
|
||||||
export const httpService = {
|
export const httpService = {
|
||||||
client: null as AxiosInstance | null,
|
client: null as AxiosInstance | null,
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"allowJs": true, // for some external modules
|
"allowJs": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["js/*"]
|
"@/*": ["js/*"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue