Conversation
23b1dee
...te-mgmt-component-tests/letter/template-mgmt-letter-template-approved-page.component.spec.ts
Outdated
Show resolved
Hide resolved
| const validatedTemplate = validateLetterTemplate(template); | ||
|
|
||
| if (!validatedTemplate || validatedTemplate.letterVersion !== 'AUTHORING') { | ||
| return redirect('/invalid-template', RedirectType.replace); |
There was a problem hiding this comment.
out of interest, if we're being helpful by redirecting them to preview-letter-template if they end up here and the template isnt in the right state, why aren't we doing similar here and redirecting to preview-submitted?
There was a problem hiding this comment.
Do you mean redirect to preview-approved-letter-template if the status is specifically SUBMITTED?
There was a problem hiding this comment.
I think a double redirect is preferable to adding more logic here, considering how edge-casey it is - though I notice that redirect isn't in Chris' PR currently
| { | ||
| type: 'text', | ||
| text: 'You can now use this letter in your [message plans]({{basePath}}/message-plans).', | ||
| overrides: { a: { props: { 'data-testid': 'message-plans-link' } } }, |
There was a problem hiding this comment.
fully appreciate that I created this problem with testMessageBanner but I've only just realised these links that are within /templates coming via MarkdownContent will be missing out on the benefits of the next <Link> component 🤔
does overrides support overriding the component?
There was a problem hiding this comment.
You can't put JSX in content.ts (I wouldn't want to either since it defeats the purpose)
You can do something like this in page.tsx:
<MarkdownContent
content={useThisLetter}
overrides={{ a: <Link href='href'>{'text'}</Link> }}
/>
But it's pretty wierd! I feel like the only reasonable alternative to what I have is to have the content inline in page.tsx. This doesn't feel right:
<p>
{content.prefix} <Link href="content.href">{content.linkText}</Link>.
</p>
Description
Context
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.