2018-08-11 01:47:10 -04:00
< template >
< div >
< tabs -music > < / t a b s - m u s i c >
<!-- 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" >
2018-12-16 03:17:43 -05:00
< list -item -album v-for ="album in recently_added.items" :key="album.id" :album="album" @click="open_album(album)" >
2020-08-23 13:26:54 -04:00
< template slot = "artwork" v-if ="is_visible_artwork" >
2020-07-26 01:47:37 -04:00
< p class = "image is-64x64 fd-has-shadow fd-has-action" >
< cover -artwork
: artwork _url = "album.artwork_url"
: artist = "album.artist"
: album = "album.name"
: maxwidth = "64"
: maxheight = "64" / >
< / p >
< / template >
2018-12-15 03:56:09 -05:00
< template slot = "actions" >
< a @click ="open_album_dialog(album)" >
< span class = "icon has-text-dark" > < i class = "mdi mdi-dots-vertical mdi-18px" > < / i > < / span >
< / a >
< / template >
< / l i s t - i t e m - a l b u m >
< modal -dialog -album :show ="show_album_details_modal" :album ="selected_album" @ close = "show_album_details_modal = false" / >
2018-08-11 01:47:10 -04: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 >
< / c o n t e n t - w i t h - h e a d i n g >
<!-- 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" >
2018-12-17 04:35:39 -05:00
< list -item -track v-for ="track in recently_played.items" :key="track.id" :track="track" @click="play_track(track)" >
2018-12-15 03:56:09 -05:00
< template slot = "actions" >
< a @click ="open_track_dialog(track)" >
< span class = "icon has-text-dark" > < i class = "mdi mdi-dots-vertical mdi-18px" > < / i > < / span >
< / a >
< / template >
< / l i s t - i t e m - t r a c k >
< modal -dialog -track :show ="show_track_details_modal" :track ="selected_track" @ close = "show_track_details_modal = false" / >
2018-08-11 01:47:10 -04: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 >
< / c o n t e n t - w i t h - h e a d i n g >
< / div >
< / template >
< script >
import { LoadDataBeforeEnterMixin } from './mixin'
import ContentWithHeading from '@/templates/ContentWithHeading'
import TabsMusic from '@/components/TabsMusic'
import ListItemAlbum from '@/components/ListItemAlbum'
import ListItemTrack from '@/components/ListItemTrack'
2018-12-15 03:56:09 -05:00
import ModalDialogTrack from '@/components/ModalDialogTrack'
import ModalDialogAlbum from '@/components/ModalDialogAlbum'
2020-07-26 01:47:37 -04:00
import CoverArtwork from '@/components/CoverArtwork'
2018-08-11 01:47:10 -04:00
import webapi from '@/webapi'
const browseData = {
load : function ( to ) {
return Promise . all ( [
2019-02-09 02:48:42 -05: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 01:47:10 -04: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 13:43:53 -04:00
mixins : [ LoadDataBeforeEnterMixin ( browseData ) ] ,
2020-07-26 01:47:37 -04:00
components : { ContentWithHeading , TabsMusic , ListItemAlbum , ListItemTrack , ModalDialogTrack , ModalDialogAlbum , CoverArtwork } ,
2018-08-11 01:47:10 -04:00
data ( ) {
return {
recently _added : { } ,
2018-12-15 03:56:09 -05:00
recently _played : { } ,
show _track _details _modal : false ,
selected _track : { } ,
show _album _details _modal : false ,
selected _album : { }
2018-08-11 01:47:10 -04:00
}
} ,
2020-08-23 13:26:54 -04:00
computed : {
is _visible _artwork ( ) {
return this . $store . getters . settings _option ( 'webinterface' , 'show_cover_artwork_in_album_lists' ) . value
}
} ,
2018-08-11 01:47:10 -04:00
methods : {
open _browse : function ( type ) {
this . $router . push ( { path : '/music/browse/' + type } )
2018-12-15 03:56:09 -05:00
} ,
open _track _dialog : function ( track ) {
this . selected _track = track
this . show _track _details _modal = true
} ,
2018-12-16 03:17:43 -05:00
open _album : function ( album ) {
this . $router . push ( { path : '/music/albums/' + album . id } )
} ,
2018-12-15 03:56:09 -05:00
open _album _dialog : function ( album ) {
this . selected _album = album
this . show _album _details _modal = true
2018-12-17 04:35:39 -05:00
} ,
play _track : function ( track ) {
webapi . player _play _uri ( track . uri , false )
2018-08-11 01:47:10 -04:00
}
}
}
< / script >
< style >
< / style >