diff --git a/assets/vue3-tabs-component.scss b/assets/vue3-tabs-component.scss index e33ba417..2e39f213 100644 --- a/assets/vue3-tabs-component.scss +++ b/assets/vue3-tabs-component.scss @@ -24,4 +24,8 @@ .tabs-component-panel { -} \ No newline at end of file +} + +.preview-tab-badge { + @apply bg-red-800 ml-2 text-2xs px-2 py-1 rounded text-white uppercase; +} diff --git a/components/SmtpPage/SmtpPage.stories.ts b/components/SmtpPage/SmtpPage.stories.ts index dca3395b..3be23f91 100644 --- a/components/SmtpPage/SmtpPage.stories.ts +++ b/components/SmtpPage/SmtpPage.stories.ts @@ -1,6 +1,8 @@ import { Meta, Story } from "@storybook/vue3"; import { normalizeSMTPEvent } from "~/utils/normalize-event"; -import smtpEventMock from '~/mocks/smtp-welcome.json' +import smtpEventWelcomeMock from '~/mocks/smtp-welcome.json' +import smtpEventOrderMock from '~/mocks/smtp-order.json' +import smtpEventTextMock from '~/mocks/smtp-text.json' import SmtpPage from "~/components/SmtpPage/SmtpPage.vue"; export default { @@ -18,11 +20,24 @@ const Template: Story = (args) => ({ template: ``, }); +const normalizeEventWelcome = normalizeSMTPEvent(smtpEventWelcomeMock) +const normalizeEventOrder = normalizeSMTPEvent(smtpEventOrderMock) +const normalizeEventText = normalizeSMTPEvent(smtpEventTextMock) + export const Default = Template.bind({}); +Default.args = { + event: normalizeEventWelcome, + htmlSource: normalizeEventWelcome.payload.html +}; -const normalizeEvent = normalizeSMTPEvent(smtpEventMock) +export const Order = Template.bind({}); +Order.args = { + event: normalizeEventOrder, + htmlSource: normalizeEventOrder.payload.html +}; -Default.args = { - event: normalizeEvent, - htmlSource: normalizeEvent.payload.html +export const Text = Template.bind({}); +Text.args = { + event: normalizeEventText, + htmlSource: normalizeEventText.payload.html }; diff --git a/components/SmtpPage/SmtpPage.vue b/components/SmtpPage/SmtpPage.vue index 5f4b2032..fb46f40a 100644 --- a/components/SmtpPage/SmtpPage.vue +++ b/components/SmtpPage/SmtpPage.vue @@ -31,18 +31,37 @@
- +
- + + + + + +
+
+ +
+
+
@@ -76,21 +95,6 @@
- -
-

- Attachments ({{ attachments.length }}) -

- -
- -
-
@@ -128,7 +132,11 @@ export default defineComponent({ }, htmlSource: { type: String, - required: true, + required: false, + }, + textSource: { + type: String, + required: false, }, }, data() { @@ -158,6 +166,12 @@ export default defineComponent({ }; }, computed: { + isHtml(): boolean { + return this.event.payload.html !== null && this.event.payload.html !== ""; + }, + isText(): boolean { + return this.event.payload.text !== null && this.event.payload.text !== ""; + }, mail() { return this.event.payload; }, diff --git a/mocks/smtp-text.json b/mocks/smtp-text.json new file mode 100644 index 00000000..5ab81f66 --- /dev/null +++ b/mocks/smtp-text.json @@ -0,0 +1,37 @@ +{ + "uuid":"a68e1262-39d4-4ecc-bdc1-ef5298f312a7", + "type":"smtp", + "payload":{ + "id":"a0216af771ec6d1f670f9098d52ea6a9@local.host", + "from":[ + { + "email":"sendit@local.host", + "name":"Site" + } + ], + "reply_to":[ + + ], + "subject":"Reset YourPassword", + "to":[ + { + "name":"", + "email":"pm@site.com" + } + ], + "cc":[ + + ], + "bcc":[ + + ], + "text":"\r\n\r\n\r\n \r\n\r\n\r\n
\r\n

Hello Flavie Welch,

\r\n

To complete the password reset process, visit the following link:

\r\n Reset Password\r\n

If you didn’t request this, please ignore this email.

\r\n\r\n \r\n

Best Regards,

\r\n

Site Team

\r\n
\r\n\r\n\r\n", + "html":"", + "raw":"To: pm@site.com\r\nSubject: Reset Your Password\r\nFrom: Site \r\nMessage-ID: \r\nMIME-Version: 1.0\r\nDate: Thu, 16 Nov 2023 13:47:25 +0000\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n
\r\n

Hello Flavie Welch,

\r\n

To complete the password reset process, visit the following link:\r\n Reset Password\r\n

If you didn=E2=80=99t request this, please ignore this email.

\r\n\r\n
    \r\n
  • Email: pm@site.com
  • \r\n
\r\n

Best Regards,

\r\n

Site Team

\r\n
\r\n\r\n\r\n", + "attachments":[ + + ] + }, + "timestamp":1700142445, + "project_id":null +}