Skip to content

Commit 586df58

Browse files
committed
CCM-8875 Fix colour mapping on template list
1 parent eda3dcb commit 586df58

File tree

3 files changed

+336
-5
lines changed

3 files changed

+336
-5
lines changed

frontend/src/__tests__/components/molecules/MessageTemplates.test.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ describe('MessageTemplates component', () => {
5959

6060
expect(container.asFragment()).toMatchSnapshot();
6161
});
62+
63+
it('matches snapshot with pending proof request status', () => {
64+
messageTemplatesProps.templateList[0].templateStatus =
65+
'PENDING_PROOF_REQUEST';
66+
const container = render(<MessageTemplates {...messageTemplatesProps} />);
67+
68+
expect(container.asFragment()).toMatchSnapshot();
69+
});
6270
it('renders component correctly', () => {
6371
render(<MessageTemplates {...messageTemplatesProps} />);
6472

frontend/src/__tests__/components/molecules/__snapshots__/MessageTemplates.test.tsx.snap

Lines changed: 324 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,330 @@ exports[`MessageTemplates component matches snapshot with not submitted status 1
334334
</DocumentFragment>
335335
`;
336336

337+
exports[`MessageTemplates component matches snapshot with pending proof request status 1`] = `
338+
<DocumentFragment>
339+
<div
340+
class="nhsuk-grid-row"
341+
>
342+
<div
343+
class="nhsuk-grid-column-full"
344+
>
345+
<table
346+
class="nhsuk-table-responsive"
347+
data-testid="manage-template-table"
348+
id="manage-template-table"
349+
>
350+
<caption
351+
class="nhsuk-table__caption"
352+
>
353+
List of templates
354+
</caption>
355+
<thead
356+
class="nhsuk-table__head"
357+
role="rowgroup"
358+
>
359+
<tr
360+
class="nhsuk-table__row"
361+
>
362+
<th
363+
class="nhsuk-table__header"
364+
data-testid="manage-template-table-header-template-name"
365+
scope="col"
366+
>
367+
Name
368+
</th>
369+
<th
370+
class="nhsuk-table__header"
371+
data-testid="manage-template-table-header-template-type"
372+
scope="col"
373+
>
374+
Type
375+
</th>
376+
<th
377+
class="nhsuk-table__header"
378+
data-testid="manage-template-table-header-template-status"
379+
scope="col"
380+
>
381+
Status
382+
</th>
383+
<th
384+
class="nhsuk-table__header"
385+
data-testid="manage-template-table-header-template-date-created"
386+
scope="col"
387+
>
388+
Date created
389+
</th>
390+
<th
391+
class="nhsuk-table__header"
392+
data-testid="manage-template-table-header-action"
393+
scope="col"
394+
>
395+
Action
396+
</th>
397+
</tr>
398+
</thead>
399+
<tbody
400+
class="nhsuk-table__body"
401+
>
402+
<tr
403+
class="nhsuk-table__row"
404+
>
405+
<td
406+
class="nhsuk-table__cell"
407+
role="cell"
408+
>
409+
<span
410+
aria-hidden="true"
411+
class="nhsuk-table-responsive__heading"
412+
>
413+
Name
414+
</span>
415+
<a
416+
href="/preview-nhs-app-template/1"
417+
>
418+
Template 1
419+
</a>
420+
</td>
421+
<td
422+
class="nhsuk-table__cell"
423+
role="cell"
424+
>
425+
<span
426+
aria-hidden="true"
427+
class="nhsuk-table-responsive__heading"
428+
>
429+
Type
430+
</span>
431+
NHS App message
432+
</td>
433+
<td
434+
class="nhsuk-table__cell"
435+
role="cell"
436+
>
437+
<span
438+
aria-hidden="true"
439+
class="nhsuk-table-responsive__heading"
440+
>
441+
Status
442+
</span>
443+
<strong
444+
class="nhsuk-tag nhsuk-tag--blue"
445+
>
446+
Files uploaded
447+
</strong>
448+
</td>
449+
<td
450+
class="nhsuk-table__cell"
451+
role="cell"
452+
>
453+
<span
454+
aria-hidden="true"
455+
class="nhsuk-table-responsive__heading"
456+
>
457+
Date created
458+
</span>
459+
1st Jan 2021
460+
<br />
461+
00:00
462+
</td>
463+
<td
464+
class="nhsuk-table__cell"
465+
role="cell"
466+
>
467+
<span
468+
aria-hidden="true"
469+
class="nhsuk-table-responsive__heading"
470+
>
471+
Action
472+
</span>
473+
<div
474+
class="actionLinksWrapper"
475+
>
476+
<p
477+
class="nhsuk-u-margin-bottom-2"
478+
>
479+
<a
480+
aria-label="Copy Template 1"
481+
href="/copy-template/1"
482+
id="copy-template-link-0"
483+
>
484+
Copy
485+
</a>
486+
</p>
487+
</div>
488+
</td>
489+
</tr>
490+
<tr
491+
class="nhsuk-table__row"
492+
>
493+
<td
494+
class="nhsuk-table__cell"
495+
role="cell"
496+
>
497+
<span
498+
aria-hidden="true"
499+
class="nhsuk-table-responsive__heading"
500+
>
501+
Name
502+
</span>
503+
<a
504+
href="/preview-submitted-nhs-app-template/2"
505+
>
506+
Template 2
507+
</a>
508+
</td>
509+
<td
510+
class="nhsuk-table__cell"
511+
role="cell"
512+
>
513+
<span
514+
aria-hidden="true"
515+
class="nhsuk-table-responsive__heading"
516+
>
517+
Type
518+
</span>
519+
NHS App message
520+
</td>
521+
<td
522+
class="nhsuk-table__cell"
523+
role="cell"
524+
>
525+
<span
526+
aria-hidden="true"
527+
class="nhsuk-table-responsive__heading"
528+
>
529+
Status
530+
</span>
531+
<strong
532+
class="nhsuk-tag nhsuk-tag--grey"
533+
>
534+
Submitted
535+
</strong>
536+
</td>
537+
<td
538+
class="nhsuk-table__cell"
539+
role="cell"
540+
>
541+
<span
542+
aria-hidden="true"
543+
class="nhsuk-table-responsive__heading"
544+
>
545+
Date created
546+
</span>
547+
1st Feb 2021
548+
<br />
549+
00:00
550+
</td>
551+
<td
552+
class="nhsuk-table__cell"
553+
role="cell"
554+
>
555+
<span
556+
aria-hidden="true"
557+
class="nhsuk-table-responsive__heading"
558+
>
559+
Action
560+
</span>
561+
<div
562+
class="actionLinksWrapper"
563+
>
564+
<p
565+
class="nhsuk-u-margin-bottom-2"
566+
>
567+
<a
568+
aria-label="Copy Template 2"
569+
href="/copy-template/2"
570+
id="copy-template-link-1"
571+
>
572+
Copy
573+
</a>
574+
</p>
575+
</div>
576+
</td>
577+
</tr>
578+
<tr
579+
class="nhsuk-table__row"
580+
>
581+
<td
582+
class="nhsuk-table__cell"
583+
role="cell"
584+
>
585+
<span
586+
aria-hidden="true"
587+
class="nhsuk-table-responsive__heading"
588+
>
589+
Name
590+
</span>
591+
<a
592+
href="/preview-submitted-letter-template/3"
593+
>
594+
Template 3
595+
</a>
596+
</td>
597+
<td
598+
class="nhsuk-table__cell"
599+
role="cell"
600+
>
601+
<span
602+
aria-hidden="true"
603+
class="nhsuk-table-responsive__heading"
604+
>
605+
Type
606+
</span>
607+
Standard letter - French
608+
</td>
609+
<td
610+
class="nhsuk-table__cell"
611+
role="cell"
612+
>
613+
<span
614+
aria-hidden="true"
615+
class="nhsuk-table-responsive__heading"
616+
>
617+
Status
618+
</span>
619+
<strong
620+
class="nhsuk-tag nhsuk-tag--grey"
621+
>
622+
Submitted
623+
</strong>
624+
</td>
625+
<td
626+
class="nhsuk-table__cell"
627+
role="cell"
628+
>
629+
<span
630+
aria-hidden="true"
631+
class="nhsuk-table-responsive__heading"
632+
>
633+
Date created
634+
</span>
635+
1st Feb 2021
636+
<br />
637+
00:00
638+
</td>
639+
<td
640+
class="nhsuk-table__cell"
641+
role="cell"
642+
>
643+
<span
644+
aria-hidden="true"
645+
class="nhsuk-table-responsive__heading"
646+
>
647+
Action
648+
</span>
649+
<div
650+
class="actionLinksWrapper"
651+
/>
652+
</td>
653+
</tr>
654+
</tbody>
655+
</table>
656+
</div>
657+
</div>
658+
</DocumentFragment>
659+
`;
660+
337661
exports[`MessageTemplates component matches snapshot with submitted status 1`] = `
338662
<DocumentFragment>
339663
<div

frontend/src/components/molecules/MessageTemplates/MessageTemplates.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
templateStatusToDisplayMappings,
1313
templateTypeDisplayMappings,
1414
previewSubmittedTemplatePages,
15+
templateStatusToColourMappings,
1516
} from 'nhs-notify-web-template-management-utils';
1617
import { TemplateDto } from 'nhs-notify-backend-client';
1718
import style from './MessageTemplates.module.scss';
@@ -79,11 +80,9 @@ export function MessageTemplates({
7980
<Table.Cell>{typeDisplayMappings(template)}</Table.Cell>
8081
<Table.Cell>
8182
<Tag
82-
color={
83-
template.templateStatus === 'SUBMITTED'
84-
? 'grey'
85-
: undefined
86-
}
83+
color={templateStatusToColourMappings(
84+
template.templateStatus
85+
)}
8786
>
8887
{templateStatusToDisplayMappings(template.templateStatus)}
8988
</Tag>

0 commit comments

Comments
 (0)