@@ -15,10 +15,13 @@ import { SmtpPagePreview } from "../smtp-page-preview";
1515
1616type Props = {
1717 event: NormalizedEvent <SMTP >;
18+ attachments: Attachment [];
1819 htmlSource: string ;
1920};
2021
21- const props = defineProps <Props >();
22+ const props = withDefaults (defineProps <Props >(), {
23+ attachments: [],
24+ });
2225
2326const htmlSource = ref (props .htmlSource || props .event .payload .html );
2427
@@ -60,12 +63,6 @@ const mail = computed(() => props.event.payload);
6063const date = computed (() =>
6164 moment (props .event .date ).format (" DD.MM.YYYY HH:mm:ss" )
6265);
63-
64- const attachments = computed (() =>
65- Array .isArray (props .event .payload .attachments )
66- ? props .event .payload .attachments
67- : (Object .values (props .event .payload .attachments || {}) as Attachment [])
68- );
6966 </script >
7067
7168<template >
@@ -108,7 +105,7 @@ const attachments = computed(() =>
108105 suffix =" <span class='smtp-page__body-tab-badge'>HTML</span>"
109106 >
110107 <SmtpPagePreview device =" tablet" >
111- <div v-html =" htmlSource" />
108+ <div v-html =" htmlSource" />
112109 </SmtpPagePreview >
113110 </Tab >
114111 <Tab v-if =" isHtml" name =" HTML" >
@@ -127,14 +124,13 @@ const attachments = computed(() =>
127124 </Tab >
128125 <Tab
129126 v-if =" attachments.length"
130- name =" Attachments"
131- :suffix =" `<span class='smtp-page__body-tab-badge'>${attachments.length}</span>`"
127+ :name =" `Attachments (${attachments.length})`"
132128 >
133129 <section class =" mb-5" >
134130 <div class =" flex gap-x-3" >
135131 <FileAttachment
136132 v-for =" a in attachments"
137- :key =" a.id "
133+ :key =" a.uuid "
138134 :event-id =" event.id"
139135 :event =" event"
140136 :attachment =" a"
@@ -143,7 +139,7 @@ const attachments = computed(() =>
143139 </section >
144140 </Tab >
145141 <Tab name =" Raw" >
146- <CodeSnippet language =" html" :code =" event.payload.raw" />
142+ <CodeSnippet language =" html" :code =" event.payload.raw" />
147143 </Tab >
148144 <Tab name =" Tech Info" >
149145 <section >
@@ -156,22 +152,22 @@ const attachments = computed(() =>
156152 {{ event.payload.subject }}
157153 </TableBaseRow >
158154 <TableBaseRow title =" From" >
159- <SmtpPageAddresses :addresses =" event.payload.from" />
155+ <SmtpPageAddresses :addresses =" event.payload.from" />
160156 </TableBaseRow >
161157 <TableBaseRow title =" To" >
162- <SmtpPageAddresses :addresses =" event.payload.to" />
158+ <SmtpPageAddresses :addresses =" event.payload.to" />
163159 </TableBaseRow >
164160 <TableBaseRow v-if =" event.payload.cc.length" title =" Cc" >
165- <SmtpPageAddresses :addresses =" event.payload.cc" />
161+ <SmtpPageAddresses :addresses =" event.payload.cc" />
166162 </TableBaseRow >
167163 <TableBaseRow v-if =" event.payload.bcc.length" title =" Bcc" >
168- <SmtpPageAddresses :addresses =" event.payload.bcc" />
164+ <SmtpPageAddresses :addresses =" event.payload.bcc" />
169165 </TableBaseRow >
170166 <TableBaseRow
171167 v-if =" event.payload.reply_to.length"
172168 title =" Reply to"
173169 >
174- <SmtpPageAddresses :addresses =" event.payload.reply_to" />
170+ <SmtpPageAddresses :addresses =" event.payload.reply_to" />
175171 </TableBaseRow >
176172 </TableBase >
177173 </section >
0 commit comments