koel/resources/assets/js/components/main-wrapper/main-content/favorites.vue

83 lines
2 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
2016-06-25 16:05:24 +00:00
<section id="favoritesWrapper">
<h1 class="heading">
<span>Songs You Love
2016-11-17 08:37:12 +00:00
<controls-toggler :showing-controls="showingControls" @toggleControls="toggleControls"/>
2016-01-14 08:02:59 +00:00
2016-06-25 16:05:24 +00:00
<span class="meta" v-show="meta.songCount">
{{ meta.songCount | pluralize('song') }}
{{ meta.totalLength }}
<template v-if="sharedState.allowDownload && state.songs.length">
2016-10-31 04:28:12 +00:00
<a href @click.prevent="download" title="Download all songs in playlist">
2016-06-25 16:05:24 +00:00
Download
</a>
</template>
</span>
</span>
2015-12-13 04:42:28 +00:00
2016-11-17 08:37:12 +00:00
<song-list-controls
v-show="state.songs.length && (!isPhone || showingControls)"
2016-11-17 08:37:12 +00:00
:config="songListControlConfig"
:selectedSongs="selectedSongs"
/>
2016-06-25 16:05:24 +00:00
</h1>
2015-12-13 04:42:28 +00:00
2016-10-31 04:28:12 +00:00
<song-list v-show="state.songs.length" :items="state.songs" type="favorites"/>
2016-01-06 07:12:36 +00:00
2016-06-25 16:05:24 +00:00
<div v-show="!state.songs.length" class="none">
Start loving!
Click the <i style="margin: 0 5px" class="fa fa-heart"></i> icon when a song is playing to add it
to this list.
</div>
</section>
2015-12-13 04:42:28 +00:00
</template>
<script>
2016-06-25 16:05:24 +00:00
import isMobile from 'ismobilejs';
2016-02-19 07:20:34 +00:00
2016-06-25 16:05:24 +00:00
import { pluralize } from '../../../utils';
import { favoriteStore, sharedStore } from '../../../stores';
import { playback, download } from '../../../services';
import hasSongList from '../../../mixins/has-song-list';
2016-02-19 07:20:34 +00:00
2016-06-25 16:05:24 +00:00
export default {
name: 'main-wrapper--main-content--favorites',
mixins: [hasSongList],
filters: { pluralize },
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
data () {
return {
state: favoriteStore.state,
sharedState: sharedStore.state,
};
},
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
methods: {
/**
* Download all favorite songs.
*/
download() {
download.fromFavorites();
},
},
};
2015-12-13 04:42:28 +00:00
</script>
<style lang="sass">
2016-06-25 16:05:24 +00:00
@import "../../../../sass/partials/_vars.scss";
@import "../../../../sass/partials/_mixins.scss";
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
#favoritesWrapper {
.none {
color: $color2ndText;
padding: 16px 24px;
2016-01-06 07:12:36 +00:00
2016-06-25 16:05:24 +00:00
a {
color: $colorHighlight;
2015-12-13 04:42:28 +00:00
}
2016-06-25 16:05:24 +00:00
}
}
2015-12-13 04:42:28 +00:00
</style>