Resolve "Hide favorites radios when user does not have any favorites"

This commit is contained in:
Ciarán Ainsworth 2019-06-24 13:30:56 +02:00 committed by Eliot Berriot
parent 69d10461d6
commit 3da6192ab3
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
3 changed files with 14 additions and 4 deletions

View File

@ -0,0 +1 @@
Favorites radio will not be visible if the user does not have any favorites (#419)

View File

@ -16,7 +16,7 @@
1 favorite
</translate>
</h2>
<radio-button type="favorites"></radio-button>
<radio-button v-if="hasFavorites" type="favorites"></radio-button>
</section>
<section class="ui vertical stripe segment">
<div :class="['ui', {'loading': isLoading}, 'form']">
@ -115,7 +115,10 @@ export default {
return {
title: this.$pgettext('Head/Favorites/Title', 'Your Favorites')
}
}
},
hasFavorites () {
return this.$store.state.favorites.count > 0
},
},
methods: {
updateQueryString: function() {

View File

@ -10,7 +10,7 @@
<translate translate-context="Content/Radio/Title">Instance radios</translate>
</h3>
<div class="ui cards">
<radio-card v-if="$store.state.auth.authenticated" :type="'favorites'"></radio-card>
<radio-card v-if="isAuthenticated && hasFavorites" :type="'favorites'"></radio-card>
<radio-card :type="'random'"></radio-card>
<radio-card v-if="$store.state.auth.authenticated" :type="'less-listened'"></radio-card>
</div>
@ -144,7 +144,13 @@ export default {
searchPlaceholder,
title
}
}
},
isAuthenticated () {
return this.$store.state.auth.authenticated
},
hasFavorites () {
return this.$store.state.favorites.count > 0
},
},
methods: {
updateQueryString: _.debounce(function() {