2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2024-04-04 22:20:42 +00:00
|
|
|
<AlbumArtistInfo :mode="mode" data-testid="artist-info">
|
|
|
|
<template #header>{{ artist.name }}</template>
|
|
|
|
|
|
|
|
<template #art>
|
|
|
|
<ArtistThumbnail :entity="artist" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template v-if="info?.bio">
|
|
|
|
<ExpandableContentBlock v-if="mode === 'aside'">
|
|
|
|
<div v-html="info.bio.full" />
|
|
|
|
</ExpandableContentBlock>
|
|
|
|
|
|
|
|
<div v-else v-html="info.bio.full" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template v-if="info" #footer>
|
|
|
|
Data ©
|
|
|
|
<a :href="info.url" rel="openener" 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 { 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 ArtistThumbnail 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-04-15 14:24:30 +00:00
|
|
|
|
2022-07-10 09:31:55 +00:00
|
|
|
const props = withDefaults(defineProps<{ artist: Artist, mode?: MediaInfoDisplayMode }>(), { mode: 'aside' })
|
2022-04-15 17:00:08 +00:00
|
|
|
const { artist, mode } = toRefs(props)
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2023-12-27 11:49:28 +00:00
|
|
|
const { useLastfm, useSpotify } = useThirdPartyServices()
|
2022-06-10 10:47:46 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
const info = ref<ArtistInfo | null>(null)
|
|
|
|
|
|
|
|
watch(artist, async () => {
|
|
|
|
info.value = null
|
2023-12-27 11:49:28 +00:00
|
|
|
|
|
|
|
if (useLastfm.value || useSpotify.value) {
|
|
|
|
info.value = await mediaInfoService.fetchForArtist(artist.value)
|
|
|
|
}
|
2022-07-08 14:53:04 +00:00
|
|
|
}, { immediate: true })
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|