|
15 | 15 | :slow-hint="t('mail', 'Indexing your messages. This can take a bit longer for larger mailboxes.')" />
|
16 | 16 | <EmptyMailboxSection v-else-if="isPriorityInbox && !hasMessages" key="empty" />
|
17 | 17 | <EmptyMailbox v-else-if="!hasMessages" key="empty" />
|
| 18 | + <template v-else-if="hasGroupedEnvelopes && !isPriorityInbox"> |
| 19 | + <div v-for="[label, group] in Object.entries(groupEnvelopes)" :key="label"> |
| 20 | + <SectionTitle class="section-title" :name="label" /> |
| 21 | + <EnvelopeList :account="account" |
| 22 | + :mailbox="mailbox" |
| 23 | + :search-query="searchQuery" |
| 24 | + :envelopes="group" |
| 25 | + :loading-more="loadingMore" |
| 26 | + :load-more-button="showLoadMore" |
| 27 | + :skip-transition="skipListTransition" |
| 28 | + @delete="onDelete" |
| 29 | + @load-more="loadMore" /> |
| 30 | + </div> |
| 31 | + </template> |
18 | 32 | <EnvelopeList v-else
|
19 | 33 | :account="account"
|
20 | 34 | :mailbox="mailbox"
|
|
30 | 44 |
|
31 | 45 | <script>
|
32 | 46 | import EmptyMailbox from './EmptyMailbox.vue'
|
| 47 | +import SectionTitle from './SectionTitle.vue' |
33 | 48 | import EnvelopeList from './EnvelopeList.vue'
|
34 | 49 | import LoadingSkeleton from './LoadingSkeleton.vue'
|
35 | 50 | import Error from './Error.vue'
|
@@ -58,9 +73,15 @@ export default {
|
58 | 73 | Error,
|
59 | 74 | Loading,
|
60 | 75 | LoadingSkeleton,
|
| 76 | + SectionTitle, |
61 | 77 | },
|
62 | 78 | mixins: [isMobile],
|
63 | 79 | props: {
|
| 80 | + groupEnvelopes: { |
| 81 | + type: Object, |
| 82 | + required: false, |
| 83 | + default: null, |
| 84 | + }, |
64 | 85 | account: {
|
65 | 86 | type: Object,
|
66 | 87 | required: true,
|
@@ -124,8 +145,14 @@ export default {
|
124 | 145 | }
|
125 | 146 | return this.envelopes
|
126 | 147 | },
|
| 148 | + hasGroupedEnvelopes() { |
| 149 | + return this.groupEnvelopes && Object.keys(this.groupEnvelopes).length > 0 |
| 150 | + }, |
127 | 151 | hasMessages() {
|
128 |
| - return this.envelopes.length > 0 |
| 152 | + if (this.hasGroupedEnvelopes) { |
| 153 | + return Object.values(this.groupEnvelopes).some(group => group.length > 0) |
| 154 | + } |
| 155 | + return this.envelopesToShow?.length > 0 |
129 | 156 | },
|
130 | 157 | showLoadMore() {
|
131 | 158 | return !this.endReached && this.paginate === 'manual'
|
|
0 commit comments