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"
|
2022-06-04 15:43:58 +02:00
|
|
|
v-text="$t('page.browse.recently-played.title')"
|
2022-05-29 18:49:00 +02:00
|
|
|
/>
|
2022-06-04 15:43:58 +02:00
|
|
|
<p class="heading" v-text="$t('page.browse.recently-played.tracks')" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2023-03-23 23:19:55 +01:00
|
|
|
<list-tracks :tracks="recently_played" />
|
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 ListTracks from '@/components/ListTracks.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
2023-03-23 23:19:55 +01:00
|
|
|
import { GroupByList } from '@/lib/GroupByList'
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2023-06-07 21:25:54 +02:00
|
|
|
load(to) {
|
2018-08-11 07:47:10 +02:00
|
|
|
return webapi.search({
|
|
|
|
type: 'track',
|
2022-02-19 06:39:14 +01:00
|
|
|
expression:
|
|
|
|
'time_played after 8 weeks ago and media_kind is music order by time_played desc',
|
2018-08-11 07:47:10 +02:00
|
|
|
limit: 50
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
set(vm, response) {
|
2023-03-23 23:19:55 +01:00
|
|
|
vm.recently_played = new GroupByList(response.data.tracks)
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageBrowseType',
|
2020-10-04 17:31:47 +02:00
|
|
|
components: { ContentWithHeading, TabsMusic, ListTracks },
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
beforeRouteEnter(to, from, next) {
|
2022-02-19 06:18:01 +01:00
|
|
|
dataObject.load(to).then((response) => {
|
2022-02-19 06:39:14 +01:00
|
|
|
next((vm) => dataObject.set(vm, response))
|
2022-02-19 06:18:01 +01:00
|
|
|
})
|
|
|
|
},
|
2022-02-19 06:39:14 +01:00
|
|
|
beforeRouteUpdate(to, from, next) {
|
2022-02-19 06:18:01 +01:00
|
|
|
const vm = this
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
dataObject.set(vm, response)
|
|
|
|
next()
|
|
|
|
})
|
2022-02-19 06:39:14 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
recently_played: {}
|
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|