diff options
author | Marco <marcoambrosini@icloud.com> | 2022-10-10 14:46:01 +0300 |
---|---|---|
committer | Marco <marcoambrosini@icloud.com> | 2022-10-10 14:46:01 +0300 |
commit | d20c2cbf64f79a9c3ae5274e3628cf4aea58255c (patch) | |
tree | 609e8a68763cf8dc2a15842c1393c772e5f22c61 | |
parent | 2450ae8139ca7ac48e423c71da3027b647ddc0f3 (diff) |
Flatten users and groups toofeature/noid/flatten-conversations-list
Signed-off-by: Marco <marcoambrosini@icloud.com>
-rw-r--r-- | src/components/LeftSidebar/LeftSidebar.vue | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/src/components/LeftSidebar/LeftSidebar.vue b/src/components/LeftSidebar/LeftSidebar.vue index 395257758..04c7c62bb 100644 --- a/src/components/LeftSidebar/LeftSidebar.vue +++ b/src/components/LeftSidebar/LeftSidebar.vue @@ -59,10 +59,15 @@ </template> <template v-if="searchResultsUsers.length !== 0"> <NcAppNavigationCaption :title="t('spreed', 'Users')" /> - <li v-if="searchResultsUsers.length !== 0" role="presentation"> - <ConversationsOptionsList :items="searchResultsUsers" - @click="createAndJoinConversation" /> - </li> + <NcListItem v-for="item of searchResultsUsers" + :key="item.id" + :title="item.label" + @click="createAndJoinConversation(item)"> + <template #icon> + <ConversationIcon :item="iconData(item)" + :disable-menu="true" /> + </template> + </NcListItem> </template> <template v-if="!showStartConversationsOptions"> <NcAppNavigationCaption v-if="searchResultsUsers.length === 0" @@ -74,10 +79,15 @@ <template v-if="showStartConversationsOptions"> <template v-if="searchResultsGroups.length !== 0"> <NcAppNavigationCaption :title="t('spreed', 'Groups')" /> - <li v-if="searchResultsGroups.length !== 0" role="presentation"> - <ConversationsOptionsList :items="searchResultsGroups" - @click="createAndJoinConversation" /> - </li> + <NcListItem v-for="item of searchResultsGroups" + :key="item.id" + :title="item.label" + @click="createAndJoinConversation(item)"> + <template #icon> + <ConversationIcon :item="iconData(item)" + :disable-menu="true" /> + </template> + </NcListItem> </template> <template v-if="searchResultsCircles.length !== 0"> @@ -138,6 +148,8 @@ import { showError } from '@nextcloud/dialogs' import { emit } from '@nextcloud/event-bus' import LoadingPlaceholder from '../LoadingPlaceholder.vue' import isMobile from '@nextcloud/vue/dist/Mixins/isMobile.js' +import NcListItem from '@nextcloud/vue/dist/Components/NcListItem.js' +import ConversationIcon from '../ConversationIcon.vue' export default { @@ -153,6 +165,8 @@ export default { NewGroupConversation, Conversation, LoadingPlaceholder, + NcListItem, + ConversationIcon, }, mixins: [ @@ -549,6 +563,20 @@ export default { this.$store.dispatch('joinConversation', { token: to.params.token }) } }, + + iconData(item) { + if (item.source === 'users') { + return { + type: CONVERSATION.TYPE.ONE_TO_ONE, + displayName: item.label, + name: item.id, + } + } + return { + type: CONVERSATION.TYPE.GROUP, + objectType: item.source, + } + }, }, } </script> |