[web] Fix shadowed variables

This commit is contained in:
Alain Nussbaumer 2024-04-26 21:48:07 +02:00
parent 8a303f340b
commit 7826b36634
4 changed files with 9 additions and 15 deletions

View File

@ -28,7 +28,6 @@ export default [
'no-negated-condition': 'off', 'no-negated-condition': 'off',
'no-nested-ternary': 'off', 'no-nested-ternary': 'off',
'no-plusplus': 'off', 'no-plusplus': 'off',
'no-shadow': 'off',
'no-ternary': 'off', 'no-ternary': 'off',
'no-undef': 'off', 'no-undef': 'off',
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'none' }], 'no-unused-vars': ['error', { args: 'none', caughtErrors: 'none' }],

View File

@ -122,10 +122,10 @@ export default {
open_remove_podcast_dialog() { open_remove_podcast_dialog() {
webapi webapi
.library_album_tracks(this.selected_item.id, { limit: 1 }) .library_album_tracks(this.selected_item.id, { limit: 1 })
.then(({ data }) => { .then(({ data: album }) => {
webapi.library_track_playlists(data.items[0].id).then(({ data }) => { webapi.library_track_playlists(album.items[0].id).then(({ data }) => {
;[this.rss_playlist_to_remove] = data.items.filter( ;[this.rss_playlist_to_remove] = data.items.filter(
(pl) => pl.type === 'rss' (playlist) => playlist.type === 'rss'
) )
this.show_remove_podcast_modal = true this.show_remove_podcast_modal = true
this.show_details_modal = false this.show_details_modal = false

View File

@ -68,18 +68,13 @@ export default {
}) })
// Split the verses into words // Split the verses into words
parsed.forEach((verse, index, lyrics) => { parsed.forEach((verse, index, lyrics) => {
const duration = const unitDuration =
index < lyrics.length - 1 ? lyrics[index + 1].time - verse.time : 3 (lyrics[index + 1].time - verse.time || 3) / verse.text.length
const unitDuration = duration / verse.text.length
let delay = 0 let delay = 0
verse.words = verse.text.match(/\S+\s*/gu).map((text) => { verse.words = verse.text.match(/\S+\s*/gu).map((text) => {
const duration = text.length * unitDuration const duration = text.length * unitDuration
delay += duration delay += duration
return { return { duration, delay, text }
duration,
delay,
text
}
}) })
}) })
} }

View File

@ -80,7 +80,6 @@ export class GroupedList {
} }
group({ criteria = [], filters = [], index } = {}) { group({ criteria = [], filters = [], index } = {}) {
const indexer = createIndexer(index)
const itemsFiltered = this.items.filter((item) => const itemsFiltered = this.items.filter((item) =>
filters.every((filter) => filter(item)) filters.every((filter) => filter(item))
) )
@ -94,9 +93,10 @@ export class GroupedList {
) )
) )
// Group item list // Group item list
const indexer = createIndexer(index)
this.itemsGrouped = itemsSorted.reduce((map, item) => { this.itemsGrouped = itemsSorted.reduce((map, item) => {
const index = indexer(item) const key = indexer(item)
map.set(index, [...(map.get(index) || []), item]) map.set(key, [...(map.get(key) || []), item])
return map return map
}, new Map()) }, new Map())
// Create index list // Create index list