diff --git a/public/index.html b/public/index.html index cb34c8e..2f89ce0 100644 --- a/public/index.html +++ b/public/index.html @@ -249,6 +249,76 @@

No Playlists found

Home

+
+

Top Tracks

+ + + + + + + + + +
+ play_arrow + {{track.title + (track.title_version ? ' '+track.title_version : '')}} + {{track.artist.name}} + {{track.album.title}}{{convertDuration(track.duration)}}get_app +
+
+
+

Top Albums

+
+
+
+ +
get_app
+
+

{{ release.title }}

+

{{ 'by '+release.artist.name }}

+
+
+
+
+

Top Artists

+
+
+
+ +
get_app
+
+

{{ release.name }}

+
+
+
+
+

Top Playlists

+
+
+
+ +
get_app
+
+

{{ release.title }}

+

{{ 'by '+release.user.name+' - '+release.nb_tracks+' tracks' }}

+
+
+
@@ -655,4 +725,4 @@

{{ metadata }} - \ No newline at end of file + diff --git a/public/js/modules/components/home-tab.js b/public/js/modules/components/home-tab.js new file mode 100644 index 0000000..fe74134 --- /dev/null +++ b/public/js/modules/components/home-tab.js @@ -0,0 +1,46 @@ +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: [] + } + }, + methods: { + artistView, + albumView, + playlistView, + playPausePreview: TrackPreview.playPausePreview, + previewMouseEnter: TrackPreview.previewMouseEnter, + previewMouseLeave: TrackPreview.previewMouseLeave, + numberWithDots: Utils.numberWithDots, + convertDuration: Utils.convertDuration, + addToQueue: function (e) { + e.stopPropagation() + Downloads.sendAddToQueue(e.currentTarget.dataset.link) + }, + openQualityModal: function (e) { + e.preventDefault() + QualityModal.open(e.currentTarget.dataset.link) + }, + initHome(data) { + this.tracks = data.tracks.data + this.albums = data.albums.data + this.artists = data.artists.data + this.playlists = data.playlists.data + } + }, + mounted() { + socket.on('init_home', this.initHome) + } +}).$mount('#home_tab') + +export default HomeTab diff --git a/public/js/modules/tabs.js b/public/js/modules/tabs.js index 77c8bc6..ed6f316 100644 --- a/public/js/modules/tabs.js +++ b/public/js/modules/tabs.js @@ -1,6 +1,7 @@ import ArtistTab from './components/artist-tab.js' import TracklistTab from './components/tracklist-tab.js' import LinkAnalyzerTab from './components/link-analyzer-tab.js' +import HomeTab from './components/home-tab.js' import { socket } from './socket.js' import SettingsTab from './components/settings-tab.js' import MainSearch from './components/main-search.js' diff --git a/public/js/modules/track-preview.js b/public/js/modules/track-preview.js index 853c728..a71902e 100644 --- a/public/js/modules/track-preview.js +++ b/public/js/modules/track-preview.js @@ -63,7 +63,6 @@ function previewMouseLeave(e) { // on click event function playPausePreview(e) { e.preventDefault() - console.log('PlayPause') let obj = e.currentTarget var icon = obj.tagName == 'I' ? $(obj) : $(obj).children('i') if ($(obj).attr('playing')) {