koel/resources/assets/js/components/main-wrapper/extra/album-info.vue

86 lines
2 KiB
Vue
Raw Normal View History

<template>
2016-06-25 16:05:24 +00:00
<article id="albumInfo" :class="mode">
<h1 class="name">
<span>{{ album.name }}</span>
2016-06-25 16:05:24 +00:00
<a class="shuffle" @click.prevent="shuffleAll"><i class="fa fa-random"></i></a>
</h1>
2016-06-25 16:05:24 +00:00
<div v-if="album.info">
2016-10-31 04:28:12 +00:00
<img v-if="album.info.image" :src="album.info.image" class="cover">
2016-06-25 16:05:24 +00:00
<div class="wiki" v-if="album.info.wiki && album.info.wiki.summary">
2016-10-31 05:00:26 +00:00
<div class="summary" v-show="showSummary" v-html="album.info.wiki.summary"/>
<div class="full" v-show="showFull" v-html="album.info.wiki.full"/>
2016-10-31 05:00:26 +00:00
<button class="more" v-show="showSummary" @click.prevent="showingFullWiki = true">
2016-06-25 16:05:24 +00:00
Full Wiki
</button>
</div>
2016-06-25 16:05:24 +00:00
<section class="track-listing" v-if="album.info.tracks.length">
<h1>Track Listing</h1>
<ul class="tracks">
<li v-for="(track, idx) in album.info.tracks">
<span class="no">{{ idx + 1 }}</span>
<span class="title">{{ track.title }}</span>
<span class="length">{{ track.fmtLength }}</span>
</li>
</ul>
</section>
2016-06-25 16:05:24 +00:00
<footer>Data &copy; <a target="_blank" :href="album.info.url">Last.fm</a></footer>
</div>
2016-06-25 16:05:24 +00:00
<p class="none" v-else>No album information found.</p>
</article>
</template>
<script>
2016-06-25 16:05:24 +00:00
import { playback } from '../../../services';
2016-06-25 16:05:24 +00:00
export default {
props: ['album', 'mode'],
2016-06-25 16:05:24 +00:00
data() {
return {
showingFullWiki: false,
};
},
2016-09-23 09:55:20 +00:00
watch: {
album() {
2016-06-25 16:05:24 +00:00
this.showingFullWiki = false;
},
2016-09-23 09:55:20 +00:00
},
2016-10-31 08:15:32 +00:00
computed: {
2016-10-31 05:00:26 +00:00
showSummary() {
return this.mode !== 'full' && !this.showingFullWiki;
},
showFull() {
return this.mode === 'full' || this.showingFullWiki;
},
},
2016-09-23 09:55:20 +00:00
methods: {
2016-06-25 16:05:24 +00:00
/**
* Shuffle all songs in the current album.
*/
shuffleAll() {
playback.playAllInAlbum(this.album);
},
},
};
</script>
<style lang="sass">
2016-06-25 16:05:24 +00:00
@import "../../../../sass/partials/_vars.scss";
@import "../../../../sass/partials/_mixins.scss";
2016-06-25 16:05:24 +00:00
#albumInfo {
@include artist-album-info();
}
</style>