From 3da6192ab3c809dc4ce88469c34b8e1694d8f311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20Ainsworth?= <ciaranainsworth@posteo.net> Date: Mon, 24 Jun 2019 13:30:56 +0200 Subject: [PATCH] Resolve "Hide favorites radios when user does not have any favorites" --- changes/changelog.d/419.enhancement | 1 + front/src/components/favorites/List.vue | 7 +++++-- front/src/components/library/Radios.vue | 10 ++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 changes/changelog.d/419.enhancement diff --git a/changes/changelog.d/419.enhancement b/changes/changelog.d/419.enhancement new file mode 100644 index 0000000000..f4716b53e5 --- /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 d1bde09353..6402d417f7 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 9b2f7bf820..9f59db514c 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() { -- GitLab