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>
|
2023-11-21 15:25:27 +01:00
|
|
|
<p class="title is-4" v-text="$t('page.music.recently-played.title')" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2024-04-27 20:36:04 +02:00
|
|
|
<list-tracks :items="tracks" />
|
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'
|
2024-02-22 19:32:11 +01:00
|
|
|
import { GroupedList } from '@/lib/GroupedList'
|
2022-02-19 06:18:01 +01:00
|
|
|
import ListTracks from '@/components/ListTracks.vue'
|
2023-07-18 15:48:56 +02:00
|
|
|
import TabsMusic from '@/components/TabsMusic.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
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({
|
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',
|
2024-03-23 23:46:47 +01:00
|
|
|
limit: 50,
|
|
|
|
type: 'track'
|
2018-08-11 07:47:10 +02:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
set(vm, response) {
|
2024-04-27 20:36:04 +02:00
|
|
|
vm.tracks = new GroupedList(response.data.tracks)
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2023-11-21 15:25:27 +01:00
|
|
|
name: 'PageMusicRecentlyPlayed',
|
2024-02-28 13:58:04 +01:00
|
|
|
components: { ContentWithHeading, ListTracks, TabsMusic },
|
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
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2024-04-27 20:36:04 +02:00
|
|
|
tracks: {}
|
2022-02-19 06:39:14 +01:00
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|