From ced8650ee6039c12b5eae3a9b5b0f2fad0cbec6f Mon Sep 17 00:00:00 2001 From: Roberto Tonino Date: Sat, 14 Nov 2020 22:27:47 +0100 Subject: [PATCH] style: added new release style; refactor: Artist page with composition API (to finish); refactor: extracted new release check logic --- public/js/bundle.js | 39 +++++--- src/components/pages/Artist.vue | 122 +++++++++++------------- src/components/pages/Tracklist.vue | 6 +- src/components/search/ResultsAlbums.vue | 2 +- src/components/search/ResultsTracks.vue | 2 +- src/data/artist.js | 26 ++++- src/router.js | 11 +-- src/styles/vendor/material-icons.css | 15 ++- src/utils/dates.js | 14 +++ 9 files changed, 139 insertions(+), 98 deletions(-) create mode 100644 src/utils/dates.js diff --git a/public/js/bundle.js b/public/js/bundle.js index 587a7fb..8680108 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -38,15 +38,22 @@ -webkit-font-smoothing: antialiased; } -.material-icons.explicit-icon { +.material-icons.title-icon { margin-right: 0.3125em; margin-left: -3px; +} + +.material-icons.title-icon.title-icon--right { + margin-right: 0px; + margin-left: 0.3125em; +} + +.material-icons.title-icon.title-icon--explicit { color: hsl(240, 5%, 59%); } -.material-icons.explicit-icon.explicit-icon--right { - margin-right: 0px; - margin-left: 0.3125em; +.material-icons.title-icon.title-icon--new { + color: hsl(27, 100%, 50%); } .material-icons.disabled { @@ -2465,7 +2472,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var __assign=function(){return __assign=Object.assign||function(n){for(var a,r=1,i=arguments.length;r0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){l={error:c}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(l)throw l.error}}return s}function __spread(){for(var e=[],n=0;n0)&&!(i=r.next()).done;)s.push(i.value)}catch(c){l={error:c}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(l)throw l.error}}return s}function __spread(){for(var e=[],n=0;n{if(n===e)return;localStorage.setItem("selectedTheme",e),document.documentElement.dataset.theme=e,animateAllElements()});function animateAllElements(){const e=document.querySelectorAll("*");e.forEach(n=>{n.classList.add("changing-theme")}),document.documentElement.addEventListener("transitionend",function n(){e.forEach(a=>{a.classList.remove("changing-theme")}),document.documentElement.removeEventListener("transitionend",n)})}const useTheme=()=>({THEMES,currentTheme});var script$3=defineComponent({setup(e,n){const a=reactive({activeTablink:"home",updateAvailable:!1,links}),{THEMES:r,currentTheme:i}=useTheme();return socket.on("updateAvailable",()=>{a.updateAvailable=!0}),n.root.$router.afterEach((s,l)=>{const c=a.links.find(o=>o.routerName===s.name);if(!c)return;a.activeTablink=c.name}),{...toRefs(a),THEMES:r,currentTheme:i,isSlim:computed(()=>n.root.$store.getters.getSlimSidebar)}}});const __vue_script__$3=script$3;var __vue_render__$4=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("aside",{staticClass:"top-0 left-0 flex flex-col h-screen bg-panels-bg text-foreground",class:{"w-12":e.isSlim},style:{minWidth:e.isSlim?null:"14rem"},attrs:{id:"sidebar",role:"navigation","aria-label":"sidebar"}},[e._l(e.links,function(r){return a("router-link",{key:r.name,staticClass:"relative flex items-center h-16 no-underline group main_tablinks hover:bg-background-main text-foreground",class:{"bg-background-main":e.activeTablink===r.name},attrs:{tag:"a","aria-label":r.ariaLabel,to:{name:r.routerName}},nativeOn:{click:function(i){e.activeTablink=r.name}}},[a("i",{staticClass:"p-2 text-3xl material-icons side_icon group-hover:text-primary",class:{"text-primary":e.activeTablink===r.name}},[e._v(` `+e._s(r.icon)+` `)]),e._v(" "),a("span",{staticClass:"ml-5 overflow-hidden capitalize whitespace-no-wrap main-tablinks-text",class:{hidden:e.isSlim},staticStyle:{"letter-spacing":"1.3px"}},[e._v(` @@ -2714,13 +2721,15 @@ PERFORMANCE OF THIS SOFTWARE. `)]),e._v(" "),a("p",{staticClass:"mb-2 text-base"},[e._v("For security reasons you will need to provide your own Client ID and Secret")]),e._v(" "),a("h2",{staticClass:"mt-6 text-3xl"},[e._v("How do I get my Client ID and Secret?")]),e._v(" "),e._m(0),e._v(" "),e._m(1),e._v(" "),e._m(2),e._v(" "),e._m(3),e._v(" "),a("p",{staticClass:"mb-2 text-base"},[e._v("Now you can copy-paste those results in the appropriate fields in the settings.")]),e._v(" "),a("h2",{staticClass:"mt-6 text-3xl"},[e._v("How do I get my Spotify Username?")]),e._v(" "),e._m(4)])},__vue_staticRenderFns__$d=[function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("p",{staticClass:"mb-2 text-base"},[e._v("Connect to "),a("a",{attrs:{href:"https://developer.spotify.com/dashboard",target:"_blank"}},[e._v("Spotify for Developers's Dashboard")]),e._v(" and login with your Spotify account.")])},function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("p",{staticClass:"mb-2 text-base"},[e._v(` Click on "Create an App".`),a("br"),e._v(" "),a("img",{attrs:{src:"https://i.imgur.com/YFz7rHj.png",alt:"Create an App button on Spotify for Developers's Dashboard"}})])},function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("p",{staticClass:"mb-2 text-base"},[e._v(` Fill out the "App name" and "App description" fields and check both checkboxes. Then click on the "Create" button.`),a("br"),e._v(" "),a("img",{attrs:{src:"https://i.imgur.com/A9cvDkK.png",alt:"Create an app form"}})])},function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("p",{staticClass:"mb-2 text-base"},[e._v(` - Now you can see the Client ID. If you click on "Show Client Secret" the client secret will be revealed.`),a("br"),e._v(" "),a("img",{attrs:{src:"https://i.imgur.com/foEfIhO.png",alt:"Screen of client ID and Secret"}})])},function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("p",{staticClass:"mb-2 text-base"},[e._v("You can get your Spotify Username from the "),a("a",{attrs:{href:"https://www.spotify.com/it/account/overview/",target:"_blank"}},[e._v("Overview page on Spotify's Website")]),e._v(".")])}];const __vue_inject_styles__$d=void 0,__vue_scope_id__$d=void 0,__vue_is_functional_template__$d=!1;function __vue_normalize__$d(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};return o.__file="InfoSpotifyFeatures.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var InfoSpotifyFeatures=__vue_normalize__$d({render:__vue_render__$d,staticRenderFns:__vue_staticRenderFns__$d},__vue_inject_styles__$d,__vue_script__$b,__vue_scope_id__$d,__vue_is_functional_template__$d),freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto=Object.prototype,hasOwnProperty$2=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(e){var n=hasOwnProperty$2.call(e,symToStringTag),a=e[symToStringTag];try{e[symToStringTag]=void 0;var r=!0}catch(s){}var i=nativeObjectToString.call(e);return r&&(n?e[symToStringTag]=a:delete e[symToStringTag]),i}var objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString;function objectToString(e){return nativeObjectToString$1.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(e){return e==null?e===void 0?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return e!=null&&typeof e=="object"}var symbolTag="[object Symbol]";function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==symbolTag}function arrayMap(e,n){for(var a=-1,r=e==null?0:e.length,i=Array(r);++a-1&&e%1==0)&&e-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction$2(e)}var objectProto$3=Object.prototype;function isPrototype(e){var n=e&&e.constructor,a=typeof n=="function"&&n.prototype||objectProto$3;return e===a}function baseTimes(e,n){for(var a=-1,r=Array(e);++a-1}function listCacheSet(e,n){var a=this.__data__,r=assocIndexOf(a,e);return r<0?(++this.size,a.push([e,n])):a[r][1]=n,this}function ListCache(e){var n=-1,a=e==null?0:e.length;for(this.clear();++nc))return!1;var u=s.get(e);if(u&&s.get(n))return u==n;var d=-1,f=!0,m=a&COMPARE_UNORDERED_FLAG?new SetCache:void 0;for(s.set(e,n),s.set(n,e);++d=n||C<0||f&&I>=s}function k(){var z=now();if(w(z))return x(z);c=setTimeout(k,y(z))}function x(z){return c=void 0,m&&r?h(z):(r=i=void 0,l)}function A(){c!==void 0&&clearTimeout(c),u=0,r=o=i=c=void 0}function R(){return c===void 0?l:x(now())}function D(){var z=now(),C=w(z);if(r=arguments,i=this,o=z,C){if(c===void 0)return b(o);if(f)return clearTimeout(c),c=setTimeout(k,n),h(o)}return c===void 0&&(c=setTimeout(k,n)),l}return D.cancel=A,D.flush=R,D}function baseMap(e,n){var a=-1,r=isArrayLike(e)?Array(e.length):[];return baseEach(e,function(i,s,l){r[++a]=n(i,s,l)}),r}var mapTag$3="[object Map]",setTag$3="[object Set]",objectProto$c=Object.prototype,hasOwnProperty$b=objectProto$c.hasOwnProperty;function isEmpty(e){if(e==null)return!0;if(isArrayLike(e)&&(isArray$2(e)||typeof e=="string"||typeof e.splice=="function"||isBuffer(e)||isTypedArray(e)||isArguments(e)))return!e.length;var n=getTag$1(e);if(n==mapTag$3||n==setTag$3)return!e.size;if(isPrototype(e))return!baseKeys(e).length;for(var a in e)if(hasOwnProperty$b.call(e,a))return!1;return!0}function baseSortBy(e,n){var a=e.length;for(e.sort(n);a--;)e[a]=e[a].value;return e}function compareAscending(e,n){if(e!==n){var a=e!==void 0,r=e===null,i=e===e,s=isSymbol(e),l=n!==void 0,c=n===null,o=n===n,u=isSymbol(n);if(!c&&!u&&!s&&e>n||s&&l&&o&&!c&&!u||r&&l&&o||!a&&o||!i)return 1;if(!r&&!s&&!u&&e=c)return o;var u=a[r];return o*(u=="desc"?-1:1)}}return e.index-n.index}function baseOrderBy(e,n,a){var r=-1;n=arrayMap(n.length?n:[identity$1],baseUnary(baseIteratee));var i=baseMap(e,function(s,l,c){var o=arrayMap(n,function(u){return u(s)});return{criteria:o,index:++r,value:s}});return baseSortBy(i,function(s,l){return compareMultiple(s,l,a)})}function orderBy(e,n,a,r){return e==null?[]:(isArray$2(n)||(n=n==null?[]:[n]),a=r?void 0:a,isArray$2(a)||(a=a==null?[]:[a]),baseOrderBy(e,n,a))}function formatArtistData(e){return{artistID:getPropertyWithFallback(e,"id"),artistName:getPropertyWithFallback(e,"name"),artistPictureXL:getPropertyWithFallback(e,"picture_xl"),artistReleases:formatArtistReleases(getPropertyWithFallback(e,"releases"))}}function formatArtistReleases(e){let n={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a];n[a]=[];for(const i of r)n[a].push({releaseID:getPropertyWithFallback(i,"id"),releaseCover:getPropertyWithFallback(i,"cover_small"),releaseTitle:getPropertyWithFallback(i,"title"),releaseDate:getPropertyWithFallback(i,"release_date"),releaseTracksNumber:getPropertyWithFallback(i,"nb_song"),releaseLink:getPropertyWithFallback(i,"link"),isReleaseExplicit:getPropertyWithFallback(i,"explicit_lyrics")})}return n}function standardizeData(e,n){if(e.hasLoaded){const{data:a}=e,r=[];for(const i of a){let s=n(i);r.push(s)}return{data:r,hasLoaded:e.hasLoaded}}else return null}var script$c={setup(){const e=reactive({currentTab:"",sortKey:"releaseDate",sortOrder:"desc",artistReleases:{},artistID:"",artistName:"",artistPicture:""}),n=computed(()=>e.artistReleases[e.currentTab]),a=s=>{const{data:[{artistID:l,artistName:c,artistPictureXL:o,artistReleases:u}]}=standardizeData({data:[s],hasLoaded:!0},formatArtistData);Object.assign(e,{artistID:l,artistName:c,artistPicture:o,artistReleases:u}),e.currentTab=Object.keys(u)[0]},r=()=>{e.currentTab="",e.sortKey="releaseDate",e.sortOrder="desc"};onDeactivated(r),onMounted(()=>{socket.on("show_artist",a)});const i=computed(()=>{if(Object.keys(e.artistReleases).length!==0){let s=e.sortKey;return s=="releaseTracksNumber"&&(s=l=>new Number(l.releaseTracksNumber)),orderBy(n.value,s,e.sortOrder)}return[]});return{...toRefs(e),downloadLink:computed(()=>`https://www.deezer.com/artist/${e.artistID}`),headerStyle:computed(()=>({backgroundImage:`linear-gradient(to bottom, transparent 0%, var(--main-background) 100%), url(${e.artistPicture})`})),showTable:i,sendAddToQueue,currentRelease:n}},data(){const e=this.$t.bind(this),n=this.$tc.bind(this);return{head:[{title:n("globals.listTabs.title",1),sortKey:"releaseTitle"},{title:e("globals.listTabs.releaseDate"),sortKey:"releaseDate"},{title:n("globals.listTabs.track",2),sortKey:"releaseTracksNumber"},{title:"",width:"32px"}]}},methods:{sortBy(e){e===this.sortKey?this.sortOrder=this.sortOrder==="asc"?"desc":"asc":(this.sortKey=e,this.sortOrder="asc")},changeTab(e){this.currentTab=e},checkNewRelease(e){let n=new Date,a=new Date(e);return a.setDate(a.getDate()+3),n.setHours(0,0,0,0),n.getTime()<=a.getTime()}}};const __vue_script__$c=script$c;var __vue_render__$e=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("div",{staticClass:"relative image-header"},[a("header",{staticClass:"flex items-center",style:e.headerStyle},[a("h1",{staticClass:"m-0"},[e._v(e._s(e.artistName))]),e._v(" "),a("div",{staticClass:"grid w-16 h-16 ml-auto rounded-full cursor-pointer bg-primary text-grayscale-870 place-items-center",attrs:{"aria-label":"download",role:"button"},on:{click:function(r){return r.stopPropagation(),e.sendAddToQueue(e.downloadLink)}}},[a("i",{staticClass:"text-4xl material-icons",attrs:{title:e.$t("globals.download_hint")}},[e._v("get_app")])])]),e._v(" "),a("ul",{staticClass:"my-8 section-tabs"},e._l(e.artistReleases,function(r,i){return a("li",{key:i,staticClass:"section-tabs__tab",class:{active:e.currentTab===i},on:{click:function(s){return e.changeTab(i)}}},[e._v(` + Now you can see the Client ID. If you click on "Show Client Secret" the client secret will be revealed.`),a("br"),e._v(" "),a("img",{attrs:{src:"https://i.imgur.com/foEfIhO.png",alt:"Screen of client ID and Secret"}})])},function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("p",{staticClass:"mb-2 text-base"},[e._v("You can get your Spotify Username from the "),a("a",{attrs:{href:"https://www.spotify.com/it/account/overview/",target:"_blank"}},[e._v("Overview page on Spotify's Website")]),e._v(".")])}];const __vue_inject_styles__$d=void 0,__vue_scope_id__$d=void 0,__vue_is_functional_template__$d=!1;function __vue_normalize__$d(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};return o.__file="InfoSpotifyFeatures.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var InfoSpotifyFeatures=__vue_normalize__$d({render:__vue_render__$d,staticRenderFns:__vue_staticRenderFns__$d},__vue_inject_styles__$d,__vue_script__$b,__vue_scope_id__$d,__vue_is_functional_template__$d),freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto=Object.prototype,hasOwnProperty$2=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(e){var n=hasOwnProperty$2.call(e,symToStringTag),a=e[symToStringTag];try{e[symToStringTag]=void 0;var r=!0}catch(s){}var i=nativeObjectToString.call(e);return r&&(n?e[symToStringTag]=a:delete e[symToStringTag]),i}var objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString;function objectToString(e){return nativeObjectToString$1.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(e){return e==null?e===void 0?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return e!=null&&typeof e=="object"}var symbolTag="[object Symbol]";function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==symbolTag}function arrayMap(e,n){for(var a=-1,r=e==null?0:e.length,i=Array(r);++a-1&&e%1==0)&&e-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction$2(e)}var objectProto$3=Object.prototype;function isPrototype(e){var n=e&&e.constructor,a=typeof n=="function"&&n.prototype||objectProto$3;return e===a}function baseTimes(e,n){for(var a=-1,r=Array(e);++a-1}function listCacheSet(e,n){var a=this.__data__,r=assocIndexOf(a,e);return r<0?(++this.size,a.push([e,n])):a[r][1]=n,this}function ListCache(e){var n=-1,a=e==null?0:e.length;for(this.clear();++nc))return!1;var u=s.get(e);if(u&&s.get(n))return u==n;var d=-1,f=!0,m=a&COMPARE_UNORDERED_FLAG?new SetCache:void 0;for(s.set(e,n),s.set(n,e);++d=n||C<0||f&&I>=s}function k(){var z=now();if(w(z))return x(z);c=setTimeout(k,y(z))}function x(z){return c=void 0,m&&r?h(z):(r=i=void 0,l)}function A(){c!==void 0&&clearTimeout(c),u=0,r=o=i=c=void 0}function R(){return c===void 0?l:x(now())}function D(){var z=now(),C=w(z);if(r=arguments,i=this,o=z,C){if(c===void 0)return b(o);if(f)return clearTimeout(c),c=setTimeout(k,n),h(o)}return c===void 0&&(c=setTimeout(k,n)),l}return D.cancel=A,D.flush=R,D}function baseMap(e,n){var a=-1,r=isArrayLike(e)?Array(e.length):[];return baseEach(e,function(i,s,l){r[++a]=n(i,s,l)}),r}var mapTag$3="[object Map]",setTag$3="[object Set]",objectProto$c=Object.prototype,hasOwnProperty$b=objectProto$c.hasOwnProperty;function isEmpty(e){if(e==null)return!0;if(isArrayLike(e)&&(isArray$2(e)||typeof e=="string"||typeof e.splice=="function"||isBuffer(e)||isTypedArray(e)||isArguments(e)))return!e.length;var n=getTag$1(e);if(n==mapTag$3||n==setTag$3)return!e.size;if(isPrototype(e))return!baseKeys(e).length;for(var a in e)if(hasOwnProperty$b.call(e,a))return!1;return!0}function baseSortBy(e,n){var a=e.length;for(e.sort(n);a--;)e[a]=e[a].value;return e}function compareAscending(e,n){if(e!==n){var a=e!==void 0,r=e===null,i=e===e,s=isSymbol(e),l=n!==void 0,c=n===null,o=n===n,u=isSymbol(n);if(!c&&!u&&!s&&e>n||s&&l&&o&&!c&&!u||r&&l&&o||!a&&o||!i)return 1;if(!r&&!s&&!u&&e=c)return o;var u=a[r];return o*(u=="desc"?-1:1)}}return e.index-n.index}function baseOrderBy(e,n,a){var r=-1;n=arrayMap(n.length?n:[identity$1],baseUnary(baseIteratee));var i=baseMap(e,function(s,l,c){var o=arrayMap(n,function(u){return u(s)});return{criteria:o,index:++r,value:s}});return baseSortBy(i,function(s,l){return compareMultiple(s,l,a)})}function orderBy(e,n,a,r){return e==null?[]:(isArray$2(n)||(n=n==null?[]:[n]),a=r?void 0:a,isArray$2(a)||(a=a==null?[]:[a]),baseOrderBy(e,n,a))}function checkNewRelease(e){let n=new Date;return n.setHours(0,0,0,0),e=new Date(e),e.setDate(e.getDate()+3),n.getTime()<=e.getTime()}function formatArtistData(e){return{artistName:getPropertyWithFallback(e,"name"),artistPictureXL:getPropertyWithFallback(e,"picture_xl"),artistReleases:formatArtistReleases(getPropertyWithFallback(e,"releases"))}}function formatArtistReleases(e){let n={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a];n[a]=[];for(const i of r)n[a].push({releaseID:getPropertyWithFallback(i,"id"),releaseCover:getPropertyWithFallback(i,"cover_small"),releaseTitle:getPropertyWithFallback(i,"title"),releaseDate:getPropertyWithFallback(i,"release_date"),releaseTracksNumber:getPropertyWithFallback(i,"nb_song"),releaseLink:getPropertyWithFallback(i,"link"),isReleaseExplicit:getPropertyWithFallback(i,"explicit_lyrics")})}return n}function getArtistData(e){return socket.emit("getTracklist",{type:"artist",id:e}),new Promise((n,a)=>{socket.on("show_artist",r=>{socket.off("show_artist"),n(r)})})}function standardizeData(e,n){if(e.hasLoaded){const{data:a}=e,r=[];for(const i of a){let s=n(i);r.push(s)}return{data:r,hasLoaded:e.hasLoaded}}else return null}var script$c=defineComponent({setup(e,n){const a=reactive({currentTab:"",sortKey:"releaseDate",sortOrder:"desc",artistReleases:{},artistName:"",artistPicture:"",currentRelease:computed(()=>a.artistReleases[a.currentTab])}),r=computed(()=>n.root.$router.currentRoute.params.id),i=ref$2(!1);getArtistData(unref(r)).then(c=>{i.value=!0;const{data:[{artistName:o,artistPictureXL:u,artistReleases:d}]}=standardizeData({data:[c],hasLoaded:unref(i)},formatArtistData);Object.assign(a,{artistName:o,artistPicture:u,artistReleases:d,currentTab:Object.keys(d)[0]})}).catch(c=>console.error(c));const s=computed(()=>{if(!unref(i))return[];let c=a.sortKey;return c==="releaseTracksNumber"&&(c=o=>new Number(o.releaseTracksNumber)),orderBy(a.currentRelease,c,a.sortOrder)}),l=c=>{a.currentTab=c};return{...toRefs(a),downloadLink:computed(()=>`https://www.deezer.com/artist/${unref(r)}`),headerStyle:computed(()=>({backgroundImage:`linear-gradient(to bottom, transparent 0%, var(--main-background) 100%), url(${a.artistPicture})`})),sortedData:s,sendAddToQueue,checkNewRelease,changeTab:l}},data(){const e=this.$t.bind(this),n=this.$tc.bind(this);return{head:[{title:n("globals.listTabs.title",1),sortKey:"releaseTitle"},{title:e("globals.listTabs.releaseDate"),sortKey:"releaseDate"},{title:n("globals.listTabs.track",2),sortKey:"releaseTracksNumber"},{title:"",width:"32px"}]}},methods:{sortBy(e){e===this.sortKey?this.sortOrder=this.sortOrder==="asc"?"desc":"asc":(this.sortKey=e,this.sortOrder="asc")}}});const __vue_script__$c=script$c;var __vue_render__$e=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("div",{staticClass:"relative image-header"},[a("header",{staticClass:"flex items-center",style:e.headerStyle},[a("h1",{staticClass:"m-0"},[e._v(e._s(e.artistName))]),e._v(" "),a("div",{staticClass:"grid w-16 h-16 ml-auto rounded-full cursor-pointer bg-primary text-grayscale-870 place-items-center",attrs:{"aria-label":"download",role:"button"},on:{click:function(r){return r.stopPropagation(),e.sendAddToQueue(e.downloadLink)}}},[a("i",{staticClass:"text-4xl material-icons",attrs:{title:e.$t("globals.download_hint")}},[e._v("get_app")])])]),e._v(" "),a("ul",{staticClass:"my-8 section-tabs"},e._l(e.artistReleases,function(r,i){return a("li",{key:i,staticClass:"section-tabs__tab uppercase-first-letter",class:{active:e.currentTab===i},on:{click:function(s){return e.changeTab(i)}}},[e._v(` `+e._s(e.$tc("globals.listTabs."+i,2))+` - `)])}),0),e._v(" "),a("table",{staticClass:"table"},[a("thead",[a("tr",e._l(e.head,function(r){return a("th",{key:r.title,class:{"sort-asc":r.sortKey==e.sortKey&&e.sortOrder=="asc","sort-desc":r.sortKey==e.sortKey&&e.sortOrder=="desc",sortable:r.sortKey,clickable:r.sortKey},style:{width:r.width?r.width:"auto"},on:{click:function(i){r.sortKey&&e.sortBy(r.sortKey)}}},[e._v(` + `)])}),0),e._v(" "),a("table",{staticClass:"table"},[a("thead",[a("tr",e._l(e.head,function(r){return a("th",{key:r.title,staticClass:"uppercase-first-letter",class:{"sort-asc":r.sortKey==e.sortKey&&e.sortOrder=="asc","sort-desc":r.sortKey==e.sortKey&&e.sortOrder=="desc",sortable:r.sortKey,clickable:r.sortKey},style:{width:r.width?r.width:"auto"},on:{click:function(i){r.sortKey&&e.sortBy(r.sortKey)}}},[e._v(` `+e._s(r.title)+` - `)])}),0)]),e._v(" "),a("tbody",e._l(e.showTable,function(r){return a("tr",[a("router-link",{staticClass:"flex items-center clickable",attrs:{tag:"td",to:{name:"Album",params:{id:r.releaseID}}}},[a("img",{staticClass:"rounded coverart",staticStyle:{"margin-right":"16px",width:"56px",height:"56px"},attrs:{src:r.releaseCover}}),e._v(" "),r.isReleaseExplicit?a("i",{staticClass:"material-icons explicit-icon"},[e._v("explicit")]):e._e(),e._v(` + `)])}),0)]),e._v(" "),a("tbody",e._l(e.sortedData,function(r){return a("tr",{key:r.releaseID},[a("RouterLink",{staticClass:"flex items-center clickable",attrs:{tag:"td",to:{name:"Album",params:{id:r.releaseID}}}},[a("img",{staticClass:"rounded coverart",staticStyle:{"margin-right":"16px",width:"56px",height:"56px"},attrs:{src:r.releaseCover}}),e._v(" "),r.isReleaseExplicit?a("i",{staticClass:"material-icons title-icon title-icon--explicit"},[e._v("explicit")]):e._e(),e._v(` `+e._s(r.releaseTitle)+` - `),e.checkNewRelease(r.releaseDate)?a("i",{staticClass:"material-icons",staticStyle:{color:"#ff7300"}},[e._v("fiber_new")]):e._e()]),e._v(" "),a("td",[e._v(e._s(r.releaseDate))]),e._v(" "),a("td",[e._v(e._s(r.releaseTracksNumber))]),e._v(" "),a("td",{staticClass:"clickable",on:{click:function(i){return i.stopPropagation(),e.sendAddToQueue(r.releaseLink)}}},[a("i",{staticClass:"material-icons",attrs:{title:e.$t("globals.download_hint")}},[e._v(" file_download ")])])],1)}),0)])])},__vue_staticRenderFns__$e=[];const __vue_inject_styles__$e=void 0,__vue_scope_id__$e=void 0,__vue_is_functional_template__$e=!1;function __vue_normalize__$e(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};return o.__file="Artist.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var Artist=__vue_normalize__$e({render:__vue_render__$e,staticRenderFns:__vue_staticRenderFns__$e},__vue_inject_styles__$e,__vue_script__$c,__vue_scope_id__$e,__vue_is_functional_template__$e);let chartsData={},cached$1=!1;function getChartsData(){return cached$1?chartsData:(socket.emit("get_charts_data"),new Promise((e,n)=>{socket.on("init_charts",a=>{chartsData=a,cached$1=!0,socket.off("init_charts"),e(a)})}))}var script$d={methods:{previewMouseEnter(e){EventBus.$emit("trackPreview:previewMouseEnter",e)},previewMouseLeave(e){EventBus.$emit("trackPreview:previewMouseLeave",e)}}};const __vue_script__$d=script$d;var __vue_render__$f=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("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.checkNewRelease(r.releaseDate)?a("i",{staticClass:"material-icons title-icon title-icon--new title-icon--right"},[e._v(` + fiber_new + `)]):e._e()]),e._v(" "),a("td",{staticClass:"text-center"},[e._v(e._s(r.releaseDate))]),e._v(" "),a("td",{staticClass:"text-center"},[e._v(e._s(r.releaseTracksNumber))]),e._v(" "),a("td",{staticClass:"clickable",on:{click:function(i){return i.stopPropagation(),e.sendAddToQueue(r.releaseLink)}}},[a("i",{staticClass:"material-icons",attrs:{title:e.$t("globals.download_hint")}},[e._v(" file_download ")])])],1)}),0)])])},__vue_staticRenderFns__$e=[];const __vue_inject_styles__$e=void 0,__vue_scope_id__$e=void 0,__vue_is_functional_template__$e=!1;function __vue_normalize__$e(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};return o.__file="Artist.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var Artist=__vue_normalize__$e({render:__vue_render__$e,staticRenderFns:__vue_staticRenderFns__$e},__vue_inject_styles__$e,__vue_script__$c,__vue_scope_id__$e,__vue_is_functional_template__$e);let chartsData={},cached$1=!1;function getChartsData(){return cached$1?chartsData:(socket.emit("get_charts_data"),new Promise((e,n)=>{socket.on("init_charts",a=>{chartsData=a,cached$1=!0,socket.off("init_charts"),e(a)})}))}var script$d={methods:{previewMouseEnter(e){EventBus.$emit("trackPreview:previewMouseEnter",e)},previewMouseLeave(e){EventBus.$emit("trackPreview:previewMouseLeave",e)}}};const __vue_script__$d=script$d;var __vue_render__$f=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("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__$f=[];const __vue_inject_styles__$f=void 0,__vue_scope_id__$f=void 0,__vue_is_functional_template__$f=!1;function __vue_normalize__$f(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};return o.__file="PreviewControls.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var PreviewControls=__vue_normalize__$f({render:__vue_render__$f,staticRenderFns:__vue_staticRenderFns__$f},__vue_inject_styles__$f,__vue_script__$d,__vue_scope_id__$f,__vue_is_functional_template__$f),script$e={components:{PreviewControls},data(){return{country:"",id:0,countries:[],chart:[]}},computed:{worldwideRelease(){let e=this.countries.filter(n=>n.title==="Worldwide");return e[0]}},async created(){socket.on("setChartTracks",this.setTracklist),this.$on("hook:destroyed",()=>{socket.off("setChartTracks")});let e=await getChartsData(),n;e=e.filter(a=>(a.title==="Worldwide"&&(n=a),a.title!=="Worldwide")),e.unshift(n),this.initCharts(e)},methods:{convertDuration,playPausePreview(e){EventBus.$emit("trackPreview:playPausePreview",e)},addToQueue(e){e.stopPropagation(),sendAddToQueue(e.currentTarget.dataset.link)},getTrackList(e){document.getElementById("content").scrollTo(0,0);const{currentTarget:{dataset:{title:n}},currentTarget:{dataset:{id:a}}}=e;this.country=n,localStorage.setItem("chart",this.country),this.id=a,socket.emit("getChartTracks",this.id)},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 n=0;for(;n{n.type=="track"&&(n.selected=e.currentTarget.checked)})},selectedLinks(){var e=[];return this.body&&this.body.forEach(n=>{n.type=="track"&&n.selected&&e.push(this.type=="spotifyPlaylist"?n.uri:n.link)}),e.join(";")},convertDuration:Utils.convertDuration,showAlbum(e){this.reset();const{id:n,title:a,explicit_lyrics:r,label:i,artist:{name:s},tracks:l,tracks:{length:c},release_date:o,cover_xl:u}=e;this.type="album",this.link=`https://www.deezer.com/album/${n}`,this.title=a,this.explicit=r,this.label=i,this.metadata=`${s} \u2022 ${this.$tc("globals.listTabs.trackN",c)}`,this.release_date=o.substring(0,10),this.image=u,isEmpty(l)?this.body=null:this.body=l},showPlaylist(e){this.reset();const{id:n,title:a,picture_xl:r,creation_date:i,creator:{name:s},tracks:l,tracks:{length:c}}=e;this.type="playlist",this.link=`https://www.deezer.com/playlist/${n}`,this.title=a,this.image=r,this.release_date=i.substring(0,10),this.metadata=`${this.$t("globals.by",{artist:s})} \u2022 ${this.$tc("globals.listTabs.trackN",c)}`,isEmpty(l)?this.body=null:this.body=l},showSpotifyPlaylist(e){this.reset();const{uri:n,name:a,images:r,images:{length:i},owner:{display_name:s},tracks:l,tracks:{length:c}}=e;this.type="spotifyPlaylist",this.link=n,this.title=a,this.image=i?r[0].url:"https://e-cdns-images.dzcdn.net/images/cover/d41d8cd98f00b204e9800998ecf8427e/1000x1000-000000-80-0-0.jpg",this.release_date="",this.metadata=`${this.$t("globals.by",{artist:s})} \u2022 ${this.$tc("globals.listTabs.trackN",c)}`,isEmpty(l)?this.body=null:this.body=l},selectRow(e,n){n.selected=!n.selected}}};const __vue_script__$t=script$t;var __vue_render__$v=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("div",{ref:"root",staticClass:"relative fixed-footer bg-background-main image-header"},[a("header",{style:{"background-image":"linear-gradient(to bottom, transparent 0%, var(--main-background) 100%), url('"+e.image+"')"}},[a("h1",{staticClass:"flex items-center m-0 text-5xl"},[e._v(` - `+e._s(e.title)+" "),e.explicit?a("i",{staticClass:"material-icons explicit-icon explicit-icon--right"},[e._v("explicit")]):e._e()]),e._v(" "),a("h2",{staticClass:"m-0 mb-3 text-lg"},[e.metadata?a("p",[e._v(e._s(e.metadata))]):e._e(),e._v(" "),e.release_date?a("p",[e._v(e._s(e.release_date))]):e._e()])]),e._v(" "),a("table",{staticClass:"table table--tracklist"},[a("thead",[a("tr",[e._m(0),e._v(" "),a("th",[e._v("#")]),e._v(" "),a("th",[e._v(e._s(e.$tc("globals.listTabs.title",1)))]),e._v(" "),a("th",[e._v(e._s(e.$tc("globals.listTabs.artist",1)))]),e._v(" "),e.type==="playlist"?a("th",[e._v(e._s(e.$tc("globals.listTabs.album",1)))]):e._e(),e._v(" "),e._m(1),e._v(" "),a("th",{staticClass:"table__icon table__cell--center clickable"},[a("input",{staticClass:"selectAll",attrs:{type:"checkbox"},on:{click:e.toggleAll}})])])]),e._v(" "),a("tbody",[e.type!=="spotifyPlaylist"?[e._l(e.body,function(r,i){return[r.type=="track"?a("tr",{on:{click:function(s){return e.selectRow(i,r)}}},[a("td",{staticClass:"table__cell--x-small table__cell--center"},[a("div",{staticClass:"table__cell-content table__cell-content--vertical-center"},[a("i",e._g({staticClass:"material-icons",class:{preview_playlist_controls:r.preview,"cursor-pointer":r.preview,disabled:!r.preview},attrs:{"data-preview":r.preview,title:e.$t("globals.play_hint")}},{click:r.preview?e.playPausePreview:!1}),[e._v(` + `+e._s(e.title)+" "),e.explicit?a("i",{staticClass:"material-icons title-icon title-icon--right"},[e._v("explicit")]):e._e()]),e._v(" "),a("h2",{staticClass:"m-0 mb-3 text-lg"},[e.metadata?a("p",[e._v(e._s(e.metadata))]):e._e(),e._v(" "),e.release_date?a("p",[e._v(e._s(e.release_date))]):e._e()])]),e._v(" "),a("table",{staticClass:"table table--tracklist"},[a("thead",[a("tr",[e._m(0),e._v(" "),a("th",[e._v("#")]),e._v(" "),a("th",[e._v(e._s(e.$tc("globals.listTabs.title",1)))]),e._v(" "),a("th",[e._v(e._s(e.$tc("globals.listTabs.artist",1)))]),e._v(" "),e.type==="playlist"?a("th",[e._v(e._s(e.$tc("globals.listTabs.album",1)))]):e._e(),e._v(" "),e._m(1),e._v(" "),a("th",{staticClass:"table__icon table__cell--center clickable"},[a("input",{staticClass:"selectAll",attrs:{type:"checkbox"},on:{click:e.toggleAll}})])])]),e._v(" "),a("tbody",[e.type!=="spotifyPlaylist"?[e._l(e.body,function(r,i){return[r.type=="track"?a("tr",{on:{click:function(s){return e.selectRow(i,r)}}},[a("td",{staticClass:"table__cell--x-small table__cell--center"},[a("div",{staticClass:"table__cell-content table__cell-content--vertical-center"},[a("i",e._g({staticClass:"material-icons",class:{preview_playlist_controls:r.preview,"cursor-pointer":r.preview,disabled:!r.preview},attrs:{"data-preview":r.preview,title:e.$t("globals.play_hint")}},{click:r.preview?e.playPausePreview:!1}),[e._v(` play_arrow `)])])]),e._v(" "),a("td",{staticClass:"table__cell--small table__cell--center track_position"},[e._v(` `+e._s(e.type==="album"?r.track_position:e.body.indexOf(r)+1)+` - `)]),e._v(" "),a("td",{staticClass:"table__cell--large table__cell--with-icon"},[a("div",{staticClass:"table__cell-content table__cell-content--vertical-center"},[r.explicit_lyrics?a("i",{staticClass:"material-icons explicit-icon"},[e._v(" explicit ")]):e._e(),e._v(` + `)]),e._v(" "),a("td",{staticClass:"table__cell--large table__cell--with-icon"},[a("div",{staticClass:"table__cell-content table__cell-content--vertical-center"},[r.explicit_lyrics?a("i",{staticClass:"material-icons title-icon"},[e._v(" explicit ")]):e._e(),e._v(` `+e._s(r.title+(r.title_version&&r.title.indexOf(r.title_version)==-1?" "+r.title_version:""))+` `)])]),e._v(" "),a("router-link",{staticClass:"table__cell--medium table__cell--center clickable",attrs:{tag:"td",to:{name:"Artist",params:{id:r.artist.id}}}},[e._v(` `+e._s(r.artist.name)+` @@ -4588,9 +4597,9 @@ PERFORMANCE OF THIS SOFTWARE. `+e._s(r.number)+` `)]),e._v(" "),a("td",{attrs:{colspan:"4"}})]):e._e()]})]:e._l(e.body,function(r,i){return a("tr",[a("td",[r.preview_url?a("i",{staticClass:"material-icons",class:{preview_playlist_controls:r.preview_url,"cursor-pointer":r.preview_url},attrs:{"data-preview":r.preview_url,title:e.$t("globals.play_hint")},on:{click:e.playPausePreview}},[e._v(` play_arrow - `)]):a("i",{staticClass:"material-icons disabled"},[e._v("play_arrow")])]),e._v(" "),a("td",[e._v(e._s(i+1))]),e._v(" "),a("td",{staticClass:"flex items-center"},[r.explicit?a("i",{staticClass:"material-icons explicit-icon"},[e._v("explicit")]):e._e(),e._v(` + `)]):a("i",{staticClass:"material-icons disabled"},[e._v("play_arrow")])]),e._v(" "),a("td",[e._v(e._s(i+1))]),e._v(" "),a("td",{staticClass:"flex items-center"},[r.explicit?a("i",{staticClass:"material-icons title-icon"},[e._v("explicit")]):e._e(),e._v(` `+e._s(r.name)+` `)]),e._v(" "),a("td",[e._v(e._s(r.artists[0].name))]),e._v(" "),a("td",[e._v(e._s(r.album.name))]),e._v(" "),a("td",[e._v(e._s(e.convertDuration(Math.floor(r.duration_ms/1e3))))]),e._v(" "),a("td",[a("input",{directives:[{name:"model",rawName:"v-model",value:r.selected,expression:"track.selected"}],staticClass:"clickable",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(r.selected)?e._i(r.selected,null)>-1:r.selected},on:{change:function(s){var l=r.selected,c=s.target,o=!!c.checked;if(Array.isArray(l)){var u=null,d=e._i(l,u);c.checked?d<0&&e.$set(r,"selected",l.concat([u])):d>-1&&e.$set(r,"selected",l.slice(0,d).concat(l.slice(d+1)))}else e.$set(r,"selected",o)}}})])])})],2)]),e._v(" "),e.label?a("span",{staticStyle:{opacity:"0.4","margin-top":"8px",display:"inline-block","font-size":"13px"}},[e._v(e._s(e.label))]):e._e(),e._v(" "),a("footer",{staticClass:"bg-background-main"},[a("button",{staticClass:"mr-2 btn btn-primary",attrs:{"data-link":e.link},on:{click:function(r){return r.stopPropagation(),e.addToQueue(r)}}},[e._v(` `+e._s(""+e.$t("globals.download",{thing:e.$tc("globals.listTabs."+e.type,1)}))+` `)]),e._v(" "),a("button",{staticClass:"flex items-center btn btn-primary",attrs:{"data-link":e.selectedLinks()},on:{click:function(r){return r.stopPropagation(),e.addToQueue(r)}}},[e._v(` - `+e._s(e.$t("tracklist.downloadSelection"))),a("i",{staticClass:"ml-2 material-icons"},[e._v("file_download")])])])])},__vue_staticRenderFns__$v=[function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("th",[a("i",{staticClass:"material-icons"},[e._v("music_note")])])},function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("th",[a("i",{staticClass:"material-icons"},[e._v("timer")])])},function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("td",[a("div",{staticClass:"table__cell-content table__cell-content--vertical-center",staticStyle:{opacity:"0.54"}},[a("i",{staticClass:"material-icons"},[e._v("album")])])])}];const __vue_inject_styles__$v=void 0,__vue_scope_id__$v=void 0,__vue_is_functional_template__$v=!1;function __vue_normalize__$v(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};return o.__file="Tracklist.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var Tracklist=__vue_normalize__$v({render:__vue_render__$v,staticRenderFns:__vue_staticRenderFns__$v},__vue_inject_styles__$v,__vue_script__$t,__vue_scope_id__$v,__vue_is_functional_template__$v);Vue.use(VueRouter);const routes=[{path:"/",name:"Home",component:Home,meta:{notKeepAlive:!0}},{path:"/tracklist/:type/:id",name:"Tracklist",component:Tracklist},{path:"/artist/:id",name:"Artist",component:Artist},{path:"/album/:id",name:"Album",component:Tracklist},{path:"/playlist/:id",name:"Playlist",component:Tracklist},{path:"/spotify-playlist/:id",name:"Spotify Playlist",component:Tracklist},{path:"/charts",name:"Charts",component:Charts,meta:{notKeepAlive:!0}},{path:"/favorites",name:"Favorites",component:Favorites,meta:{notKeepAlive:!0}},{path:"/errors",name:"Errors",component:Errors},{path:"/link-analyzer",name:"Link Analyzer",component:LinkAnalyzer},{path:"/about",name:"About",component:About},{path:"/info-arl",name:"ARL",component:InfoArl},{path:"/info-spotify",name:"Spotify Features",component:InfoSpotifyFeatures},{path:"/settings",name:"Settings",component:Settings},{path:"/search",name:"Search",component:Search},{path:"*",component:Home}],router=new VueRouter({mode:"history",routes,scrollBehavior(e,n,a){return{x:0,y:0}}});router.beforeEach((e,n,a)=>{let r=null;switch(e.name){case"Artist":r={type:"artist",id:e.params.id};break;case"Tracklist":r={type:e.params.type,id:e.params.id};break;case"Album":r={type:"album",id:e.params.id};break;case"Playlist":r={type:"playlist",id:e.params.id};break;case"Spotify Playlist":r={type:"spotifyplaylist",id:e.params.id};break}r&&socket.emit("getTracklist",r),a()});function startApp(){new Vue({store,router,i18n,render:e=>e(App)}).$mount("#app")}function initClient(){store.dispatch("setClientMode",!0),setClientModeKeyBindings()}document.addEventListener("DOMContentLoaded",startApp),window.addEventListener("pywebviewready",initClient),document.addEventListener("paste",e=>{if(e.target.localName==="input")return;let n=e.clipboardData.getData("Text");if(isValidURL(n))router.currentRoute.name==="Link Analyzer"?socket.emit("analyzeLink",n):sendAddToQueue(n);else{let a=document.querySelector("#searchbar");a.select(),a.setSelectionRange(0,99999)}});function setClientModeKeyBindings(){document.addEventListener("keyup",e=>{e.altKey&&e.key==="ArrowLeft"&&router.back(),e.altKey&&e.key==="ArrowRight"&&router.forward()})}socket.on("message",function(e){console.log(e)}),socket.on("logging_in",function(){toast(i18n.t("toasts.loggingIn"),"loading",!1,"login-toast")}),socket.on("init_autologin",function(){let e=localStorage.getItem("arl"),n=localStorage.getItem("accountNum");e&&(e=e.trim(),n!=0?socket.emit("login",e,!0,n):socket.emit("login",e))}),socket.on("logged_in",function(e){const{status:n,user:a}=e;switch(n){case 1:case 3:toast(i18n.t("toasts.loggedIn"),"done",!0,"login-toast"),store.dispatch("login",e);break;case 2:toast(i18n.t("toasts.alreadyLogged"),"done",!0,"login-toast"),store.dispatch("setUser",a);break;case 0:toast(i18n.t("toasts.loginFailed"),"close",!0,"login-toast"),store.dispatch("removeARL");break;case-1:toast(i18n.t("toasts.deezerNotAvailable"),"close",!0,"login-toast");return}}),socket.on("logged_out",function(){toast(i18n.t("toasts.loggedOut"),"done",!0,"login-toast"),store.dispatch("logout")}),socket.on("restoringQueue",function(){toast(i18n.t("toasts.restoringQueue"),"loading",!1,"restoring_queue")}),socket.on("cancellingCurrentItem",function(e){toast(i18n.t("toasts.cancellingCurrentItem"),"loading",!1,"cancelling_"+e)}),socket.on("currentItemCancelled",function(e){toast(i18n.t("toasts.currentItemCancelled"),"done",!0,"cancelling_"+e)}),socket.on("startAddingArtist",function(e){toast(i18n.t("toasts.startAddingArtist",{artist:e.name}),"loading",!1,"artist_"+e.id)}),socket.on("finishAddingArtist",function(e){toast(i18n.t("toasts.finishAddingArtist",{artist:e.name}),"done",!0,"artist_"+e.id)}),socket.on("startConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.startConvertingSpotifyPlaylist"),"loading",!1,"spotifyplaylist_"+e)}),socket.on("finishConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.finishConvertingSpotifyPlaylist"),"done",!0,"spotifyplaylist_"+e)}),socket.on("errorMessage",function(e){toast(e,"error")}),socket.on("queueError",function(e){e.errid?toast(e.link+" - "+i18n.t(`errors.ids.${e.errid}`),"error"):toast(e.link+" - "+e.error,"error")}),socket.on("alreadyInQueue",function(e){toast(i18n.t("toasts.alreadyInQueue",{item:e.title}),"playlist_add_check")}),socket.on("loginNeededToDownload",function(e){toast(i18n.t("toasts.loginNeededToDownload"),"report")}),socket.on("startGeneratingItems",function(e){toast(i18n.t("toasts.startGeneratingItems",{n:e.total}),"loading",!1,"batch_"+e.uuid)}),socket.on("finishGeneratingItems",function(e){toast(i18n.t("toasts.finishGeneratingItems",{n:e.total}),"done",!0,"batch_"+e.uuid)}); + `+e._s(e.$t("tracklist.downloadSelection"))),a("i",{staticClass:"ml-2 material-icons"},[e._v("file_download")])])])])},__vue_staticRenderFns__$v=[function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("th",[a("i",{staticClass:"material-icons"},[e._v("music_note")])])},function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("th",[a("i",{staticClass:"material-icons"},[e._v("timer")])])},function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("td",[a("div",{staticClass:"table__cell-content table__cell-content--vertical-center",staticStyle:{opacity:"0.54"}},[a("i",{staticClass:"material-icons"},[e._v("album")])])])}];const __vue_inject_styles__$v=void 0,__vue_scope_id__$v=void 0,__vue_is_functional_template__$v=!1;function __vue_normalize__$v(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};return o.__file="Tracklist.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var Tracklist=__vue_normalize__$v({render:__vue_render__$v,staticRenderFns:__vue_staticRenderFns__$v},__vue_inject_styles__$v,__vue_script__$t,__vue_scope_id__$v,__vue_is_functional_template__$v);Vue.use(VueRouter);const routes=[{path:"/",name:"Home",component:Home,meta:{notKeepAlive:!0}},{path:"/tracklist/:type/:id",name:"Tracklist",component:Tracklist},{path:"/artist/:id",name:"Artist",component:Artist,meta:{notKeepAlive:!0}},{path:"/album/:id",name:"Album",component:Tracklist},{path:"/playlist/:id",name:"Playlist",component:Tracklist},{path:"/spotify-playlist/:id",name:"Spotify Playlist",component:Tracklist},{path:"/charts",name:"Charts",component:Charts,meta:{notKeepAlive:!0}},{path:"/favorites",name:"Favorites",component:Favorites,meta:{notKeepAlive:!0}},{path:"/errors",name:"Errors",component:Errors},{path:"/link-analyzer",name:"Link Analyzer",component:LinkAnalyzer},{path:"/about",name:"About",component:About},{path:"/info-arl",name:"ARL",component:InfoArl},{path:"/info-spotify",name:"Spotify Features",component:InfoSpotifyFeatures},{path:"/settings",name:"Settings",component:Settings},{path:"/search",name:"Search",component:Search},{path:"*",component:Home}],router=new VueRouter({mode:"history",routes,scrollBehavior(e,n,a){return{x:0,y:0}}});router.beforeEach((e,n,a)=>{let r=null;switch(e.name){case"Tracklist":r={type:e.params.type,id:e.params.id};break;case"Album":r={type:"album",id:e.params.id};break;case"Playlist":r={type:"playlist",id:e.params.id};break;case"Spotify Playlist":r={type:"spotifyplaylist",id:e.params.id};break}r&&socket.emit("getTracklist",r),a()});function startApp(){new Vue({store,router,i18n,render:e=>e(App)}).$mount("#app")}function initClient(){store.dispatch("setClientMode",!0),setClientModeKeyBindings()}document.addEventListener("DOMContentLoaded",startApp),window.addEventListener("pywebviewready",initClient),document.addEventListener("paste",e=>{if(e.target.localName==="input")return;let n=e.clipboardData.getData("Text");if(isValidURL(n))router.currentRoute.name==="Link Analyzer"?socket.emit("analyzeLink",n):sendAddToQueue(n);else{let a=document.querySelector("#searchbar");a.select(),a.setSelectionRange(0,99999)}});function setClientModeKeyBindings(){document.addEventListener("keyup",e=>{e.altKey&&e.key==="ArrowLeft"&&router.back(),e.altKey&&e.key==="ArrowRight"&&router.forward()})}socket.on("message",function(e){console.log(e)}),socket.on("logging_in",function(){toast(i18n.t("toasts.loggingIn"),"loading",!1,"login-toast")}),socket.on("init_autologin",function(){let e=localStorage.getItem("arl"),n=localStorage.getItem("accountNum");e&&(e=e.trim(),n!=0?socket.emit("login",e,!0,n):socket.emit("login",e))}),socket.on("logged_in",function(e){const{status:n,user:a}=e;switch(n){case 1:case 3:toast(i18n.t("toasts.loggedIn"),"done",!0,"login-toast"),store.dispatch("login",e);break;case 2:toast(i18n.t("toasts.alreadyLogged"),"done",!0,"login-toast"),store.dispatch("setUser",a);break;case 0:toast(i18n.t("toasts.loginFailed"),"close",!0,"login-toast"),store.dispatch("removeARL");break;case-1:toast(i18n.t("toasts.deezerNotAvailable"),"close",!0,"login-toast");return}}),socket.on("logged_out",function(){toast(i18n.t("toasts.loggedOut"),"done",!0,"login-toast"),store.dispatch("logout")}),socket.on("restoringQueue",function(){toast(i18n.t("toasts.restoringQueue"),"loading",!1,"restoring_queue")}),socket.on("cancellingCurrentItem",function(e){toast(i18n.t("toasts.cancellingCurrentItem"),"loading",!1,"cancelling_"+e)}),socket.on("currentItemCancelled",function(e){toast(i18n.t("toasts.currentItemCancelled"),"done",!0,"cancelling_"+e)}),socket.on("startAddingArtist",function(e){toast(i18n.t("toasts.startAddingArtist",{artist:e.name}),"loading",!1,"artist_"+e.id)}),socket.on("finishAddingArtist",function(e){toast(i18n.t("toasts.finishAddingArtist",{artist:e.name}),"done",!0,"artist_"+e.id)}),socket.on("startConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.startConvertingSpotifyPlaylist"),"loading",!1,"spotifyplaylist_"+e)}),socket.on("finishConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.finishConvertingSpotifyPlaylist"),"done",!0,"spotifyplaylist_"+e)}),socket.on("errorMessage",function(e){toast(e,"error")}),socket.on("queueError",function(e){e.errid?toast(e.link+" - "+i18n.t(`errors.ids.${e.errid}`),"error"):toast(e.link+" - "+e.error,"error")}),socket.on("alreadyInQueue",function(e){toast(i18n.t("toasts.alreadyInQueue",{item:e.title}),"playlist_add_check")}),socket.on("loginNeededToDownload",function(e){toast(i18n.t("toasts.loginNeededToDownload"),"report")}),socket.on("startGeneratingItems",function(e){toast(i18n.t("toasts.startGeneratingItems",{n:e.total}),"loading",!1,"batch_"+e.uuid)}),socket.on("finishGeneratingItems",function(e){toast(i18n.t("toasts.finishGeneratingItems",{n:e.total}),"done",!0,"batch_"+e.uuid)}); diff --git a/src/components/pages/Artist.vue b/src/components/pages/Artist.vue index 2d77b07..490d848 100644 --- a/src/components/pages/Artist.vue +++ b/src/components/pages/Artist.vue @@ -17,7 +17,7 @@
  • @@ -33,6 +33,7 @@ :key="data.title" @click="data.sortKey ? sortBy(data.sortKey) : null" :style="{ width: data.width ? data.width : 'auto' }" + class="uppercase-first-letter" :class="{ 'sort-asc': data.sortKey == sortKey && sortOrder == 'asc', 'sort-desc': data.sortKey == sortKey && sortOrder == 'desc', @@ -46,8 +47,8 @@ - - + - explicit + explicit {{ release.releaseTitle }} - fiber_new - - {{ release.releaseDate }} - {{ release.releaseTracksNumber }} + + fiber_new + + + {{ release.releaseDate }} + {{ release.releaseTracksNumber }} file_download @@ -73,80 +79,75 @@ diff --git a/src/components/pages/Tracklist.vue b/src/components/pages/Tracklist.vue index d6468ae..d7012d4 100644 --- a/src/components/pages/Tracklist.vue +++ b/src/components/pages/Tracklist.vue @@ -7,7 +7,7 @@ }" >

    - {{ title }} explicit + {{ title }} explicit

    @@ -60,7 +60,7 @@
    - explicit + explicit {{ track.title + (track.title_version && track.title.indexOf(track.title_version) == -1 @@ -127,7 +127,7 @@ {{ i + 1 }} - explicit + explicit {{ track.name }} {{ track.artists[0].name }} diff --git a/src/components/search/ResultsAlbums.vue b/src/components/search/ResultsAlbums.vue index 5b55913..27b6343 100644 --- a/src/components/search/ResultsAlbums.vue +++ b/src/components/search/ResultsAlbums.vue @@ -20,7 +20,7 @@ explicit diff --git a/src/components/search/ResultsTracks.vue b/src/components/search/ResultsTracks.vue index 968b569..1e4bd3a 100644 --- a/src/components/search/ResultsTracks.vue +++ b/src/components/search/ResultsTracks.vue @@ -36,7 +36,7 @@
    - explicit + explicit {{ formatTitle(track) }}
    diff --git a/src/data/artist.js b/src/data/artist.js index c099f63..37bbffb 100644 --- a/src/data/artist.js +++ b/src/data/artist.js @@ -1,8 +1,8 @@ +import { socket } from '@/utils/socket' import { getPropertyWithFallback } from '@/utils/utils' export function formatArtistData(artistData) { return { - artistID: getPropertyWithFallback(artistData, 'id'), artistName: getPropertyWithFallback(artistData, 'name'), artistPictureXL: getPropertyWithFallback(artistData, 'picture_xl'), artistReleases: formatArtistReleases(getPropertyWithFallback(artistData, 'releases')) @@ -33,3 +33,27 @@ function formatArtistReleases(artistReleases) { return formattedReleases } + +let artistData = {} +let cached = false + +export function getArtistData(artistID) { + if (cached) { + return artistData + } else { + socket.emit('getTracklist', { + type: 'artist', + id: artistID + }) + + return new Promise((resolve, reject) => { + socket.on('show_artist', data => { + artistData = data + // cached = true + + socket.off('show_artist') + resolve(data) + }) + }) + } +} diff --git a/src/router.js b/src/router.js index a05fbaa..e7e5473 100644 --- a/src/router.js +++ b/src/router.js @@ -35,7 +35,10 @@ const routes = [ { path: '/artist/:id', name: 'Artist', - component: Artist + component: Artist, + meta: { + notKeepAlive: true + } }, { path: '/album/:id', @@ -123,12 +126,6 @@ router.beforeEach((to, from, next) => { let getTracklistParams = null switch (to.name) { - case 'Artist': - getTracklistParams = { - type: 'artist', - id: to.params.id - } - break case 'Tracklist': getTracklistParams = { type: to.params.type, diff --git a/src/styles/vendor/material-icons.css b/src/styles/vendor/material-icons.css index 0b8e50b..c089d6f 100644 --- a/src/styles/vendor/material-icons.css +++ b/src/styles/vendor/material-icons.css @@ -26,15 +26,22 @@ -webkit-font-smoothing: antialiased; } -.material-icons.explicit-icon { +.material-icons.title-icon { margin-right: 0.3125em; margin-left: -3px; +} + +.material-icons.title-icon.title-icon--right { + margin-right: 0px; + margin-left: 0.3125em; +} + +.material-icons.title-icon.title-icon--explicit { color: hsl(240, 5%, 59%); } -.material-icons.explicit-icon.explicit-icon--right { - margin-right: 0px; - margin-left: 0.3125em; +.material-icons.title-icon.title-icon--new { + color: hsl(27, 100%, 50%); } .material-icons.disabled { diff --git a/src/utils/dates.js b/src/utils/dates.js new file mode 100644 index 0000000..c1a235f --- /dev/null +++ b/src/utils/dates.js @@ -0,0 +1,14 @@ +/** + * @param {Date} dateToCheck + * @returns {boolean} The passed date is less than 3 days distant from today, + * therefore it's considered a new release, if referring to a track or album + */ +export function checkNewRelease(dateToCheck) { + let now = new Date() + now.setHours(0, 0, 0, 0) + + dateToCheck = new Date(dateToCheck) + dateToCheck.setDate(dateToCheck.getDate() + 3) + + return now.getTime() <= dateToCheck.getTime() +}