From 13ea21c91df8719f57e6e6c7ebd835ce662882bd Mon Sep 17 00:00:00 2001 From: Richard Steinmetz Date: Mon, 22 Feb 2021 17:17:19 +0100 Subject: [PATCH 1/2] Show recipients in each thread envelope Signed-off-by: Richard Steinmetz --- src/components/RecipientList.vue | 205 ++++++++++++++++++++++++++++++ src/components/Thread.vue | 104 +-------------- src/components/ThreadEnvelope.vue | 38 +++++- 3 files changed, 242 insertions(+), 105 deletions(-) create mode 100644 src/components/RecipientList.vue diff --git a/src/components/RecipientList.vue b/src/components/RecipientList.vue new file mode 100644 index 0000000000..bac07c2d2d --- /dev/null +++ b/src/components/RecipientList.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/src/components/Thread.vue b/src/components/Thread.vue index db69655d31..4f243ffbac 100644 --- a/src/components/Thread.vue +++ b/src/components/Thread.vue @@ -7,30 +7,7 @@

{{ threadSubject }}

-
- - - - - - {{ moreParticipantsString }} - - - - - -
+ import AppContentDetails from '@nextcloud/vue/dist/Components/AppContentDetails' -import Popover from '@nextcloud/vue/dist/Components/Popover' import { prop, uniqBy } from 'ramda' -import debounce from 'lodash/fp/debounce' import { getRandomMessageErrorMessage } from '../util/ErrorMessageFactory' import Loading from './Loading' import logger from '../logger' -import RecipientBubble from './RecipientBubble' import ThreadEnvelope from './ThreadEnvelope' +import RecipientList from './RecipientList' export default { name: 'Thread', components: { - RecipientBubble, AppContentDetails, Loading, ThreadEnvelope, - Popover, + RecipientList, }, data() { @@ -75,16 +49,10 @@ export default { errorMessage: '', error: undefined, expandedThreads: [], - participantsToDisplay: 999, - resizeDebounced: debounce(500, this.updateParticipantsToDisplay), } }, computed: { - moreParticipantsString() { - // Returns a number showing the number of thread participants that are not shown in the avatar-header - return `+${this.threadParticipants.length - this.participantsToDisplay}` - }, threadId() { return parseInt(this.$route.params.threadId, 10) }, @@ -123,49 +91,8 @@ export default { }, created() { this.resetThread() - window.addEventListener('resize', this.resizeDebounced) - }, - beforeDestroy() { - window.removeEventListener('resize', this.resizeDebounced) }, methods: { - updateParticipantsToDisplay() { - // Wait until everything is in place - if (!this.$refs.avatarHeader || !this.threadParticipants) { - return - } - - // Compute the number of participants to display depending on the width available - const avatarHeader = this.$refs.avatarHeader - const maxWidth = (avatarHeader.clientWidth - 100) // Reserve 100px for the avatar-more span - let childrenWidth = 0 - let fits = 0 - let idx = 0 - while (childrenWidth < maxWidth && fits < this.threadParticipants.length) { - // Skipping the 'avatar-more' span - if (avatarHeader.childNodes[idx].clientWidth === undefined) { - idx += 3 - continue - } - childrenWidth += avatarHeader.childNodes[idx].clientWidth - fits++ - idx++ - } - - if (childrenWidth > maxWidth) { - // There's not enough space to show all thread participants - if (fits > 1) { - this.participantsToDisplay = fits - 1 - } else if (fits === 0) { - this.participantsToDisplay = 1 - } else { - this.participantsToDisplay = fits - } - } else { - // There's enough space to show all thread participants - this.participantsToDisplay = this.threadParticipants.length - } - }, toggleExpand(threadId) { if (!this.expandedThreads.includes(threadId)) { console.debug(`expand thread ${threadId}`) @@ -191,7 +118,6 @@ export default { async resetThread() { this.expandedThreads = [this.threadId] await this.fetchThread() - this.updateParticipantsToDisplay() }, async fetchThread() { this.loading = true @@ -376,31 +302,7 @@ export default { user-select: text; } -.avatar-header { - max-height: 24px; - overflow: hidden; -} -.avatar-more { - display: inline; - background-color: var(--color-background-dark); - padding: 0px 0px 1px 1px; - border-radius: 10px; - cursor: pointer; -} -.avatar-hidden { - visibility: hidden; -} -.popover__wrapper { - max-width: 500px; -} - .app-content-list-item-star.icon-starred { display: none; } -.user-bubble__wrapper { - margin-right: 4px; -} -.user-bubble__title { - cursor: pointer; -} diff --git a/src/components/ThreadEnvelope.vue b/src/components/ThreadEnvelope.vue index 9ec3377837..5cdc288e81 100644 --- a/src/components/ThreadEnvelope.vue +++ b/src/components/ThreadEnvelope.vue @@ -71,10 +71,27 @@ - + 0 + }, }, watch: { expanded(expanded) { @@ -248,6 +271,9 @@ export default { onToggleFlagged() { this.$store.dispatch('toggleEnvelopeFlagged', this.envelope) }, + onToggleHeader() { + this.expandHeader = !this.expandHeader + }, }, } @@ -349,5 +375,9 @@ export default { .left:not(.seen) { font-weight: bold; } + .recipients { + margin-left: 60px; + margin-right: 38px; + } From 0b9afd3bb7378ec158b1c7e0e172e9e84fb181df Mon Sep 17 00:00:00 2001 From: Richard Steinmetz Date: Mon, 8 Mar 2021 15:32:17 +0100 Subject: [PATCH 2/2] fixup! Show recipients in each thread envelope Signed-off-by: Richard Steinmetz --- src/components/RecipientBubble.vue | 1 + src/components/RecipientList.vue | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/RecipientBubble.vue b/src/components/RecipientBubble.vue index 897f542a5a..ed74f6f159 100644 --- a/src/components/RecipientBubble.vue +++ b/src/components/RecipientBubble.vue @@ -22,6 +22,7 @@