2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2024-04-04 22:20:42 +00:00
|
|
|
<AlbumArtistInfo :mode="mode" data-testid="album-info">
|
|
|
|
<template #header>{{ album.name }}</template>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
<template #art>
|
|
|
|
<AlbumThumbnail :entity="album" />
|
|
|
|
</template>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
<template v-if="info">
|
|
|
|
<template v-if="info.wiki">
|
|
|
|
<ExpandableContentBlock v-if="mode === 'aside'">
|
|
|
|
<div v-html="info.wiki.full" />
|
|
|
|
</ExpandableContentBlock>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
<div v-else v-html="info.wiki.full" />
|
2022-04-15 14:24:30 +00:00
|
|
|
</template>
|
2024-04-04 22:20:42 +00:00
|
|
|
|
|
|
|
<TrackList
|
|
|
|
v-if="info.tracks?.length"
|
|
|
|
:album="album"
|
|
|
|
:tracks="info.tracks"
|
|
|
|
class="mt-8"
|
2024-04-23 21:01:27 +00:00
|
|
|
data-testid="album-info-tracks"
|
2024-04-04 22:20:42 +00:00
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template v-if="info" #footer>
|
|
|
|
Data ©
|
|
|
|
<a :href="info.url" rel="noopener" target="_blank">Last.fm</a>
|
|
|
|
</template>
|
|
|
|
</AlbumArtistInfo>
|
2022-04-15 14:24:30 +00:00
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2024-04-04 22:20:42 +00:00
|
|
|
import { defineAsyncComponent, ref, toRefs, watch } from 'vue'
|
|
|
|
import { mediaInfoService } from '@/services'
|
|
|
|
import { 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'
|
2024-04-04 22:20:42 +00:00
|
|
|
import AlbumArtistInfo from '@/components/ui/album-artist/AlbumOrArtistInfo.vue'
|
|
|
|
import ExpandableContentBlock from '@/components/ui/album-artist/ExpandableContentBlock.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
|
|
|
|
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 14:24:30 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
watch(album, async () => {
|
|
|
|
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
|
|
|
</script>
|