From cd5b7ef7c308dffbd13009cf2cd5adb02bda2630 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 4 Jan 2022 22:28:09 +0100 Subject: [PATCH] fixed querying chart tracks twice --- public/js/bundle.js | 2 +- src/components/pages/Charts.vue | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/public/js/bundle.js b/public/js/bundle.js index 050791b..c90215c 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -3073,7 +3073,7 @@ a { `+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(` 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(;athis.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.setTracklist(response.data)) } else { this.country = '' localStorage.setItem('chart', this.country)