replaced See All text with History text next to recently played

This commit is contained in:
booploops 2022-02-10 16:29:56 -08:00
parent 379180f992
commit 54bea15925

View file

@ -8,7 +8,7 @@
<h3>{{app.getLz('home.recentlyPlayed')}}</h3> <h3>{{app.getLz('home.recentlyPlayed')}}</h3>
</div> </div>
<div class="col-auto nopadding flex-center"> <div class="col-auto nopadding flex-center">
<button class="cd-btn-seeall" @click="seeAllHistory()">{{app.getLz('term.seeAll')}}</button> <button class="cd-btn-seeall" @click="seeAllHistory()">{{app.getLz('term.history')}}</button>
</div> </div>
</div> </div>
<div class="well artistfeed-well"> <div class="well artistfeed-well">
@ -54,7 +54,7 @@
<h3>{{app.getLz('home.madeForYou')}}</h3> <h3>{{app.getLz('home.madeForYou')}}</h3>
<div class="well"> <div class="well">
<vue-horizontal v-if="isSectionReady('madeForYou')"> <vue-horizontal v-if="isSectionReady('madeForYou')">
<mediaitem-square kind="small" v-for="item in madeForYou" :item="item"></mediaitem-square> <mediaitem-square kind="small" v-for="item in madeForYou" :item="item"></mediaitem-square>
</vue-horizontal> </vue-horizontal>
<div class="spinner" v-else></div> <div class="spinner" v-else></div>
</div> </div>
@ -72,9 +72,8 @@
</div> </div>
<div class="well"> <div class="well">
<vue-horizontal v-if="isSectionReady('friendsListeningTo')"> <vue-horizontal v-if="isSectionReady('friendsListeningTo')">
<mediaitem-square kind="small" v-for="item in friendsListeningTo" <mediaitem-square kind="small" v-for="item in friendsListeningTo" :item="item"></mediaitem-square>
:item="item"></mediaitem-square> </vue-horizontal>
</vue-horizontal>
<div class="spinner" v-else></div> <div class="spinner" v-else></div>
</div> </div>
</div> </div>
@ -86,7 +85,7 @@
<script> <script>
Vue.component('cider-home', { Vue.component('cider-home', {
template: '#cider-home', template: '#cider-home',
data: function () { data: function() {
return { return {
app: this.$root, app: this.$root,
followedArtists: this.$root.cfg.home.followedArtists, followedArtists: this.$root.cfg.home.followedArtists,
@ -112,7 +111,9 @@
}, },
methods: { methods: {
async seeAllHistory() { async seeAllHistory() {
let hist = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, { l : this.$root.mklang}) let hist = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, {
l: this.$root.mklang
})
app.showCollection(hist.data, app.getLz('term.history')) app.showCollection(hist.data, app.getLz('term.history'))
}, },
isSectionReady(section) { isSectionReady(section) {
@ -122,7 +123,7 @@
let self = this let self = this
return { return {
name: "Remove from Favorites", name: "Remove from Favorites",
action: function (item) { action: function(item) {
let index = self.favoriteItems.findIndex(x => x.id == item.id) let index = self.favoriteItems.findIndex(x => x.id == item.id)
if (index > -1) { if (index > -1) {
self.favoriteItems.splice(index, 1) self.favoriteItems.splice(index, 1)
@ -143,12 +144,16 @@
} }
} }
if (playlists.length != 0) { if (playlists.length != 0) {
this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${playlists.toString()}`, { l : this.$root.mklang}).then(playlistsData => { this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${playlists.toString()}`, {
l: this.$root.mklang
}).then(playlistsData => {
self.favorites.push(...playlistsData.data) self.favorites.push(...playlistsData.data)
}) })
} }
if (libraryPlaylists.length != 0) { if (libraryPlaylists.length != 0) {
this.app.mk.api.v3.music(`v1/me/library/playlists/${playlists.toString()}`, { l : this.$root.mklang}).then(playlistsData => { this.app.mk.api.v3.music(`v1/me/library/playlists/${playlists.toString()}`, {
l: this.$root.mklang
}).then(playlistsData => {
self.favorites.push(...playlistsData.data) self.favorites.push(...playlistsData.data)
}) })
} }
@ -158,11 +163,11 @@
let self = this let self = this
this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists?ids=${artists.toString()}&views=latest-release&include[songs]=albums&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount&limit[artists:top-songs]=2&art[url]=f&l=${this.$root.mklang}`).then(artistData => { this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists?ids=${artists.toString()}&views=latest-release&include[songs]=albums&fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount&limit[artists:top-songs]=2&art[url]=f&l=${this.$root.mklang}`).then(artistData => {
artistData.data.data.forEach(item => { artistData.data.data.forEach(item => {
if (item.views["latest-release"].data.length != 0) { if (item.views["latest-release"].data.length != 0) {
self.artistFeed.push(item.views["latest-release"].data[0]) self.artistFeed.push(item.views["latest-release"].data[0])
} }
}) })
// sort artistFeed by attributes.releaseDate descending, date is formatted as "YYYY-MM-DD" // sort artistFeed by attributes.releaseDate descending, date is formatted as "YYYY-MM-DD"
this.artistFeed.sort((a, b) => { this.artistFeed.sort((a, b) => {
let dateA = new Date(a.attributes.releaseDate) let dateA = new Date(a.attributes.releaseDate)
let dateB = new Date(b.attributes.releaseDate) let dateB = new Date(b.attributes.releaseDate)
@ -185,7 +190,7 @@
return section return section
}; };
})[0].relationships.contents.data })[0].relationships.contents.data
} catch (err) { } } catch (err) {}
self.sectionsReady.push("madeForYou") self.sectionsReady.push("madeForYou")
try { try {
@ -195,7 +200,7 @@
return section return section
}; };
})[0].relationships.contents.data })[0].relationships.contents.data
} catch (err) { } } catch (err) {}
self.sectionsReady.push("recentlyPlayed") self.sectionsReady.push("recentlyPlayed")
self.sectionsReady.push("friendsListeningTo") self.sectionsReady.push("friendsListeningTo")
}); });