diff --git a/public/css/modules/tabs.css b/public/css/modules/tabs.css
index 9b1d2cd..162b93c 100644
--- a/public/css/modules/tabs.css
+++ b/public/css/modules/tabs.css
@@ -1,5 +1,6 @@
/* Tabs */
.search_tabcontent,
-.main_tabcontent {
+.main_tabcontent,
+.favorites_tabcontent {
display: none;
-}
\ No newline at end of file
+}
diff --git a/public/index.html b/public/index.html
index 951b8f5..73f16f4 100644
--- a/public/index.html
+++ b/public/index.html
@@ -366,6 +366,91 @@
Charts
Favorites
+
+
+
+
+
+
+
+
+
No Playlists found
+
+
+
+
+
+
get_app
+
+
{{ release.title }}
+
{{ 'by '+release.creator.name+' - '+release.nb_tracks+' tracks' }}
+
+
+
+
+
+
No Favorite Albums found
+
+
+
+
+
+
get_app
+
+
{{ release.title }}
+
{{ 'by '+release.artist.name }}
+
+
+
+
+
+
No Favorite Artist found
+
+
+
+
+
+
get_app
+
+
{{ release.name }}
+
+
+
+
+
+
No Favorite Tracks found
+
+
+
+ {{ track.position }} |
+
+ play_arrow
+ |
+
+ {{ track.title + (track.title_version && track.title.indexOf(track.title_version) == -1 ? ' '+ track.title_version : '') }}
+ |
+
+ {{track.artist.name}} |
+
+ {{track.album.title}} |
+ {{convertDuration(track.duration)}} |
+ get_app
+ |
+
+
+
diff --git a/public/js/modules/components/favorites-tab.js b/public/js/modules/components/favorites-tab.js
new file mode 100644
index 0000000..6c05202
--- /dev/null
+++ b/public/js/modules/components/favorites-tab.js
@@ -0,0 +1,45 @@
+import { socket } from '../socket.js'
+import { playlistView, artistView, albumView } 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 FavoritesTab = new Vue({
+ data() {
+ return {
+ tracks: [],
+ albums: [],
+ artists: [],
+ playlists: []
+ }
+ },
+ methods: {
+ playlistView,
+ artistView,
+ albumView,
+ playPausePreview: TrackPreview.playPausePreview,
+ previewMouseEnter: TrackPreview.previewMouseEnter,
+ previewMouseLeave: TrackPreview.previewMouseLeave,
+ convertDuration: Utils.convertDuration,
+ addToQueue(e) {
+ e.stopPropagation()
+ Downloads.sendAddToQueue(e.currentTarget.dataset.link)
+ },
+ openQualityModal(e) {
+ QualityModal.open(e.currentTarget.dataset.link)
+ },
+ initFavorites(data) {
+ this.tracks = data.tracks
+ this.albums = data.albums
+ this.artists = data.artists
+ this.playlists = data.playlists
+ document.getElementById('favorites_playlist_tab').click()
+ }
+ },
+ mounted() {
+ socket.on('init_favorites', this.initFavorites)
+ }
+}).$mount('#favorites_tab')
+
+export default FavoritesTab
diff --git a/public/js/modules/tabs.js b/public/js/modules/tabs.js
index 268a0e3..6d077cd 100644
--- a/public/js/modules/tabs.js
+++ b/public/js/modules/tabs.js
@@ -3,6 +3,7 @@ import TracklistTab from './components/tracklist-tab.js'
import LinkAnalyzerTab from './components/link-analyzer-tab.js'
import HomeTab from './components/home-tab.js'
import ChartsTab from './components/charts-tab.js'
+import FavoritesTab from './components/favorites-tab.js'
import { socket } from './socket.js'
import SettingsTab from './components/settings-tab.js'
import MainSearch from './components/main-search.js'
@@ -53,7 +54,8 @@ function analyzeLink(link) {
}
function linkListeners() {
- document.getElementById('search_tab').addEventListener('click', handleTabClick)
+ document.getElementById('search_tab').addEventListener('click', handleSearchTabClick)
+ document.getElementById('favorites_tab').addEventListener('click', handleFavoritesTabClick)
document.getElementById('sidebar').addEventListener('click', handleSidebarClick)
const backButtons = Array.from(document.getElementsByClassName('back-button'))
@@ -106,7 +108,7 @@ function handleSidebarClick(event) {
}
}
-function handleTabClick(event) {
+function handleSearchTabClick(event) {
let targetID = event.target.id
switch (targetID) {
@@ -131,6 +133,28 @@ function handleTabClick(event) {
}
}
+function handleFavoritesTabClick(event) {
+ let targetID = event.target.id
+
+ switch (targetID) {
+ case 'favorites_playlist_tab':
+ changeTab(event.target, 'favorites', 'playlist_favorites')
+ break
+ case 'favorites_album_tab':
+ changeTab(event.target, 'favorites', 'album_favorites')
+ break
+ case 'favorites_artist_tab':
+ changeTab(event.target, 'favorites', 'artist_favorites')
+ break
+ case 'favorites_track_tab':
+ changeTab(event.target, 'favorites', 'track_favorites')
+ break
+
+ default:
+ break
+ }
+}
+
function changeTab(sidebarEl, section, tabName) {
windows_stack = []
currentStack = {}