diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2020-01-09 10:04:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-09 10:04:18 +0300 |
commit | 2c597575965348e304831becfb6873950041cf60 (patch) | |
tree | a41aaf5cf1d9f48f6b3e2b63ba42ff993a93b3af | |
parent | e18e6be05ef5390663bd4bdd1347a4cde1bd1d78 (diff) | |
parent | d59a06c57950245c5c24a0a4538316aed248e3af (diff) |
Merge pull request #2698 from nextcloud/bugfix/noid/combine-empty-sources
Bugfix/noid/combine empty sources
-rw-r--r-- | src/components/Hint.vue | 1 | ||||
-rw-r--r-- | src/components/LeftSidebar/ConversationsList/ConversationsList.vue | 2 | ||||
-rw-r--r-- | src/components/LeftSidebar/LeftSidebar.vue | 87 |
3 files changed, 67 insertions, 23 deletions
diff --git a/src/components/Hint.vue b/src/components/Hint.vue index b543c64ae..84e1fcbae 100644 --- a/src/components/Hint.vue +++ b/src/components/Hint.vue @@ -47,5 +47,6 @@ export default { box-shadow: none !important; user-select: none; pointer-events: none; + padding-left: 10px; } </style> diff --git a/src/components/LeftSidebar/ConversationsList/ConversationsList.vue b/src/components/LeftSidebar/ConversationsList/ConversationsList.vue index 02edc5a37..ca470df81 100644 --- a/src/components/LeftSidebar/ConversationsList/ConversationsList.vue +++ b/src/components/LeftSidebar/ConversationsList/ConversationsList.vue @@ -26,7 +26,7 @@ :key="item.id" :item="item" /> <Hint v-if="searchText && !conversationsList.length" - :hint="t('spreed', 'No search results')" /> + :hint="t('spreed', 'No matches')" /> </ul> </template> diff --git a/src/components/LeftSidebar/LeftSidebar.vue b/src/components/LeftSidebar/LeftSidebar.vue index 4c6a1351f..70e397c20 100644 --- a/src/components/LeftSidebar/LeftSidebar.vue +++ b/src/components/LeftSidebar/LeftSidebar.vue @@ -35,28 +35,33 @@ :search-text="searchText" /> </li> <template v-if="isSearching"> - <Caption - :title="t('spreed', 'Contacts')" /> - <li v-if="searchResultsUsers.length !== 0"> - <ContactsList :contacts="searchResultsUsers" /> - </li> - <Hint v-else-if="contactsLoading" :hint="t('spreed', 'Loading')" /> - <Hint v-else :hint="t('spreed', 'No search results')" /> - - <Caption - :title="t('spreed', 'Groups')" /> - <li v-if="searchResultsGroups.length !== 0"> - <GroupsList :groups="searchResultsGroups" /> - </li> - <Hint v-else-if="contactsLoading" :hint="t('spreed', 'Loading')" /> - <Hint v-else :hint="t('spreed', 'No search results')" /> - - <Caption - :title="t('spreed', 'Circles')" /> - <li v-if="searchResultsCircles.length !== 0"> - <CirclesList :circles="searchResultsCircles" /> - </li> - <Hint v-else-if="contactsLoading" :hint="t('spreed', 'Loading')" /> + <template v-if="searchResultsUsers.length !== 0"> + <Caption + :title="t('spreed', 'Contacts')" /> + <li v-if="searchResultsUsers.length !== 0"> + <ContactsList :contacts="searchResultsUsers" /> + </li> + </template> + + <template v-if="searchResultsGroups.length !== 0"> + <Caption + :title="t('spreed', 'Groups')" /> + <li v-if="searchResultsGroups.length !== 0"> + <GroupsList :groups="searchResultsGroups" /> + </li> + </template> + + <template v-if="searchResultsCircles.length !== 0"> + <Caption + :title="t('spreed', 'Circles')" /> + <li v-if="searchResultsCircles.length !== 0"> + <CirclesList :circles="searchResultsCircles" /> + </li> + </template> + + <Caption v-if="sourcesWithoutResults" + :title="sourcesWithoutResultsList" /> + <Hint v-if="contactsLoading" :hint="t('spreed', 'Loading')" /> <Hint v-else :hint="t('spreed', 'No search results')" /> </template> </ul> @@ -102,6 +107,7 @@ export default { searchResultsGroups: [], searchResultsCircles: [], contactsLoading: false, + isCirclesEnabled: true, // FIXME } }, @@ -112,6 +118,43 @@ export default { isSearching() { return this.searchText !== '' }, + + sourcesWithoutResults() { + return !this.searchResultsUsers.length + || !this.searchResultsGroups.length + || (this.isCirclesEnabled && !this.searchResultsCircles.length) + }, + + sourcesWithoutResultsList() { + if (!this.searchResultsUsers.length) { + if (!this.searchResultsGroups.length) { + if (this.isCirclesEnabled && !this.searchResultsCircles.length) { + return t('spreed', 'Contacts, groups and circles') + } else { + return t('spreed', 'Contacts and groups') + } + } else { + if (this.isCirclesEnabled && !this.searchResultsCircles.length) { + return t('spreed', 'Contacts and circles') + } else { + return t('spreed', 'Contacts') + } + } + } else { + if (!this.searchResultsGroups.length) { + if (this.isCirclesEnabled && !this.searchResultsCircles.length) { + return t('spreed', 'Groups and circles') + } else { + return t('spreed', 'Groups') + } + } else if (!this.searchResultsGroups.length) { + if (this.isCirclesEnabled && !this.searchResultsCircles.length) { + return t('spreed', 'Circles') + } + } + } + return t('spreed', 'Other sources') + }, }, beforeMount() { |