Resolve "Placeholder on the homepage when there are no playlist"
This commit is contained in:
parent
d833fba747
commit
c8467faf8a
|
@ -0,0 +1 @@
|
||||||
|
Display placeholder on homepage when there are no playlists (#892)
|
|
@ -0,0 +1,18 @@
|
||||||
|
<template>
|
||||||
|
<div class="ui placeholder segment">
|
||||||
|
<div class="ui icon header">
|
||||||
|
<i class="pdf file outline icon"></i>
|
||||||
|
<translate translate-context="Content/Home/Placeholder">
|
||||||
|
No playlists have been created yet
|
||||||
|
</translate>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="$store.commit('playlists/chooseTrack', null)"
|
||||||
|
class="ui primary button"
|
||||||
|
>
|
||||||
|
<translate translate-context="Content/Home/CreatePlaylist">
|
||||||
|
Create Playlist
|
||||||
|
</translate>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -9,7 +9,12 @@
|
||||||
<div v-if="isLoading" class="ui inverted active dimmer">
|
<div v-if="isLoading" class="ui inverted active dimmer">
|
||||||
<div class="ui loader"></div>
|
<div class="ui loader"></div>
|
||||||
</div>
|
</div>
|
||||||
<playlist-card v-for="playlist in objects" :key="playlist.id" :playlist="playlist"></playlist-card>
|
<template v-if="playlistsExist">
|
||||||
|
<playlist-card v-for="playlist in objects" :key="playlist.id" :playlist="playlist"></playlist-card>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<placeholder-widget></placeholder-widget>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -17,6 +22,7 @@
|
||||||
import _ from '@/lodash'
|
import _ from '@/lodash'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import PlaylistCard from '@/components/playlists/Card'
|
import PlaylistCard from '@/components/playlists/Card'
|
||||||
|
import PlaceholderWidget from '@/components/playlists/PlaceholderWidget'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
@ -24,7 +30,8 @@ export default {
|
||||||
url: {type: String, required: true}
|
url: {type: String, required: true}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
PlaylistCard
|
PlaylistCard,
|
||||||
|
PlaceholderWidget
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -39,6 +46,11 @@ export default {
|
||||||
created () {
|
created () {
|
||||||
this.fetchData(this.url)
|
this.fetchData(this.url)
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
playlistsExist: function () {
|
||||||
|
return this.objects.length > 0
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchData (url) {
|
fetchData (url) {
|
||||||
if (!url) {
|
if (!url) {
|
||||||
|
|
Loading…
Reference in New Issue