[web] Lint source code

This commit is contained in:
Alain Nussbaumer 2024-03-23 01:53:25 +01:00
parent 9b12618b93
commit 152891f6cd
4 changed files with 38 additions and 61 deletions

View File

@ -78,6 +78,11 @@ export default {
}, },
methods: { methods: {
open_dialog(track) {
this.selected_track = track
this.show_details_modal = true
},
play_track(track) { play_track(track) {
if (this.uris) { if (this.uris) {
webapi.player_play_uri( webapi.player_play_uri(
@ -94,11 +99,6 @@ export default {
} else { } else {
webapi.player_play_uri(track.uri, false) webapi.player_play_uri(track.uri, false)
} }
},
open_dialog(track) {
this.selected_track = track
this.show_details_modal = true
} }
} }
} }

View File

@ -6,16 +6,12 @@ const toColor = (string) => {
return (hash & 0x00ffffff).toString(16) return (hash & 0x00ffffff).toString(16)
} }
const luminance = (color) => { const luminance = (color) =>
return ( [0.2126, 0.7152, 0.0722].reduce(
[0.2126, 0.7152, 0.0722].reduce( (luminance, factor, index) =>
(luminance, factor, index) => luminance + Number(`0x${color.slice(index * 2, index * 2 + 2)}`) * factor,
luminance + 0
Number('0x' + color.slice(index * 2, index * 2 + 2)) * factor, ) / 255
0
) / 255
)
}
export const renderSVG = (data) => { export const renderSVG = (data) => {
const color = toColor(data.alternate), const color = toColor(data.alternate),

View File

@ -83,8 +83,8 @@ export default {
name: 'PagePodcasts', name: 'PagePodcasts',
components: { components: {
ContentWithHeading, ContentWithHeading,
ListTracks,
ListAlbums, ListAlbums,
ListTracks,
ModalDialogAddRss ModalDialogAddRss
}, },

View File

@ -70,51 +70,32 @@ export default createStore({
}, },
getters: { getters: {
now_playing: (state) => { now_playing: (state) =>
return state.queue.items.find((e) => e.id === state.player.item_id) ?? {} state.queue.items.find((e) => e.id === state.player.item_id) ?? {},
}, settings_option_recently_added_limit: (state, getters) =>
settings_option_recently_added_limit: (state, getters) => { getters.settings_webinterface?.options.find(
return ( (option) => option.name === 'recently_added_limit'
getters.settings_webinterface?.options.find( )?.value ?? 100,
(option) => option.name === 'recently_added_limit' settings_option: (state) => (categoryName, optionName) =>
)?.value ?? 100 state.settings.categories
) .find((category) => category.name === categoryName)
}, ?.options.find((option) => option.name === optionName) ?? {},
settings_option: (state) => (categoryName, optionName) => { settings_option_show_composer_for_genre: (state, getters) =>
return ( getters.settings_webinterface?.options.find(
state.settings.categories (option) => option.name === 'show_composer_for_genre'
.find((category) => category.name === categoryName) )?.value ?? null,
?.options.find((option) => option.name === optionName) ?? {} settings_option_show_composer_now_playing: (state, getters) =>
) getters.settings_webinterface?.options.find(
}, (option) => option.name === 'show_composer_now_playing'
settings_option_show_composer_for_genre: (state, getters) => { )?.value ?? false,
return ( settings_option_show_filepath_now_playing: (state, getters) =>
getters.settings_webinterface?.options.find( getters.settings_webinterface?.options.find(
(option) => option.name === 'show_composer_for_genre' (option) => option.name === 'show_filepath_now_playing'
)?.value ?? null )?.value ?? false,
) settings_webinterface: (state) =>
}, state.settings?.categories.find(
settings_option_show_composer_now_playing: (state, getters) => { (category) => category.name === 'webinterface'
return ( ) ?? null
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
)
}
}, },
mutations: { mutations: {