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>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.browse.recently-added.title')" />
|
2022-05-29 18:49:00 +02:00
|
|
|
<p class="heading" v-text="$t('page.browse.albums')" />
|
2018-08-11 07:47:10 +02: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>
|
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">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
class="button is-light is-small is-rounded"
|
|
|
|
@click="open_browse('recently_added')"
|
|
|
|
v-text="$t('page.browse.show-more')"
|
|
|
|
/>
|
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>
|
2022-05-29 18:49:00 +02:00
|
|
|
<p
|
|
|
|
class="title is-4"
|
|
|
|
v-text="$t('page.browse.recently-played.title')"
|
|
|
|
/>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="heading" v-text="$t('page.browse.tracks')" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
|
|
|
<list-tracks :tracks="recently_played.items" />
|
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">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
class="button is-light is-small is-rounded"
|
|
|
|
@click="open_browse('recently_played')"
|
|
|
|
v-text="$t('page.browse.show-more')"
|
|
|
|
/>
|
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'
|
|
|
|
import TabsMusic from '@/components/TabsMusic.vue'
|
|
|
|
import ListAlbums from '@/components/ListAlbums.vue'
|
|
|
|
import ListTracks from '@/components/ListTracks.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
2022-02-19 07:47:54 +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 = {
|
2018-08-11 07:47:10 +02:00
|
|
|
load: function (to) {
|
|
|
|
return Promise.all([
|
2022-02-19 06:39:14 +01:00
|
|
|
webapi.search({
|
|
|
|
type: 'album',
|
|
|
|
expression:
|
|
|
|
'time_added after 8 weeks ago and media_kind is music having track_count > 3 order by time_added desc',
|
|
|
|
limit: 3
|
|
|
|
}),
|
|
|
|
webapi.search({
|
|
|
|
type: 'track',
|
|
|
|
expression:
|
|
|
|
'time_played after 8 weeks ago and media_kind is music order by time_played desc',
|
|
|
|
limit: 3
|
|
|
|
})
|
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[0].data.albums)
|
2018-08-11 07:47:10 +02:00
|
|
|
vm.recently_played = response[1].data.tracks
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageBrowse',
|
2020-10-04 17:31:47 +02:00
|
|
|
components: { ContentWithHeading, TabsMusic, ListAlbums, ListTracks },
|
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
|
|
|
beforeRouteUpdate(to, from, next) {
|
|
|
|
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: [],
|
2020-10-17 12:09:01 +02:00
|
|
|
recently_played: { items: [] },
|
2018-12-15 09:56:09 +01:00
|
|
|
|
|
|
|
show_track_details_modal: false,
|
2020-09-20 12:25:38 +02:00
|
|
|
selected_track: {}
|
2020-08-23 19:26:54 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-08-11 07:47:10 +02:00
|
|
|
methods: {
|
|
|
|
open_browse: function (type) {
|
|
|
|
this.$router.push({ path: '/music/browse/' + type })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|