2018-08-11 07:47:10 +02:00
< template >
< div >
< tabs-music > < / tabs-music >
<!-- Recently added -- >
< content-with-heading >
< template slot = "heading-left" >
< p class = "title is-4" > Recently added < / p >
< p class = "heading" > albums < / p >
< / template >
< template slot = "content" >
2020-09-20 12:25:38 +02:00
< list-albums :albums = "recently_added.items" > < / list-albums >
2018-08-11 07:47:10 +02:00
< / template >
< template slot = "footer" >
< nav class = "level" >
< p class = "level-item" >
< a class = "button is-light is-small is-rounded" v -on :click = "open_browse('recently_added')" > Show more < / a >
< / p >
< / nav >
< / template >
< / content-with-heading >
<!-- Recently played -- >
< content-with-heading >
< template slot = "heading-left" >
< p class = "title is-4" > Recently played < / p >
< p class = "heading" > tracks < / p >
< / template >
< template slot = "content" >
2020-10-04 17:31:47 +02:00
< list-tracks :tracks = "recently_played.items" > < / list-tracks >
2018-08-11 07:47:10 +02:00
< / template >
< template slot = "footer" >
< nav class = "level" >
< p class = "level-item" >
< a class = "button is-light is-small is-rounded" v -on :click = "open_browse('recently_played')" > Show more < / a >
< / p >
< / nav >
< / template >
< / content-with-heading >
< / div >
< / template >
< script >
import { LoadDataBeforeEnterMixin } from './mixin'
import ContentWithHeading from '@/templates/ContentWithHeading'
import TabsMusic from '@/components/TabsMusic'
2020-09-20 12:25:38 +02:00
import ListAlbums from '@/components/ListAlbums'
2020-10-04 17:31:47 +02:00
import ListTracks from '@/components/ListTracks'
2018-08-11 07:47:10 +02:00
import webapi from '@/webapi'
const browseData = {
load : function ( to ) {
return Promise . all ( [
2019-02-09 08:48:42 +01:00
webapi . search ( { type : 'album' , expression : 'time_added after 8 weeks ago and media_kind is music having track_count > 3 order by time_added desc' , limit : 3 } ) ,
webapi . search ( { type : 'track' , expression : 'time_played after 8 weeks ago and media_kind is music order by time_played desc' , limit : 3 } )
2018-08-11 07:47:10 +02:00
] )
} ,
set : function ( vm , response ) {
vm . recently _added = response [ 0 ] . data . albums
vm . recently _played = response [ 1 ] . data . tracks
}
}
export default {
name : 'PageBrowse' ,
2020-04-11 19:43:53 +02:00
mixins : [ LoadDataBeforeEnterMixin ( browseData ) ] ,
2020-10-04 17:31:47 +02:00
components : { ContentWithHeading , TabsMusic , ListAlbums , ListTracks } ,
2018-08-11 07:47:10 +02:00
data ( ) {
return {
2020-10-17 12:09:01 +02:00
recently _added : { items : [ ] } ,
recently _played : { items : [ ] } ,
2018-12-15 09:56:09 +01:00
show _track _details _modal : false ,
2020-09-20 12:25:38 +02:00
selected _track : { }
2020-08-23 19:26:54 +02:00
}
} ,
2018-08-11 07:47:10 +02:00
methods : {
open _browse : function ( type ) {
this . $router . push ( { path : '/music/browse/' + type } )
}
}
}
< / script >
< style >
< / style >