diff --git a/index.js b/index.js index 6688ecfc..67eeb972 100644 --- a/index.js +++ b/index.js @@ -15,6 +15,10 @@ const configSchema = { "discordClearActivityOnPause" : 0, // 0 = disabled, 1 = enabled "volume": 1 }, + "home": { + "followedArtists": [], + "favoriteItems": [] + }, "audio": { "quality": "extreme", "seamless_audio": true diff --git a/src/renderer/style.less b/src/renderer/style.less index b221ad89..3e6c114e 100644 --- a/src/renderer/style.less +++ b/src/renderer/style.less @@ -1550,18 +1550,34 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb { max-width: 420px; } + .hint-text { + font-size: 0.9rem; + color: rgb(200 200 200 / 70%); + } + .user-icon { border-radius: 100%; width: 128px; height: 128px; overflow: hidden; box-shadow: var(--mediaItemShadow-Shadow); + margin: 16px; } .well.profile-well { flex-direction: column; justify-content: center; align-items: center; + + .name { + margin: 4px; + font-weight: 500; + } + .handle { + margin: 4px; + opacity: 0.7; + font-weight: 500; + } } } diff --git a/src/renderer/views/pages/artist.ejs b/src/renderer/views/pages/artist.ejs index 05519a95..72d00995 100644 --- a/src/renderer/views/pages/artist.ejs +++ b/src/renderer/views/pages/artist.ejs @@ -135,6 +135,27 @@ methods: { artistMenu (event) { let self = this + let followAction = "follow" + let followActions = { + follow: { + name: "Follow Artist", + action: ()=>{ + self.app.cfg.home.followedArtists.push(self.data.id) + } + }, + unfollow: { + name: "Unfollow Artist", + action: ()=>{ + let index = self.app.cfg.home.followedArtists.indexOf(self.data.id) + if (index > -1) { + self.app.cfg.home.followedArtists.splice(index, 1) + } + } + } + } + if(this.app.cfg.home.followedArtists.includes(self.data.id)) { + followAction = "unfollow" + } CiderContextMenu.Create(event, { items: [ { @@ -145,10 +166,7 @@ }) } }, - { - name: "Follow Artist", - action: ()=>{} - }, + followActions[followAction], { name: "Share", action: ()=>{} diff --git a/src/renderer/views/pages/home.ejs b/src/renderer/views/pages/home.ejs index 62b856e3..2674138a 100644 --- a/src/renderer/views/pages/home.ejs +++ b/src/renderer/views/pages/home.ejs @@ -9,9 +9,8 @@
-

{{ profile.attributes.name }}

-

@{{ profile.attributes.handle }}

- +

{{ profile.attributes.name }}

+

@{{ profile.attributes.handle }}

@@ -25,7 +24,7 @@

Your Favorites

-
Items you have added to your favorites will appear here.
+
Items you have added to your favorites will appear here.
@@ -40,7 +39,12 @@

Your Artist Feed

- + +
@@ -62,18 +66,44 @@ data: function () { return { app: this.$root, + followedArtists: this.$root.cfg.home.followedArtists, madeForYou: [], recentlyPlayed: [], friendsListeningTo: [], profile: {}, - modify: 0 + modify: 0, + artistFeed: [] } }, async mounted() { let self = this this.getListenNowData() + await this.getArtistFeed() }, methods: { + async getArtistFeed() { + let artists = this.followedArtists + let self = this + console.warn("get artist feed") + this.app.mk.api.artists(artists, { + "views": "featured-release,full-albums,appears-on-albums,featured-albums,featured-on-albums,singles,compilation-albums,live-albums,latest-release,top-music-videos,similar-artists,top-songs,playlists,more-to-hear,more-to-see", + "extend": "artistBio,bornOrFormed,editorialArtwork,editorialVideo,isGroup,origin,hero", + "extend[playlists]": "trackCount", + "include[songs]": "albums", + "fields[albums]": "artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url,trackCount", + "limit[artists:top-songs]": 20, + "art[url]": "f" + }, { includeResponseMeta: !0 }).then(artistData => { + artistData.data.forEach(item => { + if(item.views["latest-release"].data.length != 0) { + self.artistFeed.push(item.views["latest-release"].data[0]) + } + }) + console.warn("got artist feed") + console.log(self.artistFeed) + }) + + }, getRecentlyPlayed() { }, @@ -127,7 +157,6 @@ ; })[0].relationships.contents.data }catch(err){} - }); app.mk.api.v3.music("/v1/me/social/profile/").then((response) => {