From 806a4174dfa0325e1385a654647e8e0c98d39905 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 8 Jun 2019 17:26:45 -0400 Subject: [PATCH] More work on artistInfo component --- music_graph/src/components/AlbumCarousel.vue | 27 ++++++--- music_graph/src/components/ArtistInfo.vue | 55 ++++++++++++++++--- music_graph/static/album.png | Bin 0 -> 1044 bytes 3 files changed, 66 insertions(+), 16 deletions(-) create mode 100644 music_graph/static/album.png diff --git a/music_graph/src/components/AlbumCarousel.vue b/music_graph/src/components/AlbumCarousel.vue index fe7ab54..210fea4 100644 --- a/music_graph/src/components/AlbumCarousel.vue +++ b/music_graph/src/components/AlbumCarousel.vue @@ -1,20 +1,23 @@ @@ -23,7 +26,7 @@ import {MusicGraphApi} from '../MusicGraphApi' export default { name: 'AlbumCarousel', - props: ['releases', 'interval'], + props: ['releases', 'interval', 'alone'], data() { return { api: new MusicGraphApi(), @@ -37,18 +40,23 @@ export default { }, Number(this.interval)) }, watch: { - releases: () => { + releases: function () { this.index = 0 + this.tick() } }, methods: { tick() { - if (this.index === this.releases.length - 1) { + if (this.releases.length === 0) { + return + } + + if (this.index >= this.releases.length) { this.index = 0 } - this.index += 1 this.current = this.releases[this.index].mbid + this.index += 1 } } } @@ -58,7 +66,8 @@ export default { figure { text-align: center; - margin: 0 0 10px 0; - max-width: 300px; + width: 128px; + height: 180px; + margin: 0 20px 3em 20px; } diff --git a/music_graph/src/components/ArtistInfo.vue b/music_graph/src/components/ArtistInfo.vue index b36e279..3c4891b 100644 --- a/music_graph/src/components/ArtistInfo.vue +++ b/music_graph/src/components/ArtistInfo.vue @@ -1,14 +1,27 @@ @@ -39,7 +52,9 @@ export default { this.api.getArtistDetails(artist.mbid) .then(info => { this.artistInfo = info - this.artistInfo.releases = this.artistInfo.releases.slice(0, 2) + this.artistInfo.releases = this.artistInfo.releases.filter(r => + r.labels.indexOf('Album') !== -1 || r.labels.indexOf('EP') !== -1) + this.artistInfo.tags = info.tags.sort((a, b) => b.weight - a.weight).splice(0, 6) }) } } @@ -48,7 +63,33 @@ export default { diff --git a/music_graph/static/album.png b/music_graph/static/album.png new file mode 100644 index 0000000000000000000000000000000000000000..80eed4396d683103fe9504ca91ca8f8f4c30a8dd GIT binary patch literal 1044 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLm;Om)7d$|)7e>}peR2rGbfdS zL1SX=L|c!;4l+mMgSWbB@#$(jny}C+Qb4ruik8Sirxl`6r3O2{aL+PP(bel~%076o z|LCgb?#=7?)-@^oV0`rG)sh!Vs{iygw{(1butWa+JKJ~n7@ZcMF{-O_*kZ_V;*8NV6;00bA4~b=EbxddW?;}$24TjE zrS@e&LG}_)Usv|WY#hSkI`*eu&j$)gmbgZgIOpf)rskC}I2WZRmZYXAlxLP?D7bt2 z281{Ai320|pQnpsNX4zUmpAe<7;qfeaH;oyernrH=?(rJQ(mlL53l7kV31(oVPIom zZeTpXkibA~E^SOjb}!AG4zYyV0fOvwaLCgl)FGB6NH;uY{wu>&I02Yk7(8A5T-G@y GGywqL?lJrT literal 0 HcmV?d00001