2020-04-29 08:36:30 +00:00
|
|
|
import { socket } from '../socket.js'
|
|
|
|
import { artistView, albumView, playlistView } from '../tabs.js'
|
|
|
|
import Downloads from '../downloads.js'
|
|
|
|
import QualityModal from '../quality-modal.js'
|
|
|
|
import TrackPreview from '../track-preview.js'
|
|
|
|
import Utils from '../utils.js'
|
|
|
|
|
|
|
|
const HomeTab = new Vue({
|
|
|
|
data() {
|
|
|
|
return {
|
2020-04-29 19:46:10 +00:00
|
|
|
tracks: [],
|
|
|
|
albums: [],
|
|
|
|
artists: [],
|
|
|
|
playlists: []
|
2020-04-29 08:36:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2020-04-29 19:46:10 +00:00
|
|
|
artistView,
|
2020-04-29 08:36:30 +00:00
|
|
|
albumView,
|
|
|
|
playlistView,
|
|
|
|
playPausePreview: TrackPreview.playPausePreview,
|
|
|
|
previewMouseEnter: TrackPreview.previewMouseEnter,
|
|
|
|
previewMouseLeave: TrackPreview.previewMouseLeave,
|
2020-04-29 19:46:10 +00:00
|
|
|
numberWithDots: Utils.numberWithDots,
|
2020-04-29 08:36:30 +00:00
|
|
|
convertDuration: Utils.convertDuration,
|
2020-04-29 19:46:10 +00:00
|
|
|
addToQueue(e) {
|
2020-04-29 08:36:30 +00:00
|
|
|
e.stopPropagation()
|
|
|
|
Downloads.sendAddToQueue(e.currentTarget.dataset.link)
|
|
|
|
},
|
2020-04-29 19:46:10 +00:00
|
|
|
openQualityModal(e) {
|
2020-04-29 08:36:30 +00:00
|
|
|
QualityModal.open(e.currentTarget.dataset.link)
|
|
|
|
},
|
|
|
|
initHome(data) {
|
2020-04-29 19:46:10 +00:00
|
|
|
this.tracks = data.tracks.data
|
|
|
|
this.albums = data.albums.data
|
|
|
|
this.artists = data.artists.data
|
2020-04-29 08:36:30 +00:00
|
|
|
this.playlists = data.playlists.data
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
socket.on('init_home', this.initHome)
|
|
|
|
}
|
|
|
|
}).$mount('#home_tab')
|
|
|
|
|
|
|
|
export default HomeTab
|