fixed querying chart tracks twice

This commit is contained in:
RemixDev 2022-01-04 22:28:09 +01:00
parent 33e03f0973
commit cd5b7ef7c3
2 changed files with 1 additions and 2 deletions

View File

@ -3073,7 +3073,7 @@ a {
`+e._s(e.$tc("globals.listTabs."+i.releaseType))+` `+e._s(e.$tc("globals.listTabs."+i.releaseType))+`
`)])])]),e._v(" "),n("td",{staticClass:"w-32 text-center xl:w-40"},[e._v(e._s(i.releaseDate))]),e._v(" "),n("td",{staticClass:"w-20 text-center xl:w-32"},[e._v(e._s(i.releaseTracksNumber))]),e._v(" "),n("td",{staticClass:"w-8 cursor-pointer",attrs:{"data-cm-link":i.releaseLink},on:{click:function(r){return r.stopPropagation(),e.sendAddToQueue(i.releaseLink)}}},[n("i",{staticClass:"material-icons hover:text-primary",attrs:{title:e.$t("globals.download_hint")}},[e._v("file_download")])])],1)}),0)])],1)},__vue_staticRenderFns__$j=[];const __vue_inject_styles__$j=void 0,__vue_scope_id__$j=void 0,__vue_is_functional_template__$j=!1;function __vue_normalize__$j(e,a,n,i,r,l,o,c){const s=(typeof n=="function"?n.options:n)||{};return s.__file="Artist.vue",s.render||(s.render=e.render,s.staticRenderFns=e.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}var Artist=__vue_normalize__$j({render:__vue_render__$j,staticRenderFns:__vue_staticRenderFns__$j},__vue_inject_styles__$j,__vue_script__$j,__vue_scope_id__$j,__vue_is_functional_template__$j);function getChartsData(){return fetchData("getCharts")}function getChartTracks(e){return fetchData("getChartTracks",{id:e})}var script$i={methods:{previewMouseEnter,previewMouseLeave}};const __vue_script__$i=script$i;var __vue_render__$i=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("i",{staticClass:"absolute top-0 right-0 flex items-center justify-center w-full h-full text-center text-white transition-opacity duration-200 ease-in-out bg-black bg-opacity-50 rounded opacity-0 material-icons preview_controls",attrs:{title:e.$t("globals.play_hint")},on:{mouseenter:e.previewMouseEnter,mouseleave:e.previewMouseLeave}},[e._v(` `)])])]),e._v(" "),n("td",{staticClass:"w-32 text-center xl:w-40"},[e._v(e._s(i.releaseDate))]),e._v(" "),n("td",{staticClass:"w-20 text-center xl:w-32"},[e._v(e._s(i.releaseTracksNumber))]),e._v(" "),n("td",{staticClass:"w-8 cursor-pointer",attrs:{"data-cm-link":i.releaseLink},on:{click:function(r){return r.stopPropagation(),e.sendAddToQueue(i.releaseLink)}}},[n("i",{staticClass:"material-icons hover:text-primary",attrs:{title:e.$t("globals.download_hint")}},[e._v("file_download")])])],1)}),0)])],1)},__vue_staticRenderFns__$j=[];const __vue_inject_styles__$j=void 0,__vue_scope_id__$j=void 0,__vue_is_functional_template__$j=!1;function __vue_normalize__$j(e,a,n,i,r,l,o,c){const s=(typeof n=="function"?n.options:n)||{};return s.__file="Artist.vue",s.render||(s.render=e.render,s.staticRenderFns=e.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}var Artist=__vue_normalize__$j({render:__vue_render__$j,staticRenderFns:__vue_staticRenderFns__$j},__vue_inject_styles__$j,__vue_script__$j,__vue_scope_id__$j,__vue_is_functional_template__$j);function getChartsData(){return fetchData("getCharts")}function getChartTracks(e){return fetchData("getChartTracks",{id:e})}var script$i={methods:{previewMouseEnter,previewMouseLeave}};const __vue_script__$i=script$i;var __vue_render__$i=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("i",{staticClass:"absolute top-0 right-0 flex items-center justify-center w-full h-full text-center text-white transition-opacity duration-200 ease-in-out bg-black bg-opacity-50 rounded opacity-0 material-icons preview_controls",attrs:{title:e.$t("globals.play_hint")},on:{mouseenter:e.previewMouseEnter,mouseleave:e.previewMouseLeave}},[e._v(`
play_arrow play_arrow
`)])},__vue_staticRenderFns__$i=[];const __vue_inject_styles__$i=void 0,__vue_scope_id__$i=void 0,__vue_is_functional_template__$i=!1;function __vue_normalize__$i(e,a,n,i,r,l,o,c){const s=(typeof n=="function"?n.options:n)||{};return s.__file="PreviewControls.vue",s.render||(s.render=e.render,s.staticRenderFns=e.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}var PreviewControls=__vue_normalize__$i({render:__vue_render__$i,staticRenderFns:__vue_staticRenderFns__$i},__vue_inject_styles__$i,__vue_script__$i,__vue_scope_id__$i,__vue_is_functional_template__$i),script$h={components:{PreviewControls},data(){return{country:"",id:0,countries:[],chart:[]}},computed:{worldwideRelease(){return this.countries.filter(a=>a.title==="Worldwide")[0]}},watch:{id(e){e!==0&&getChartTracks(e).then(n=>this.setTracklist(n.data))}},async created(){let{data:e}=await getChartsData(),a;e=e.filter(n=>(n.title==="Worldwide"&&(a=n),n.title!=="Worldwide")),e.unshift(a),this.initCharts(e)},methods:{convertDuration,playPausePreview,addToQueue(e){e.stopPropagation(),sendAddToQueue(e.currentTarget.dataset.link)},getTrackList(e){document.getElementById("content").scrollTo(0,0);const{currentTarget:{dataset:{title:a,id:n}}}=e;this.country=a,localStorage.setItem("chart",this.country),this.id=n},setTracklist(e){this.chart=e},onChangeCountry(){this.country="",this.id=0},initCharts(e){if(this.countries=e,this.country=localStorage.getItem("chart")||"",!this.country)return;let a=0;for(;a<this.countries.length&&this.countries[a].title!==this.country;a++);a!==this.countries.length?(this.id=this.countries[a].id,getChartTracks(this.id).then(n=>this.setTracklist(n.data))):(this.country="",localStorage.setItem("chart",this.country))}}};const __vue_script__$h=script$h;var __vue_render__$h=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(e._s(e.$t("charts.title"))+" "+e._s(e.country?"- "+e.country:""))]),e._v(" "),e.country===""?n("div",[n("div",{staticClass:"release-grid"},e._l(e.countries,function(i){return n("div",{key:i.id,staticClass:"w-40 h-40 release clickable",attrs:{"aria-label":i.title,"data-id":i.id,"data-title":i.title,role:"button"},on:{click:e.getTrackList}},[n("img",{staticClass:"w-full rounded coverart",attrs:{src:i.picture_medium,alt:i.title}})])}),0)]):n("div",[n("button",{staticClass:"btn btn-primary",on:{click:e.onChangeCountry}},[e._v(e._s(e.$t("charts.changeCountry")))]),e._v(" "),n("button",{staticClass:"btn btn-primary",attrs:{"data-link":"https://www.deezer.com/playlist/"+e.id},on:{click:function(i){return i.stopPropagation(),e.addToQueue.apply(null,arguments)}}},[e._v(` `)])},__vue_staticRenderFns__$i=[];const __vue_inject_styles__$i=void 0,__vue_scope_id__$i=void 0,__vue_is_functional_template__$i=!1;function __vue_normalize__$i(e,a,n,i,r,l,o,c){const s=(typeof n=="function"?n.options:n)||{};return s.__file="PreviewControls.vue",s.render||(s.render=e.render,s.staticRenderFns=e.staticRenderFns,s._compiled=!0,r&&(s.functional=!0)),s._scopeId=i,s}var PreviewControls=__vue_normalize__$i({render:__vue_render__$i,staticRenderFns:__vue_staticRenderFns__$i},__vue_inject_styles__$i,__vue_script__$i,__vue_scope_id__$i,__vue_is_functional_template__$i),script$h={components:{PreviewControls},data(){return{country:"",id:0,countries:[],chart:[]}},computed:{worldwideRelease(){return this.countries.filter(a=>a.title==="Worldwide")[0]}},watch:{id(e){e!==0&&getChartTracks(e).then(n=>this.setTracklist(n.data))}},async created(){let{data:e}=await getChartsData(),a;e=e.filter(n=>(n.title==="Worldwide"&&(a=n),n.title!=="Worldwide")),e.unshift(a),this.initCharts(e)},methods:{convertDuration,playPausePreview,addToQueue(e){e.stopPropagation(),sendAddToQueue(e.currentTarget.dataset.link)},getTrackList(e){document.getElementById("content").scrollTo(0,0);const{currentTarget:{dataset:{title:a,id:n}}}=e;this.country=a,localStorage.setItem("chart",this.country),this.id=n},setTracklist(e){this.chart=e},onChangeCountry(){this.country="",this.id=0},initCharts(e){if(this.countries=e,this.country=localStorage.getItem("chart")||"",!this.country)return;let a=0;for(;a<this.countries.length&&this.countries[a].title!==this.country;a++);a!==this.countries.length?this.id=this.countries[a].id:(this.country="",localStorage.setItem("chart",this.country))}}};const __vue_script__$h=script$h;var __vue_render__$h=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(e._s(e.$t("charts.title"))+" "+e._s(e.country?"- "+e.country:""))]),e._v(" "),e.country===""?n("div",[n("div",{staticClass:"release-grid"},e._l(e.countries,function(i){return n("div",{key:i.id,staticClass:"w-40 h-40 release clickable",attrs:{"aria-label":i.title,"data-id":i.id,"data-title":i.title,role:"button"},on:{click:e.getTrackList}},[n("img",{staticClass:"w-full rounded coverart",attrs:{src:i.picture_medium,alt:i.title}})])}),0)]):n("div",[n("button",{staticClass:"btn btn-primary",on:{click:e.onChangeCountry}},[e._v(e._s(e.$t("charts.changeCountry")))]),e._v(" "),n("button",{staticClass:"btn btn-primary",attrs:{"data-link":"https://www.deezer.com/playlist/"+e.id},on:{click:function(i){return i.stopPropagation(),e.addToQueue.apply(null,arguments)}}},[e._v(`
`+e._s(e.$t("charts.download"))+` `+e._s(e.$t("charts.download"))+`
`)]),e._v(" "),n("table",{staticClass:"table table--charts"},[n("tbody",e._l(e.chart,function(i,r){return n("tr",{key:r,staticClass:"track_row"},[n("td",{staticClass:"p-3 text-center cursor-default",class:{first:r===0}},[e._v(` `)]),e._v(" "),n("table",{staticClass:"table table--charts"},[n("tbody",e._l(e.chart,function(i,r){return n("tr",{key:r,staticClass:"track_row"},[n("td",{staticClass:"p-3 text-center cursor-default",class:{first:r===0}},[e._v(`
`+e._s(r+1)+` `+e._s(r+1)+`

View File

@ -182,7 +182,6 @@ export default {
if (i !== this.countries.length) { if (i !== this.countries.length) {
this.id = this.countries[i].id this.id = this.countries[i].id
getChartTracks(this.id).then(response => this.setTracklist(response.data))
} else { } else {
this.country = '' this.country = ''
localStorage.setItem('chart', this.country) localStorage.setItem('chart', this.country)