diff --git a/src/client/modules/ExportWins/Review/ThankYou.jsx b/src/client/modules/ExportWins/Review/ThankYou.jsx index dbe602fffa6..5d9e2b288ad 100644 --- a/src/client/modules/ExportWins/Review/ThankYou.jsx +++ b/src/client/modules/ExportWins/Review/ThankYou.jsx @@ -1,10 +1,53 @@ import React from 'react' +import { Route } from 'react-router-dom' +import styled from 'styled-components' + +import { GREEN, WHITE } from '../../../utils/colours' +import { StatusMessage } from '../../../components' import Layout from './Layout' -import FlashMessages from '../../../components/LocalHeader/FlashMessages' + +const StyledStatusMessage = styled(StatusMessage)({ + background: WHITE, + '& > *:first-child': { + marginTop: 0, + }, + '& > *:last-child': { + marginBottom: 0, + }, +}) export default () => ( - }> - Your feedback will help us to improve our support services. - + + {({ location: { search } }) => { + const agree = search.includes('agree=yes') + return ( + + Thank you for taking time to review this export win. + + ) : ( + +

Thank you for reviewing this export win.

+

+ As you have asked for some changes to be made, we will review + your comments and may need to contact you if we need more + information. +

+
+ ) + } + > + Your feedback will help us to improve our support services. +
+ ) + }} +
) diff --git a/src/client/modules/ExportWins/Review/index.jsx b/src/client/modules/ExportWins/Review/index.jsx index 04086d97667..1a0b3be6836 100644 --- a/src/client/modules/ExportWins/Review/index.jsx +++ b/src/client/modules/ExportWins/Review/index.jsx @@ -312,29 +312,10 @@ const Review = ({ token }) => ( analyticsFormName={FORM_ID} submissionTaskName="TASK_PATCH_EXPORT_WIN_REVIEW" redirectMode="soft" - redirectTo={() => '/exportwins/review-win/thankyou'} - transformPayload={transformPayload(token)} - flashMessage={(_, { agree_with_win }) => - agree_with_win === 'yes' - ? // TODO: Move to constants - [ - 'Success', - 'Thank you for taking time to review this export win', - 'success', - ] - : [ - 'Important', - ` -

Thank you for reviewing this export win

-

- As you have asked for some changes to be made, - we will review your comments and may need to contact you - if we need more information. -

- `, - 'info', - ] + redirectTo={(_, { agree_with_win }) => + `/exportwins/review-win/thankyou?agree=${agree_with_win}` } + transformPayload={transformPayload(token)} > {(formData) => ( <> diff --git a/test/component/cypress/specs/ExportWins/Review.cy.jsx b/test/component/cypress/specs/ExportWins/Review.cy.jsx index 302bc0f6a75..95f4ea29d88 100644 --- a/test/component/cypress/specs/ExportWins/Review.cy.jsx +++ b/test/component/cypress/specs/ExportWins/Review.cy.jsx @@ -22,9 +22,9 @@ const assertHeader = () => { cy.get('header h1').should('have.text', HEADING) } -const assertReviewed = () => { +const assertReviewed = ({ heading }) => { cy.contains(DBT_HEADING) - cy.get('header h1').should('have.text', 'Export win reviewed') + cy.get('header h1').should('have.text', heading) cy.get('main').should( 'have.text', 'Your feedback will help us to improve our support services.' @@ -382,15 +382,12 @@ describe('ExportWins/Review', () => { cy.contains('button', 'Confirm and send').click() - assertReviewed() + assertReviewed({ heading: 'Export win reviewed' }) - cy.get('[role="alert"').within(() => { - cy.contains('h2', /^Success$/) - cy.contains( - 'p', - /^Thank you for taking time to review this export win$/ - ) - }) + cy.get('[role="alert"').should( + 'have.text', + 'Thank you for taking time to review this export win.' + ) }) it('User disagrees with win', () => { @@ -458,14 +455,13 @@ describe('ExportWins/Review', () => { cy.contains('button', 'Confirm and send').click() - assertReviewed() + assertReviewed({ heading: 'Export win reviewed and changes are needed' }) cy.get('[role="alert"').within(() => { - cy.contains('h2', /^Important$/) - cy.contains('p', /^\s*Thank you for reviewing this export win\s*$/) + cy.contains('p', /^\s*Thank you for reviewing this export win.\s*$/) cy.contains( 'p', - /^\s*As you have asked for some changes to be made, we will review your comments and may need to contact you if we need more information.\s*$/ + /^\s*As you have asked for some changes to be made, we will review your comments and may need to contact you if we need more information.*$/ ) }) })