2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
2022-02-19 06:18:01 +01:00
|
|
|
<div class="fd-page-with-tabs">
|
2022-02-19 06:39:14 +01:00
|
|
|
<tabs-music />
|
2018-08-11 07:47:10 +02:00
|
|
|
<content-with-heading>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2022-05-29 18:49:00 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.browse.recently-added.title')" />
|
|
|
|
<p class="heading" v-text="$t('page.browse.recently-added.albums')" />
|
2020-12-01 12:07:48 +00:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-02-19 07:47:54 +01:00
|
|
|
<list-albums :albums="recently_added" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
|
|
|
import TabsMusic from '@/components/TabsMusic.vue'
|
|
|
|
import ListAlbums from '@/components/ListAlbums.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
2020-12-01 16:50:58 +00:00
|
|
|
import store from '@/store'
|
2022-02-19 07:47:54 +01:00
|
|
|
import { byDateSinceToday, GroupByList } from '@/lib/GroupByList'
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2018-08-11 07:47:10 +02:00
|
|
|
load: function (to) {
|
2021-01-10 11:36:31 +01:00
|
|
|
const limit = store.getters.settings_option_recently_added_limit
|
|
|
|
return webapi.search({
|
|
|
|
type: 'album',
|
2022-02-19 06:39:14 +01:00
|
|
|
expression:
|
|
|
|
'media_kind is music having track_count > 3 order by time_added desc',
|
2021-01-10 11:36:31 +01:00
|
|
|
limit: limit
|
|
|
|
})
|
2018-08-11 07:47:10 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
2022-02-19 07:47:54 +01:00
|
|
|
vm.recently_added = new GroupByList(response.data.albums)
|
|
|
|
vm.recently_added.group(
|
|
|
|
byDateSinceToday('time_added', {
|
|
|
|
direction: 'desc',
|
|
|
|
defaultValue: '0000'
|
|
|
|
})
|
|
|
|
)
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageBrowseType',
|
2021-01-10 11:36:31 +01:00
|
|
|
components: { ContentWithHeading, TabsMusic, ListAlbums },
|
2020-12-01 16:50:13 +00:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
next((vm) => dataObject.set(vm, response))
|
|
|
|
})
|
|
|
|
},
|
2022-02-19 07:47:54 +01:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
beforeRouteUpdate(to, from, next) {
|
2022-02-19 07:47:54 +01:00
|
|
|
if (!this.recently_added.isEmpty()) {
|
|
|
|
next()
|
|
|
|
return
|
|
|
|
}
|
2022-02-19 06:39:14 +01:00
|
|
|
const vm = this
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
dataObject.set(vm, response)
|
|
|
|
next()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return {
|
2022-02-19 07:47:54 +01:00
|
|
|
recently_added: new GroupByList()
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|