From 7fdbac02ef26da4114f691673732c38ff6bd500b Mon Sep 17 00:00:00 2001
From: Clare Jones
| + Select + | ++ Name + | ++ Type + | ++ Last edited + | ++ |
|---|---|---|---|---|
|
+
+
+
+
+
+ |
+ + + app template name + | ++ + NHS App message + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
|
+
+
+
+
+
+ |
+ + + email template name + | ++ + Email + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
|
+
+
+
+
+
+ |
+ + + sms template name + | ++ + Text message (SMS) + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
|
+
+
+
+
+
+ |
+ + + letter template name + | ++ + Standard letter + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
| + Select + | ++ Name + | ++ Type + | ++ Last edited + | ++ |
|---|---|---|---|---|
|
+
+
+
+
+
+ |
+ + + app template name + | ++ + NHS App message + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
|
+
+
+
+
+
+ |
+ + + email template name + | ++ + Email + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
|
+
+
+
+
+
+ |
+ + + sms template name + | ++ + Text message (SMS) + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
|
+
+
+
+
+
+ |
+ + + letter template name + | ++ + Standard letter + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
| + Select + | ++ Name + | ++ Type + | ++ Last edited + | ++ |
|---|---|---|---|---|
|
+
+
+
+
+
+ |
+ + + app template name + | ++ + NHS App message + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
|
+
+
+
+
+
+ |
+ + + email template name + | ++ + Email + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
|
+
+
+
+
+
+ |
+ + + sms template name + | ++ + Text message (SMS) + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
|
+
+
+
+
+
+ |
+ + + letter template name + | ++ + Standard letter + | +
+
+ 13th Jan 2025
+ + 10:19 + |
+
+
+
+
+ Preview
+
+
+ |
+
+ app content +
+ + ++ + Go back + +
++ app content +
+ + ++ This template cannot be edited because it has been submitted. +
++ If you want to change a submitted or live template, you must create a new template to replace it. +
++ + Go back + +
++ app content +
+ + ++ This template cannot be edited because it has been submitted. +
++ If you want to change a submitted or live template, you must create a new template to replace it. +
+ ++ email content +
+ + ++ This template cannot be edited because it has been submitted. +
++ If you want to change a submitted or live template, you must create a new template to replace it. +
+ ++ file.pdf +
++ file.csv +
++ a.pdf +
++ b.pdf +
++ If you want to change a submitted or live template, you must create a new template to replace it. +
+ ++ SMS content +
+ + ++ This template cannot be edited because it has been submitted. +
++ If you want to change a submitted or live template, you must create a new template to replace it. +
+ ++ email content +
+ + @@ -946,7 +950,11 @@ exports[`PreviewTemplateDetailsNhsApp matches snapshot 1`] = ` data-testid="preview__content-0" id="preview-content-message" > - app content ++ app content +
+ + @@ -1050,7 +1058,11 @@ exports[`PreviewTemplateDetailsSms matches snapshot 1`] = ` data-testid="preview__content-0" id="preview-content-message" > - SMS content ++ SMS content +
+ + diff --git a/frontend/src/__tests__/components/molecules/__snapshots__/ViewEmailTemplate.test.tsx.snap b/frontend/src/__tests__/components/molecules/__snapshots__/ViewEmailTemplate.test.tsx.snap deleted file mode 100644 index 6b4a05b26..000000000 --- a/frontend/src/__tests__/components/molecules/__snapshots__/ViewEmailTemplate.test.tsx.snap +++ /dev/null @@ -1,167 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ViewEmailTemplate component matches submitted snapshot 1`] = ` -- Example message -
- - -- This template cannot be edited because it has been submitted. -
-- If you want to change a submitted or live template, you must create a new template to replace it. -
- -- file.pdf -
-- supplier-proof.pdf -
-- If you want to change a submitted or live template, you must create a new template to replace it. -
- -- Example message -
- - -- This template cannot be edited because it has been submitted. -
-- If you want to change a submitted or live template, you must create a new template to replace it. -
- -- Example message -
- - -- This template cannot be edited because it has been submitted. -
-- If you want to change a submitted or live template, you must create a new template to replace it. -
- -{content.noTemplatesText}
+ )} ++ + {content.actions.goToTemplates.text} + +
+ )} + 0 && 'inline-block nhsuk-u-margin-left-3 nhsuk-u-padding-top-3'}`} + > + {content.actions.backLink.text} + +
diff --git a/frontend/src/components/forms/PreviewNHSAppTemplate/PreviewNHSAppTemplate.tsx b/frontend/src/components/forms/PreviewNHSAppTemplate/PreviewNHSAppTemplate.tsx
index a27f4ea34..810af1b27 100644
--- a/frontend/src/components/forms/PreviewNHSAppTemplate/PreviewNHSAppTemplate.tsx
+++ b/frontend/src/components/forms/PreviewNHSAppTemplate/PreviewNHSAppTemplate.tsx
@@ -9,7 +9,6 @@ import {
PageComponentProps,
} from 'nhs-notify-web-template-management-utils';
import content from '@content/content';
-import { renderNHSAppMarkdown } from '@utils/markdownit';
import { useSearchParams } from 'next/navigation';
import { useActionState, useState } from 'react';
import { NHSNotifyMain } from '@atoms/NHSNotifyMain/NHSNotifyMain';
@@ -33,8 +32,6 @@ export function PreviewNHSAppTemplate({
const formValidate = validate(schema, setErrorState);
- const { message } = state;
- const html = renderNHSAppMarkdown(message);
const isFromEditPage = searchParams.get('from') === 'edit';
const { sectionHeading, form, backLinkText } =
@@ -64,10 +61,7 @@ export function PreviewNHSAppTemplate({
formAttributes: { onSubmit: formValidate },
}}
previewDetailsComponent={
-
{content.cannotEdit}
+ )} +{content.createNewTemplate}
+ > + )} + ++ {backLinkText} +
+{cannotEdit}
-{createNewTemplate}
-- {backLinkText} -
-{createNewTemplate}
-- - {backLinkText} - -
-{cannotEdit}
-{createNewTemplate}
-- {backLinkText} -
-{cannotEdit}
-{createNewTemplate}
-- {backLinkText} -
-+ message +
+ + ++ + Go back + +
++ message +
+ + ++ + Go back + +
++ template.pdf +
++ + Go back + +
++ message +
+ + ++ + Go back + +
++ This template cannot be edited because it has been submitted. +
++ If you want to change a submitted or live template, you must create a new template to replace it. +
- Go back + Back to all templates
@@ -120,9 +145,9 @@ exports[`PreviewSubmittedTemplate component should provide back buttons based on- Go back + Back to all templates
diff --git a/frontend/src/app/message-plans/choose-email-template/[routingConfigId]/preview-template/[templateId]/page.tsx b/frontend/src/app/message-plans/choose-email-template/[routingConfigId]/preview-template/[templateId]/page.tsx new file mode 100644 index 000000000..b019cc912 --- /dev/null +++ b/frontend/src/app/message-plans/choose-email-template/[routingConfigId]/preview-template/[templateId]/page.tsx @@ -0,0 +1,44 @@ +'use server'; + +import { + MessagePlanAndTemplatePageProps, + validateSubmittedEmailTemplate, +} from 'nhs-notify-web-template-management-utils'; +import { getTemplate } from '@utils/form-actions'; +import { redirect, RedirectType } from 'next/navigation'; +import { Metadata } from 'next'; +import content from '@content/content'; +import PreviewTemplateDetailsEmail from '@molecules/PreviewTemplateDetails/PreviewTemplateDetailsEmail'; +import { PreviewTemplateFromMessagePlan } from '@molecules/PreviewTemplateFromMessagePlan/PreviewTemplateFromMessagePlan'; + +const { pageTitle } = content.components.previewEmailTemplate; + +export async function generateMetadata(): Promise{content.cannotEdit}
- )} -{content.createNewTemplate}
- > + {initialState.templateType !== 'LETTER' && ( +{content.cannotEdit}
)} +{content.createNewTemplate}
- {backLinkText} + {content.backLink.text}
+ {content.backLink.text} +
+