From 152891f6cd5c3c54a8cb7d34c32344dd9adfcba9 Mon Sep 17 00:00:00 2001 From: Alain Nussbaumer Date: Sat, 23 Mar 2024 01:53:25 +0100 Subject: [PATCH] [web] Lint source code --- web-src/src/components/ListTracks.vue | 10 ++-- web-src/src/lib/SVGRenderer.js | 16 +++--- web-src/src/pages/PagePodcasts.vue | 2 +- web-src/src/store/index.js | 71 ++++++++++----------------- 4 files changed, 38 insertions(+), 61 deletions(-) diff --git a/web-src/src/components/ListTracks.vue b/web-src/src/components/ListTracks.vue index bdcb4d45..14431c12 100644 --- a/web-src/src/components/ListTracks.vue +++ b/web-src/src/components/ListTracks.vue @@ -78,6 +78,11 @@ export default { }, methods: { + open_dialog(track) { + this.selected_track = track + this.show_details_modal = true + }, + play_track(track) { if (this.uris) { webapi.player_play_uri( @@ -94,11 +99,6 @@ export default { } else { webapi.player_play_uri(track.uri, false) } - }, - - open_dialog(track) { - this.selected_track = track - this.show_details_modal = true } } } diff --git a/web-src/src/lib/SVGRenderer.js b/web-src/src/lib/SVGRenderer.js index b019393e..56bd3f54 100644 --- a/web-src/src/lib/SVGRenderer.js +++ b/web-src/src/lib/SVGRenderer.js @@ -6,16 +6,12 @@ const toColor = (string) => { return (hash & 0x00ffffff).toString(16) } -const luminance = (color) => { - return ( - [0.2126, 0.7152, 0.0722].reduce( - (luminance, factor, index) => - luminance + - Number('0x' + color.slice(index * 2, index * 2 + 2)) * factor, - 0 - ) / 255 - ) -} +const luminance = (color) => + [0.2126, 0.7152, 0.0722].reduce( + (luminance, factor, index) => + luminance + Number(`0x${color.slice(index * 2, index * 2 + 2)}`) * factor, + 0 + ) / 255 export const renderSVG = (data) => { const color = toColor(data.alternate), diff --git a/web-src/src/pages/PagePodcasts.vue b/web-src/src/pages/PagePodcasts.vue index 9361079e..9e540411 100644 --- a/web-src/src/pages/PagePodcasts.vue +++ b/web-src/src/pages/PagePodcasts.vue @@ -83,8 +83,8 @@ export default { name: 'PagePodcasts', components: { ContentWithHeading, - ListTracks, ListAlbums, + ListTracks, ModalDialogAddRss }, diff --git a/web-src/src/store/index.js b/web-src/src/store/index.js index a483d028..18c7bf0d 100644 --- a/web-src/src/store/index.js +++ b/web-src/src/store/index.js @@ -70,51 +70,32 @@ export default createStore({ }, getters: { - now_playing: (state) => { - return state.queue.items.find((e) => e.id === state.player.item_id) ?? {} - }, - settings_option_recently_added_limit: (state, getters) => { - return ( - getters.settings_webinterface?.options.find( - (option) => option.name === 'recently_added_limit' - )?.value ?? 100 - ) - }, - settings_option: (state) => (categoryName, optionName) => { - return ( - state.settings.categories - .find((category) => category.name === categoryName) - ?.options.find((option) => option.name === optionName) ?? {} - ) - }, - settings_option_show_composer_for_genre: (state, getters) => { - return ( - getters.settings_webinterface?.options.find( - (option) => option.name === 'show_composer_for_genre' - )?.value ?? null - ) - }, - settings_option_show_composer_now_playing: (state, getters) => { - return ( - getters.settings_webinterface?.options.find( - (option) => option.name === 'show_composer_now_playing' - )?.value ?? false - ) - }, - settings_option_show_filepath_now_playing: (state, getters) => { - return ( - getters.settings_webinterface?.options.find( - (option) => option.name === 'show_filepath_now_playing' - )?.value ?? false - ) - }, - settings_webinterface: (state) => { - return ( - state.settings?.categories.find( - (category) => category.name === 'webinterface' - ) ?? null - ) - } + now_playing: (state) => + state.queue.items.find((e) => e.id === state.player.item_id) ?? {}, + settings_option_recently_added_limit: (state, getters) => + getters.settings_webinterface?.options.find( + (option) => option.name === 'recently_added_limit' + )?.value ?? 100, + settings_option: (state) => (categoryName, optionName) => + state.settings.categories + .find((category) => category.name === categoryName) + ?.options.find((option) => option.name === optionName) ?? {}, + settings_option_show_composer_for_genre: (state, getters) => + getters.settings_webinterface?.options.find( + (option) => option.name === 'show_composer_for_genre' + )?.value ?? null, + settings_option_show_composer_now_playing: (state, getters) => + getters.settings_webinterface?.options.find( + (option) => option.name === 'show_composer_now_playing' + )?.value ?? false, + settings_option_show_filepath_now_playing: (state, getters) => + getters.settings_webinterface?.options.find( + (option) => option.name === 'show_filepath_now_playing' + )?.value ?? false, + settings_webinterface: (state) => + state.settings?.categories.find( + (category) => category.name === 'webinterface' + ) ?? null }, mutations: {