added vue-horizontal

This commit is contained in:
booploops 2022-02-09 03:30:52 -08:00
parent 308193061d
commit 63b1293903
13 changed files with 486 additions and 66 deletions

View file

@ -53,9 +53,9 @@
<div class="col">
<h3>{{app.getLz('home.madeForYou')}}</h3>
<div class="well">
<template v-if="isSectionReady('madeForYou')">
<mediaitem-square kind="small" v-for="item in madeForYou" :item="item"></mediaitem-square>
</template>
<vue-horizontal v-if="isSectionReady('madeForYou')">
<mediaitem-square kind="small" v-for="item in madeForYou" :item="item"></mediaitem-square>
</vue-horizontal>
<div class="spinner" v-else></div>
</div>
</div>
@ -71,10 +71,10 @@
</div>
</div>
<div class="well">
<template v-if="isSectionReady('friendsListeningTo')">
<vue-horizontal v-if="isSectionReady('friendsListeningTo')">
<mediaitem-square kind="small" v-for="item in friendsListeningTo"
:item="item"></mediaitem-square>
</template>
:item="item"></mediaitem-square>
</vue-horizontal>
<div class="spinner" v-else></div>
</div>
</div>
@ -86,7 +86,7 @@
<script>
Vue.component('cider-home', {
template: '#cider-home',
data: function() {
data: function () {
return {
app: this.$root,
followedArtists: this.$root.cfg.home.followedArtists,
@ -122,7 +122,7 @@
let self = this
return {
name: "Remove from Favorites",
action: function(item) {
action: function (item) {
let index = self.favoriteItems.findIndex(x => x.id == item.id)
if (index > -1) {
self.favoriteItems.splice(index, 1)
@ -142,12 +142,12 @@
playlists.push(item.id)
}
}
if (playlists.length != 0) {
if (playlists.length != 0) {
this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${playlists.toString()}`).then(playlistsData => {
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()}`).then(playlistsData => {
self.favorites.push(...playlistsData.data)
})
@ -158,11 +158,11 @@
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`).then(artistData => {
artistData.data.data.forEach(item => {
if (item.views["latest-release"].data.length != 0) {
self.artistFeed.push(item.views["latest-release"].data[0])
}
})
// sort artistFeed by attributes.releaseDate descending, date is formatted as "YYYY-MM-DD"
if (item.views["latest-release"].data.length != 0) {
self.artistFeed.push(item.views["latest-release"].data[0])
}
})
// sort artistFeed by attributes.releaseDate descending, date is formatted as "YYYY-MM-DD"
this.artistFeed.sort((a, b) => {
let dateA = new Date(a.attributes.releaseDate)
let dateB = new Date(b.attributes.releaseDate)
@ -185,7 +185,7 @@
return section
};
})[0].relationships.contents.data
} catch (err) {}
} catch (err) { }
self.sectionsReady.push("madeForYou")
try {
@ -195,7 +195,7 @@
return section
};
})[0].relationships.contents.data
} catch (err) {}
} catch (err) { }
self.sectionsReady.push("recentlyPlayed")
self.sectionsReady.push("friendsListeningTo")
});
@ -204,7 +204,7 @@
self.profile = response.data.data[0]
})
}
}
}
});
</script>