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-04-15 14:24:30 +00:00
|
|
|
<h1 class="name">
|
|
|
|
<span>{{ album.name }}</span>
|
2022-05-03 16:51:59 +00:00
|
|
|
<button :title="`Shuffle all songs in ${album.name}`" class="shuffle control" @click.prevent="shuffleAll">
|
2022-05-06 08:44:10 +00:00
|
|
|
<i class="fa fa-random"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
</button>
|
|
|
|
</h1>
|
|
|
|
|
|
|
|
<main>
|
2022-05-06 08:44:10 +00:00
|
|
|
<AlbumThumbnail :entity="album"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
|
|
|
<template v-if="album.info">
|
2022-05-04 21:01:35 +00:00
|
|
|
<div v-if="album.info?.wiki?.summary" class="wiki">
|
2022-05-06 08:44:10 +00:00
|
|
|
<div v-if="showSummary" class="summary" v-html="album.info?.wiki?.summary"/>
|
|
|
|
<div v-if="showFull" class="full" v-html="album.info?.wiki?.full"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-03 16:51:59 +00:00
|
|
|
<button v-if="showSummary" class="more" data-testid="more-btn" @click.prevent="showingFullWiki = true">
|
2022-04-15 14:24:30 +00:00
|
|
|
Full Wiki
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
2022-05-06 08:44:10 +00:00
|
|
|
<TrackList v-if="album.info?.tracks?.length" :album="album" data-testid="album-info-tracks"/>
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-03 16:51:59 +00:00
|
|
|
<footer>Data © <a :href="album.info?.url" rel="noopener" target="_blank">Last.fm</a></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-04-24 08:50:45 +00:00
|
|
|
import { playbackService } from '@/services'
|
2022-04-15 17:00:08 +00:00
|
|
|
import { computed, defineAsyncComponent, ref, toRefs, watch } from 'vue'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-21 10:43:10 +00:00
|
|
|
const TrackList = defineAsyncComponent(() => import('./AlbumTrackList.vue'))
|
2022-04-21 10:18:11 +00:00
|
|
|
const AlbumThumbnail = defineAsyncComponent(() => import('@/components/ui/AlbumArtistThumbnail.vue'))
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-06 08:44:10 +00:00
|
|
|
type DisplayMode = 'aside' | 'full'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-06 08:44:10 +00:00
|
|
|
const props = withDefaults(defineProps<{ album: Album, mode?: DisplayMode }>(), { mode: 'aside' })
|
2022-04-15 17:00:08 +00:00
|
|
|
const { album, mode } = toRefs(props)
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
const showingFullWiki = ref(false)
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
/**
|
|
|
|
* Whenever a new album is loaded into this component, we reset the "full wiki" state.
|
|
|
|
*/
|
|
|
|
watch(album, () => (showingFullWiki.value = false))
|
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-04-24 08:50:45 +00:00
|
|
|
const shuffleAll = () => playbackService.playAllInAlbum(album.value)
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.album-info {
|
|
|
|
@include artist-album-info();
|
|
|
|
}
|
|
|
|
</style>
|