owntone-server/web-src/src/pages/PageMusicRecentlyAdded.vue
ejurgensen 8a177ed48d Revert "Merge branch 'master' of github.com:owntone/owntone-server"
This reverts commit bb2a778b46afca0fcd56bda6f02857fad78b14d8, reversing
changes made to f8e2298b677476f46eb67cc4331c18124f92a791.
2025-01-23 09:31:51 +01:00

67 lines
1.5 KiB
Vue

<template>
<div class="fd-page-with-tabs">
<tabs-music />
<content-with-heading>
<template #heading-left>
<p class="title is-4" v-text="$t('page.music.recently-added.title')" />
</template>
<template #content>
<list-albums :items="albums" />
</template>
</content-with-heading>
</div>
</template>
<script>
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import { GroupedList } from '@/lib/GroupedList'
import ListAlbums from '@/components/ListAlbums.vue'
import TabsMusic from '@/components/TabsMusic.vue'
import { useSettingsStore } from '@/stores/settings'
import webapi from '@/webapi'
const dataObject = {
load(to) {
const limit = useSettingsStore().recently_added_limit
return webapi.search({
expression:
'media_kind is music having track_count > 3 order by time_added desc',
limit,
type: 'album'
})
},
set(vm, response) {
vm.albums = new GroupedList(response.data.albums, {
criteria: [{ field: 'time_added', order: -1, type: Date }],
index: { field: 'time_added', type: Date }
})
}
}
export default {
name: 'PageMusicRecentlyAdded',
components: { ContentWithHeading, ListAlbums, TabsMusic },
beforeRouteEnter(to, from, next) {
dataObject.load(to).then((response) => {
next((vm) => dataObject.set(vm, response))
})
},
setup() {
return {
settingsStore: useSettingsStore()
}
},
data() {
return {
albums: new GroupedList()
}
}
}
</script>
<style></style>