2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2022-05-06 08:44:10 +00:00
|
|
|
<article :class="mode" class="artist-info" data-testid="artist-info">
|
2022-04-15 14:24:30 +00:00
|
|
|
<h1 class="name">
|
|
|
|
<span>{{ artist.name }}</span>
|
2022-07-07 18:05:46 +00:00
|
|
|
<button :title="`Play all songs by ${artist.name}`" class="play control" type="button" @click.prevent="play">
|
2022-06-10 10:47:46 +00:00
|
|
|
<i class="fa fa-play"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
</button>
|
|
|
|
</h1>
|
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
<main>
|
2022-05-06 08:44:10 +00:00
|
|
|
<ArtistThumbnail :entity="artist"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
<template v-if="info">
|
|
|
|
<div v-if="info.bio?.summary" class="bio">
|
|
|
|
<div v-if="showSummary" class="summary" v-html="info.bio.summary"/>
|
|
|
|
<div v-if="showFull" class="full" v-html="info.bio.full"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-03 16:51:59 +00:00
|
|
|
<button v-show="showSummary" class="more" data-testid="more-btn" @click.prevent="showingFullBio = true">
|
2022-04-15 14:24:30 +00:00
|
|
|
Full Bio
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
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="openener" 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-08 14:53:04 +00:00
|
|
|
import { computed, ref, toRefs, watch } from 'vue'
|
2022-04-24 08:50:45 +00:00
|
|
|
import { playbackService } from '@/services'
|
2022-06-10 10:47:46 +00:00
|
|
|
import { useThirdPartyServices } from '@/composables'
|
|
|
|
import { songStore } from '@/stores'
|
2022-07-08 14:53:04 +00:00
|
|
|
import { mediaInfoService } from '@/services/mediaInfoService'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
import ArtistThumbnail from '@/components/ui/AlbumArtistThumbnail.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
|
|
|
|
2022-06-10 10:47:46 +00:00
|
|
|
const { useLastfm } = useThirdPartyServices()
|
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
const info = ref<ArtistInfo | null>(null)
|
|
|
|
const showingFullBio = ref(false)
|
|
|
|
|
|
|
|
watch(artist, async () => {
|
|
|
|
showingFullBio.value = false
|
|
|
|
info.value = null
|
|
|
|
useLastfm.value && (info.value = await mediaInfoService.fetchForArtist(artist.value))
|
|
|
|
}, { immediate: true })
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-26 11:32:13 +00:00
|
|
|
const showSummary = computed(() => mode.value !== 'full' && !showingFullBio.value)
|
2022-04-15 17:00:08 +00:00
|
|
|
const showFull = computed(() => !showSummary.value)
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-06-10 10:47:46 +00:00
|
|
|
const play = async () => playbackService.queueAndPlay(await songStore.fetchForArtist(artist.value))
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.artist-info {
|
|
|
|
@include artist-album-info();
|
|
|
|
|
|
|
|
.none {
|
|
|
|
margin-top: 1rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|