2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2022-05-03 16:51:59 +00:00
|
|
|
<article :class="mode" class="album-info" data-testid="album-info">
|
2022-10-18 14:07:41 +00:00
|
|
|
<h1 v-if="mode === 'aside'" class="name">
|
2022-04-15 14:24:30 +00:00
|
|
|
<span>{{ album.name }}</span>
|
2022-07-15 07:23:55 +00:00
|
|
|
<button :title="`Play all songs in ${album.name}`" class="control" type="button" @click.prevent="play">
|
2023-11-10 13:16:06 +00:00
|
|
|
<Icon :icon="faCirclePlay" size="xl" />
|
2022-04-15 14:24:30 +00:00
|
|
|
</button>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<main>
|
2022-12-02 16:17:37 +00:00
|
|
|
<AlbumThumbnail v-if="mode === 'aside'" :entity="album" />
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
<template v-if="info">
|
|
|
|
<div v-if="info.wiki?.summary" class="wiki">
|
2022-12-02 16:17:37 +00:00
|
|
|
<div v-if="showSummary" class="summary" data-testid="summary" v-html="info.wiki.summary" />
|
|
|
|
<div v-if="showFull" class="full" data-testid="full" v-html="info.wiki.full" />
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-11-29 10:18:58 +00:00
|
|
|
<button v-if="showSummary" class="more" @click.prevent="showingFullWiki = true">
|
2022-04-15 14:24:30 +00:00
|
|
|
Full Wiki
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
2022-12-02 16:17:37 +00:00
|
|
|
<TrackList v-if="info.tracks?.length" :album="album" :tracks="info.tracks" data-testid="album-info-tracks" />
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
<footer>
|
2022-06-10 10:47:46 +00:00
|
|
|
Data ©
|
2022-07-08 14:53:04 +00:00
|
|
|
<a :href="info.url" rel="noopener" target="_blank">Last.fm</a>
|
2022-06-10 10:47:46 +00:00
|
|
|
</footer>
|
2022-04-15 14:24:30 +00:00
|
|
|
</template>
|
|
|
|
</main>
|
|
|
|
</article>
|
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-07-15 07:23:55 +00:00
|
|
|
import { faCirclePlay } from '@fortawesome/free-solid-svg-icons'
|
2022-04-15 17:00:08 +00:00
|
|
|
import { computed, defineAsyncComponent, ref, toRefs, watch } from 'vue'
|
2022-06-10 10:47:46 +00:00
|
|
|
import { songStore } from '@/stores'
|
2022-10-18 14:07:41 +00:00
|
|
|
import { mediaInfoService, playbackService } from '@/services'
|
2022-11-18 18:44:20 +00:00
|
|
|
import { useRouter, useThirdPartyServices } from '@/composables'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2024-02-24 15:37:01 +00:00
|
|
|
import AlbumThumbnail from '@/components/ui/ArtistAlbumThumbnail.vue'
|
2022-07-08 14:53:04 +00:00
|
|
|
|
|
|
|
const TrackList = defineAsyncComponent(() => import('@/components/album/AlbumTrackList.vue'))
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-07-10 09:31:55 +00:00
|
|
|
const props = withDefaults(defineProps<{ album: Album, mode?: MediaInfoDisplayMode }>(), { mode: 'aside' })
|
2022-04-15 17:00:08 +00:00
|
|
|
const { album, mode } = toRefs(props)
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-11-18 18:44:20 +00:00
|
|
|
const { go } = useRouter()
|
2023-12-27 11:49:28 +00:00
|
|
|
const { useLastfm, useSpotify } = useThirdPartyServices()
|
2022-11-18 18:44:20 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
const info = ref<AlbumInfo | null>(null)
|
2022-04-15 17:00:08 +00:00
|
|
|
const showingFullWiki = ref(false)
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
watch(album, async () => {
|
|
|
|
showingFullWiki.value = false
|
|
|
|
info.value = null
|
2023-12-27 11:49:28 +00:00
|
|
|
|
|
|
|
if (useLastfm.value || useSpotify.value) {
|
|
|
|
info.value = await mediaInfoService.fetchForAlbum(album.value)
|
|
|
|
}
|
2022-07-08 14:53:04 +00:00
|
|
|
}, { immediate: true })
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
const showSummary = computed(() => mode.value !== 'full' && !showingFullWiki.value)
|
|
|
|
const showFull = computed(() => !showSummary.value)
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-10-08 10:54:25 +00:00
|
|
|
const play = async () => {
|
2022-10-21 20:06:43 +00:00
|
|
|
playbackService.queueAndPlay(await songStore.fetchForAlbum(album.value))
|
2022-11-18 18:44:20 +00:00
|
|
|
go('queue')
|
2022-10-08 10:54:25 +00:00
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
|
|
|
|
2022-08-10 14:56:01 +00:00
|
|
|
<style lang="scss" scoped>
|
2022-04-15 14:24:30 +00:00
|
|
|
.album-info {
|
|
|
|
@include artist-album-info();
|
2022-07-08 14:53:04 +00:00
|
|
|
|
|
|
|
.track-listing {
|
|
|
|
margin-top: 2rem;
|
2022-10-18 14:07:41 +00:00
|
|
|
|
2022-10-27 17:06:49 +00:00
|
|
|
:deep(h1) {
|
2022-10-18 14:07:41 +00:00
|
|
|
margin-bottom: 1.2rem;
|
|
|
|
}
|
2022-07-08 14:53:04 +00:00
|
|
|
}
|
2022-04-15 14:24:30 +00:00
|
|
|
}
|
|
|
|
</style>
|