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">
|
|
|
|
<index-button-list :index="index_list"></index-button-list>
|
|
|
|
</template>
|
2018-08-11 01:47:10 -04:00
|
|
|
<template slot="heading-left">
|
|
|
|
<p class="title is-4">Artists</p>
|
|
|
|
<p class="heading">{{ artists.total }} artists</p>
|
|
|
|
</template>
|
|
|
|
<template slot="heading-right">
|
|
|
|
<a class="button is-small" :class="{ 'is-info': hide_singles }" @click="update_hide_singles">
|
|
|
|
<span class="icon">
|
|
|
|
<i class="mdi mdi-numeric-1-box-multiple-outline"></i>
|
|
|
|
</span>
|
|
|
|
<span>Hide singles</span>
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
<template slot="content">
|
2020-04-11 13:43:53 -04:00
|
|
|
<list-item-artist v-for="artist in artists_filtered"
|
2018-12-17 04:35:39 -05:00
|
|
|
:key="artist.id"
|
|
|
|
:artist="artist"
|
2020-04-11 13:43:53 -04:00
|
|
|
@click="open_artist(artist)">
|
2018-12-17 04:35:39 -05:00
|
|
|
<template slot="actions">
|
|
|
|
<a @click="open_dialog(artist)">
|
|
|
|
<span class="icon has-text-dark"><i class="mdi mdi-dots-vertical mdi-18px"></i></span>
|
|
|
|
</a>
|
|
|
|
</template>
|
2018-12-15 03:56:09 -05:00
|
|
|
</list-item-artist>
|
|
|
|
<modal-dialog-artist :show="show_details_modal" :artist="selected_artist" @close="show_details_modal = false" />
|
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'
|
2018-08-11 01:47:10 -04:00
|
|
|
import ListItemArtist from '@/components/ListItemArtist'
|
2018-12-15 03:56:09 -05:00
|
|
|
import ModalDialogArtist from '@/components/ModalDialogArtist'
|
2018-08-11 01:47:10 -04:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
import * as types from '@/store/mutation_types'
|
|
|
|
|
|
|
|
const artistsData = {
|
|
|
|
load: function (to) {
|
|
|
|
return webapi.library_artists()
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
|
|
|
vm.artists = response.data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageArtists',
|
2020-04-11 13:43:53 -04:00
|
|
|
mixins: [LoadDataBeforeEnterMixin(artistsData)],
|
2018-12-15 03:56:09 -05:00
|
|
|
components: { ContentWithHeading, TabsMusic, IndexButtonList, ListItemArtist, ModalDialogArtist },
|
2018-08-11 01:47:10 -04:00
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
2018-12-15 03:56:09 -05:00
|
|
|
artists: { items: [] },
|
|
|
|
|
|
|
|
show_details_modal: false,
|
|
|
|
selected_artist: {}
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
hide_singles () {
|
|
|
|
return this.$store.state.hide_singles
|
2018-12-08 02:48:15 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
index_list () {
|
|
|
|
return [...new Set(this.artists.items
|
|
|
|
.filter(artist => !this.$store.state.hide_singles || artist.track_count > (artist.album_count * 2))
|
|
|
|
.map(artist => artist.name_sort.charAt(0).toUpperCase()))]
|
2020-04-11 13:43:53 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
artists_filtered () {
|
|
|
|
return this.artists.items.filter(artist => !this.hide_singles || artist.track_count > (artist.album_count * 2))
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
update_hide_singles: function (e) {
|
|
|
|
this.$store.commit(types.HIDE_SINGLES, !this.hide_singles)
|
2018-12-08 02:48:15 -05:00
|
|
|
},
|
|
|
|
|
2018-12-17 04:35:39 -05:00
|
|
|
open_artist: function (artist) {
|
|
|
|
this.$router.push({ path: '/music/artists/' + artist.id })
|
|
|
|
},
|
|
|
|
|
2018-12-15 03:56:09 -05:00
|
|
|
open_dialog: function (artist) {
|
|
|
|
this.selected_artist = artist
|
|
|
|
this.show_details_modal = true
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|