2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<tabs-music></tabs-music>
|
|
|
|
|
|
|
|
<content-with-heading>
|
2018-12-08 02:48:15 -05:00
|
|
|
<template slot="options">
|
2020-10-08 00:01:17 -04:00
|
|
|
<index-button-list :index="albums_list.indexList"></index-button-list>
|
|
|
|
|
|
|
|
<div class="columns">
|
|
|
|
<div class="column">
|
|
|
|
<p class="heading" style="margin-bottom: 24px;">Filter</p>
|
|
|
|
<div class="field">
|
|
|
|
<div class="control">
|
|
|
|
<input id="switchHideSingles" type="checkbox" name="switchHideSingles" class="switch" v-model="hide_singles">
|
|
|
|
<label for="switchHideSingles">Hide singles</label>
|
|
|
|
</div>
|
2020-10-17 01:26:00 -04:00
|
|
|
<p class="help">If active, hides singles and albums with tracks that only appear in playlists.</p>
|
2020-10-08 00:01:17 -04:00
|
|
|
</div>
|
2020-10-11 03:01:34 -04:00
|
|
|
<div class="field" v-if="spotify_enabled">
|
2020-10-08 00:01:17 -04:00
|
|
|
<div class="control">
|
|
|
|
<input id="switchHideSpotify" type="checkbox" name="switchHideSpotify" class="switch" v-model="hide_spotify">
|
2020-10-17 01:26:00 -04:00
|
|
|
<label for="switchHideSpotify">Hide albums from Spotify</label>
|
2020-10-08 00:01:17 -04:00
|
|
|
</div>
|
2020-10-17 01:26:00 -04:00
|
|
|
<p class="help">If active, hides albums that only appear in your Spotify library.</p>
|
2020-10-08 00:01:17 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
<p class="heading" style="margin-bottom: 24px;">Sort by</p>
|
|
|
|
<dropdown-menu v-model="sort" :options="sort_options"></dropdown-menu>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-12-08 02:48:15 -05:00
|
|
|
</template>
|
2018-08-11 01:47:10 -04:00
|
|
|
<template slot="heading-left">
|
|
|
|
<p class="title is-4">Albums</p>
|
2020-10-08 00:01:17 -04:00
|
|
|
<p class="heading">{{ albums_list.sortedAndFiltered.length }} Albums</p>
|
2018-08-11 01:47:10 -04:00
|
|
|
</template>
|
|
|
|
<template slot="heading-right">
|
|
|
|
</template>
|
|
|
|
<template slot="content">
|
2020-10-08 00:01:17 -04:00
|
|
|
<list-albums :albums="albums_list"></list-albums>
|
2018-08-11 01:47:10 -04:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { LoadDataBeforeEnterMixin } from './mixin'
|
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading'
|
|
|
|
import TabsMusic from '@/components/TabsMusic'
|
2018-12-08 02:48:15 -05:00
|
|
|
import IndexButtonList from '@/components/IndexButtonList'
|
2020-09-20 02:13:19 -04:00
|
|
|
import ListAlbums from '@/components/ListAlbums'
|
2020-10-08 00:01:17 -04:00
|
|
|
import DropdownMenu from '@/components/DropdownMenu'
|
2018-08-11 01:47:10 -04:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
import * as types from '@/store/mutation_types'
|
2020-10-08 00:01:17 -04:00
|
|
|
import Albums from '@/lib/Albums'
|
2018-08-11 01:47:10 -04:00
|
|
|
|
|
|
|
const albumsData = {
|
|
|
|
load: function (to) {
|
2020-06-30 04:24:11 -04:00
|
|
|
return webapi.library_albums('music')
|
2018-08-11 01:47:10 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
|
|
|
vm.albums = response.data
|
2018-12-16 03:17:43 -05:00
|
|
|
vm.index_list = [...new Set(vm.albums.items
|
|
|
|
.filter(album => !vm.$store.state.hide_singles || album.track_count > 2)
|
|
|
|
.map(album => album.name_sort.charAt(0).toUpperCase()))]
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageAlbums',
|
2020-04-11 13:43:53 -04:00
|
|
|
mixins: [LoadDataBeforeEnterMixin(albumsData)],
|
2020-10-08 00:01:17 -04:00
|
|
|
components: { ContentWithHeading, TabsMusic, IndexButtonList, ListAlbums, DropdownMenu },
|
2018-08-11 01:47:10 -04:00
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
2018-12-15 03:56:09 -05:00
|
|
|
albums: { items: [] },
|
2020-10-08 00:01:17 -04:00
|
|
|
sort_options: ['Name', 'Recently added', 'Recently released']
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2020-10-08 00:01:17 -04:00
|
|
|
albums_list () {
|
|
|
|
return new Albums(this.albums.items, {
|
|
|
|
hideSingles: this.hide_singles,
|
|
|
|
hideSpotify: this.hide_spotify,
|
|
|
|
sort: this.sort,
|
|
|
|
group: true
|
|
|
|
})
|
2020-04-11 13:43:53 -04:00
|
|
|
},
|
|
|
|
|
2020-10-11 03:01:34 -04:00
|
|
|
spotify_enabled () {
|
|
|
|
return this.$store.state.spotify.webapi_token_valid
|
|
|
|
},
|
|
|
|
|
2020-10-08 00:01:17 -04:00
|
|
|
hide_singles: {
|
|
|
|
get () {
|
|
|
|
return this.$store.state.hide_singles
|
|
|
|
},
|
|
|
|
set (value) {
|
|
|
|
this.$store.commit(types.HIDE_SINGLES, value)
|
2020-09-20 11:59:46 -04:00
|
|
|
}
|
2020-10-08 00:01:17 -04:00
|
|
|
},
|
2018-08-11 01:47:10 -04:00
|
|
|
|
2020-10-08 00:01:17 -04:00
|
|
|
hide_spotify: {
|
|
|
|
get () {
|
|
|
|
return this.$store.state.hide_spotify
|
|
|
|
},
|
|
|
|
set (value) {
|
|
|
|
this.$store.commit(types.HIDE_SPOTIFY, value)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
sort: {
|
|
|
|
get () {
|
|
|
|
return this.$store.state.albums_sort
|
|
|
|
},
|
|
|
|
set (value) {
|
|
|
|
this.$store.commit(types.ALBUMS_SORT, value)
|
|
|
|
}
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
2018-12-16 03:17:43 -05:00
|
|
|
},
|
|
|
|
|
2020-10-08 00:01:17 -04:00
|
|
|
methods: {
|
|
|
|
scrollToTop: function () {
|
|
|
|
window.scrollTo({ top: 0, behavior: 'smooth' })
|
2018-12-16 03:17:43 -05:00
|
|
|
}
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|