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
|
|
|
<!-- Recently added -->
|
|
|
|
<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-added.title')" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2024-03-23 23:46:47 +01:00
|
|
|
<list-albums :items="recently_added" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #footer>
|
2018-08-11 07:47:10 +02:00
|
|
|
<nav class="level">
|
|
|
|
<p class="level-item">
|
2023-07-12 17:47:16 +02:00
|
|
|
<router-link
|
|
|
|
class="button is-light is-small is-rounded"
|
2023-11-21 15:25:27 +01:00
|
|
|
:to="{ name: 'music-recently-added' }"
|
2023-07-25 14:41:34 +02:00
|
|
|
>
|
2024-04-21 17:44:55 +02:00
|
|
|
{{ $t('page.music.show-more') }}
|
|
|
|
</router-link>
|
2018-08-11 07:47:10 +02:00
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
<!-- Recently played -->
|
|
|
|
<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-03-23 23:46:47 +01:00
|
|
|
<list-tracks :items="recently_played" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #footer>
|
2018-08-11 07:47:10 +02:00
|
|
|
<nav class="level">
|
|
|
|
<p class="level-item">
|
2023-07-12 17:47:16 +02:00
|
|
|
<router-link
|
|
|
|
class="button is-light is-small is-rounded"
|
2023-11-21 15:25:27 +01:00
|
|
|
:to="{ name: 'music-recently-played' }"
|
2023-07-25 14:41:34 +02:00
|
|
|
>
|
2024-04-21 17:44:55 +02:00
|
|
|
{{ $t('page.music.show-more') }}
|
|
|
|
</router-link>
|
2018-08-11 07:47:10 +02:00
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
</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 ListAlbums from '@/components/ListAlbums.vue'
|
|
|
|
import ListTracks from '@/components/ListTracks.vue'
|
2023-07-12 17:47:16 +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 Promise.all([
|
2022-02-19 06:39:14 +01:00
|
|
|
webapi.search({
|
|
|
|
expression:
|
|
|
|
'time_added after 8 weeks ago and media_kind is music having track_count > 3 order by time_added desc',
|
2024-03-23 23:46:47 +01:00
|
|
|
limit: 3,
|
|
|
|
type: 'album'
|
2022-02-19 06:39:14 +01:00
|
|
|
}),
|
|
|
|
webapi.search({
|
|
|
|
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: 3,
|
|
|
|
type: 'track'
|
2022-02-19 06:39:14 +01:00
|
|
|
})
|
2018-08-11 07:47:10 +02:00
|
|
|
])
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
set(vm, response) {
|
2024-02-22 19:32:11 +01:00
|
|
|
vm.recently_added = new GroupedList(response[0].data.albums)
|
|
|
|
vm.recently_played = new GroupedList(response[1].data.tracks)
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2023-11-21 15:25:27 +01:00
|
|
|
name: 'PageMusic',
|
2023-07-25 14:41:34 +02:00
|
|
|
components: { ContentWithHeading, ListAlbums, ListTracks, TabsMusic },
|
2018-08-11 07:47:10 +02: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
|
|
|
data() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return {
|
2022-02-19 07:47:54 +01:00
|
|
|
recently_added: [],
|
2020-10-17 12:09:01 +02:00
|
|
|
recently_played: { items: [] },
|
2023-12-09 10:51:57 +01:00
|
|
|
selected_track: {}
|
2020-08-23 19:26:54 +02:00
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|