deemixer/public/js/modules/components/home-tab.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

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 {
tracks: [],
albums: [],
artists: [],
playlists: []
2020-04-29 08:36:30 +00:00
}
},
methods: {
artistView,
2020-04-29 08:36:30 +00:00
albumView,
playlistView,
playPausePreview: TrackPreview.playPausePreview,
previewMouseEnter: TrackPreview.previewMouseEnter,
previewMouseLeave: TrackPreview.previewMouseLeave,
numberWithDots: Utils.numberWithDots,
2020-04-29 08:36:30 +00:00
convertDuration: Utils.convertDuration,
addToQueue(e) {
2020-04-29 08:36:30 +00:00
e.stopPropagation()
Downloads.sendAddToQueue(e.currentTarget.dataset.link)
},
openQualityModal(e) {
2020-04-29 08:36:30 +00:00
QualityModal.open(e.currentTarget.dataset.link)
},
initHome(data) {
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