diff --git a/changes/changelog.d/419.enhancement b/changes/changelog.d/419.enhancement new file mode 100644 index 0000000000000000000000000000000000000000..f4716b53e5e23ab6ab047ab033b2a6d02bf04c2b --- /dev/null +++ b/changes/changelog.d/419.enhancement @@ -0,0 +1 @@ +Favorites radio will not be visible if the user does not have any favorites (#419) \ No newline at end of file diff --git a/front/src/components/favorites/List.vue b/front/src/components/favorites/List.vue index d1bde0935341934af4988c64d1ec766d8da22c9b..6402d417f7120296ab8b13c2a70c109aad14aca2 100644 --- a/front/src/components/favorites/List.vue +++ b/front/src/components/favorites/List.vue @@ -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() { diff --git a/front/src/components/library/Radios.vue b/front/src/components/library/Radios.vue index 9b2f7bf82010bc1eed389ca072468a5c51c62ff0..9f59db514ccb2bab0b0d9860d1cee72eb6facab5 100644 --- a/front/src/components/library/Radios.vue +++ b/front/src/components/library/Radios.vue @@ -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() {