Conversation
…eature/13494-render-preview
…eature/13494-render-preview
…eature/13494-render-preview
| tab: RenderTab | ||
| ): PersonalisedRenderDetails | undefined { | ||
| return tab === 'short' | ||
| ? template.files.shortFormRender |
There was a problem hiding this comment.
you've got one type "short" vs "long" and another "shortFormRender" vs "longFormRender" representing basically the same thing - could just have them be the same and template.files[tab]?
There was a problem hiding this comment.
updated, unfortunately it introduced some mapping in the other direction though
| const personalisedRender = getPersonalisedRender(template, tab); | ||
| const initialRender = template.files.initialRender; | ||
|
|
||
| const { fileName } = personalisedRender ?? initialRender ?? {}; |
There was a problem hiding this comment.
wouldn't getting here without an initialRender be an error state rather than a fallback? the page.tsx doesn't allow getting here without an initialRender
There was a problem hiding this comment.
Yes but throwing an error isn't helpful in a frontend component, is it? I'm considering making the renders properties depend on the render status in the next PR, which would remove the need to handle the undefined case
| content.components.previewTemplateDetails; | ||
|
|
||
| function pagesAndSheetsCount(template: AuthoringLetterTemplate) { | ||
| const pages = template.files.initialRender?.pageCount ?? 0; |
There was a problem hiding this comment.
once you've got an initial render, is it possible for it to not have a page count?
There was a problem hiding this comment.
Yes, you can have one in failed state, where we failed to open the docx etc. We create a FAILED render object so the spinner polling can end and inform the user
1e7845e
Description
Adds non-interactive view of initial and personalised renders
other changes:
nhsuk-frontend-supportedflag required for the Tabs componentContext
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.