From db0316963cea5a9922ad17c6f535fc6f8c4a2d08 Mon Sep 17 00:00:00 2001 From: vapormusic Date: Sun, 4 Sep 2022 13:00:55 +0000 Subject: [PATCH] chore: Prettified Code [ci skip] --- src/renderer/less/elements.less | 6 ++--- src/renderer/main/vueapp.js | 39 ++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/renderer/less/elements.less b/src/renderer/less/elements.less index b2c7377a..4c9cb482 100644 --- a/src/renderer/less/elements.less +++ b/src/renderer/less/elements.less @@ -334,9 +334,9 @@ width: 42px; height: 42px; flex: 0 0 auto; - &.circle{ + &.circle { border-radius: 50%; - .mediaitem-artwork{ + .mediaitem-artwork { border-radius: 50%; } img { @@ -406,7 +406,7 @@ } } -.search-hints .cd-queue-item{ +.search-hints .cd-queue-item { &:hover { background: var(--selected); border-radius: 6px; diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 76dffdd3..010c77ba 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -1903,17 +1903,20 @@ const app = new Vue({ this.search.hints = []; return; } - let hints = await (await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/search/suggestions?term=${this.search.term}`, - {"fields[albums]": "artwork,name,playParams,url,artistName,id", - "fields[artists]": "url,name,artwork,id", - "fields[songs]": "artwork,name,playParams,url,artistName,id", - "kinds": "terms,topResults", - "l": this.mklang, - "limit[results:terms]": 5, - "limit[results:topResults]": 5, - "omit[resource]": "autos", - "platform": "web", - "types": "activities,albums,artists,editorial-items,music-movies,playlists,record-labels,songs,stations"})).data.results; + let hints = await ( + await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/search/suggestions?term=${this.search.term}`, { + "fields[albums]": "artwork,name,playParams,url,artistName,id", + "fields[artists]": "url,name,artwork,id", + "fields[songs]": "artwork,name,playParams,url,artistName,id", + kinds: "terms,topResults", + l: this.mklang, + "limit[results:terms]": 5, + "limit[results:topResults]": 5, + "omit[resource]": "autos", + platform: "web", + types: "activities,albums,artists,editorial-items,music-movies,playlists,record-labels,songs,stations", + }) + ).data.results; this.search.hints = hints ? hints.suggestions : []; }, getSongProgress() { @@ -3900,20 +3903,20 @@ const app = new Vue({ if (e.keyCode == "40") { if (this.search.hints.length - 1 < this.search.cursor + 1) return; this.search.cursor++; - let item = this.search.hints[this.search.cursor] - this.search.term = item.content ? (item.content?.attributes?.name ?? "") :item.displayTerm; + let item = this.search.hints[this.search.cursor]; + this.search.term = item.content ? item.content?.attributes?.name ?? "" : item.displayTerm; } else if (e.keyCode == "38") { if (this.search.cursor == 0) return; this.search.cursor--; - let item = this.search.hints[this.search.cursor] - this.search.term = item.content ? (item.content?.attributes?.name ?? "") :item.displayTerm; + let item = this.search.hints[this.search.cursor]; + this.search.term = item.content ? item.content?.attributes?.name ?? "" : item.displayTerm; } }, async searchQuery(term = this.search.term) { let self = this; - if (typeof term === "object"){ - this.routeView(term) - this.search.term = "" + if (typeof term === "object") { + this.routeView(term); + this.search.term = ""; return; } if (term == "") {