Skip to content

Commit

Permalink
Only display the 'Clear All Selections' if there is at least 2 differ…
Browse files Browse the repository at this point in the history
…ent categories selected
  • Loading branch information
arteymix committed Sep 1, 2023
1 parent cb6186d commit 4c1868d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/SearchSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</v-btn>
</v-btn-toggle>
<div class="d-flex justify-end">
<v-btn v-if="searchSettings.annotations.length > 0 || searchSettings.platforms.length > 0 || searchSettings.taxon.length > 0 || searchSettings.technologyTypes.length > 0 || searchSettings.query !== undefined"
<v-btn v-if="showClearAllSelections"
@click="clearAllSelections"
right medium text color="primary"
class="mb-3">
Expand Down Expand Up @@ -118,6 +118,16 @@ export default {
return SUPPORTED_RESULT_TYPES.sort((a, b) => a.order - b.order);
},
/**
* Since individual search setting have their clear buttons, we only show the clear all if there is more than one.
*/
showClearAllSelections() {
return (this.searchSettings.annotations.length > 0)
+ (this.searchSettings.platforms.length > 0)
+ (this.searchSettings.taxon.length > 0)
+ (this.searchSettings.technologyTypes.length > 0)
+ (!!this.searchSettings.query) > 1;
},
...mapState({
debug: state => state.debug
})
Expand Down

0 comments on commit 4c1868d

Please sign in to comment.