Skip to content

Commit f0ec98d

Browse files
committed
feat: mailbox icon in thread view
Signed-off-by: Roberto Guido <info@madbob.org>
1 parent 3d28b46 commit f0ec98d

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

src/components/Thread.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
ref="envelopeRefs"
2525
:key="env.databaseId"
2626
:envelope="env"
27-
:mailbox-id="$route.params.mailboxId"
2827
:thread-subject="threadSubject"
2928
:expanded="expandedThreads.includes(env.databaseId)"
3029
:full-height="thread.length === 1"

src/components/ThreadEnvelope.vue

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@
6565
@keydown.space.prevent="$emit('toggle-expand', $event)">
6666
<div class="envelope__header__left__sender-subject-tags">
6767
<div class="sender" :class="{ 'sender--expanded': expanded }">
68+
<NcChip
69+
:title="mailboxName(mailbox)"
70+
variant="tertiary"
71+
no-close="true">
72+
<MailboxIcon
73+
:account="account"
74+
:mailbox="mailbox" />
75+
</NcChip>
76+
6877
{{ envelope.from && envelope.from[0] ? envelope.from[0].label : '' }}
6978
</div>
7079
<NcButton
@@ -390,6 +399,7 @@ import { loadState } from '@nextcloud/initial-state'
390399
import moment from '@nextcloud/moment'
391400
import { generateUrl } from '@nextcloud/router'
392401
import { NcActionButton, NcButton } from '@nextcloud/vue'
402+
import NcChip from '@nextcloud/vue/components/NcChip'
393403
import { mapStores } from 'pinia'
394404
import NcActions from '@nextcloud/vue/components/NcActions'
395405
import NcActionText from '@nextcloud/vue/components/NcActionText'
@@ -411,6 +421,7 @@ import ConfirmModal from './ConfirmationModal.vue'
411421
import Error from './Error.vue'
412422
import EventModal from './EventModal.vue'
413423
import JunkIcon from './icons/JunkIcon.vue'
424+
import MailboxIcon from './icons/MailboxIcon.vue'
414425
import MailFilterFromEnvelope from './mailFilter/MailFilterFromEnvelope.vue'
415426
import MenuEnvelope from './MenuEnvelope.vue'
416427
import Message from './Message.vue'
@@ -426,6 +437,7 @@ import importantSvg from '../../img/important.svg'
426437
import { isPgpText } from '../crypto/pgp.js'
427438
import { matchError } from '../errors/match.js'
428439
import NoTrashMailboxConfiguredError from '../errors/NoTrashMailboxConfiguredError.js'
440+
import { translate as translateMailboxName } from '../i18n/MailboxTranslator.js'
429441
import logger from '../logger.js'
430442
import { buildRecipients as buildReplyRecipients } from '../ReplyBuilder.js'
431443
import { smartReply } from '../service/AiIntergrationsService.js'
@@ -459,8 +471,10 @@ export default {
459471
RecipientBubble,
460472
NcActionButton,
461473
NcButton,
474+
NcChip,
462475
Error,
463476
IconFavorite,
477+
MailboxIcon,
464478
JunkIcon,
465479
MessageLoadingSkeleton,
466480
MenuEnvelope,
@@ -489,16 +503,6 @@ export default {
489503
type: Object,
490504
},
491505
492-
mailboxId: {
493-
required: false,
494-
type: [
495-
String,
496-
Number,
497-
],
498-
499-
default: undefined,
500-
},
501-
502506
expanded: {
503507
required: false,
504508
type: Boolean,
@@ -702,7 +706,7 @@ export default {
702706
},
703707
704708
mailbox() {
705-
return this.mainStore.getMailbox(this.mailboxId)
709+
return this.mainStore.getMailbox(this.envelope.mailboxId)
706710
},
707711
708712
archiveMailbox() {
@@ -1071,6 +1075,10 @@ export default {
10711075
})
10721076
},
10731077
1078+
mailboxName() {
1079+
return translateMailboxName(this.mailbox)
1080+
},
1081+
10741082
async unsubscribeViaOneClick() {
10751083
try {
10761084
this.unsubscribing = true
@@ -1213,7 +1221,9 @@ export default {
12131221
12141222
<style lang="scss" scoped>
12151223
.sender {
1224+
display: flex;
12161225
margin-inline-start: calc(var(--default-grid-baseline) * 3);
1226+
gap: var(--default-grid-baseline);
12171227
12181228
&--expanded {
12191229
color: var(--color-text-maxcontrast);
@@ -1410,7 +1420,7 @@ export default {
14101420
}
14111421
14121422
.subline {
1413-
margin-inline-start: 8px;
1423+
margin-inline-start: calc(var(--default-grid-baseline) * 3);
14141424
color: var(--color-text-maxcontrast);
14151425
cursor: default;
14161426
overflow: hidden;

0 commit comments

Comments
 (0)