[web] Simplify variable naming

This commit is contained in:
Alain Nussbaumer 2024-04-27 21:14:31 +02:00
parent 7edce91474
commit 2c58351bec
2 changed files with 11 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<content-with-heading v-if="new_episodes.items.length > 0"> <content-with-heading v-if="tracks.items.length > 0">
<template #heading-left> <template #heading-left>
<p class="title is-4" v-text="$t('page.podcasts.new-episodes')" /> <p class="title is-4" v-text="$t('page.podcasts.new-episodes')" />
</template> </template>
@ -14,7 +14,7 @@
</template> </template>
<template #content> <template #content>
<list-tracks <list-tracks
:items="new_episodes" :items="tracks"
:show_progress="true" :show_progress="true"
@play-count-changed="reload_new_episodes" @play-count-changed="reload_new_episodes"
/> />
@ -75,7 +75,7 @@ const dataObject = {
set(vm, response) { set(vm, response) {
vm.albums = new GroupedList(response[0].data) vm.albums = new GroupedList(response[0].data)
vm.new_episodes = new GroupedList(response[1].data.tracks) vm.tracks = new GroupedList(response[1].data.tracks)
} }
} }
@ -97,8 +97,7 @@ export default {
data() { data() {
return { return {
albums: [], albums: [],
new_episodes: { items: [] }, tracks: { items: [] },
show_url_modal: false show_url_modal: false
} }
}, },
@ -111,10 +110,10 @@ export default {
methods: { methods: {
mark_all_played() { mark_all_played() {
this.new_episodes.items.forEach((ep) => { this.tracks.items.forEach((ep) => {
webapi.library_track_update(ep.id, { play_count: 'increment' }) webapi.library_track_update(ep.id, { play_count: 'increment' })
}) })
this.new_episodes.items = {} this.tracks.items = {}
}, },
open_add_podcast_dialog() { open_add_podcast_dialog() {
@ -123,7 +122,7 @@ export default {
reload_new_episodes() { reload_new_episodes() {
webapi.library_podcasts_new_episodes().then(({ data }) => { webapi.library_podcasts_new_episodes().then(({ data }) => {
this.new_episodes = new GroupedList(data.tracks) this.tracks = new GroupedList(data.tracks)
}) })
}, },

View File

@ -300,16 +300,15 @@ export const router = createRouter({
} }
], ],
scrollBehavior(to, from, savedPosition) { scrollBehavior(to, from, savedPosition) {
const wait_ms = 0 const delay = 0
if (savedPosition) { if (savedPosition) {
// Use the saved scroll position (browser back/forward navigation) // Use the saved scroll position (browser back/forward navigation)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { setTimeout(() => {
resolve(savedPosition) resolve(savedPosition)
}, wait_ms) }, delay)
}) })
} }
if (to.path === from.path && to.hash) { if (to.path === from.path && to.hash) {
/* /*
* Staying on the same page and jumping to an anchor (e. g. index nav) * Staying on the same page and jumping to an anchor (e. g. index nav)
@ -318,16 +317,14 @@ export const router = createRouter({
const top = to.meta.has_tabs ? TOP_WITH_TABS : TOP_WITHOUT_TABS const top = to.meta.has_tabs ? TOP_WITH_TABS : TOP_WITHOUT_TABS
return { behavior: 'smooth', el: to.hash, top } return { behavior: 'smooth', el: to.hash, top }
} }
if (to.hash) { if (to.hash) {
// We are navigating to an anchor of a new page, add a timeout to let the transition effect finish before scrolling // We are navigating to an anchor of a new page, add a timeout to let the transition effect finish before scrolling
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { setTimeout(() => {
resolve({ el: to.hash, top: 120 }) resolve({ el: to.hash, top: 120 })
}, wait_ms) }, delay)
}) })
} }
if (to.meta.has_index) { if (to.meta.has_index) {
/* /*
* Navigate to a page with index nav that should be hidden automatically * Navigate to a page with index nav that should be hidden automatically
@ -337,7 +334,7 @@ export const router = createRouter({
const top = to.meta.has_tabs ? TOP_WITH_TABS : TOP_WITHOUT_TABS const top = to.meta.has_tabs ? TOP_WITH_TABS : TOP_WITHOUT_TABS
setTimeout(() => { setTimeout(() => {
resolve({ el: '#top', top }) resolve({ el: '#top', top })
}, wait_ms) }, delay)
}) })
} }