diff --git a/f2/src/AnonymousPage.js b/f2/src/AnonymousPage.js index 4ef5f1253..ba3449669 100644 --- a/f2/src/AnonymousPage.js +++ b/f2/src/AnonymousPage.js @@ -10,6 +10,7 @@ import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const AnonymousPage = () => { @@ -36,6 +37,7 @@ export const AnonymousPage = () => { { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { anonymous: data }, diff --git a/f2/src/BusinessPage.js b/f2/src/BusinessPage.js index ecf1e8766..748fc5959 100644 --- a/f2/src/BusinessPage.js +++ b/f2/src/BusinessPage.js @@ -14,6 +14,7 @@ import { whatWasAffectedPages, } from './utils/nextWhatWasAffectedUrl' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const BusinessPage = () => { @@ -45,6 +46,7 @@ export const BusinessPage = () => { whatWasAffectedNavState.nextPage.nextPageTextInPreviousPage } onSubmit={(data) => { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { businessInfo: data }, diff --git a/f2/src/ConfirmationPage.js b/f2/src/ConfirmationPage.js index c79c26e8a..08a887d8b 100644 --- a/f2/src/ConfirmationPage.js +++ b/f2/src/ConfirmationPage.js @@ -15,6 +15,7 @@ import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' import { formDefaults } from './forms/defaultValues' +import { removeEditFlags } from './utils/flagFieldEdited' import { useLog } from './useLog' const { getLogger } = require('./utils/winstonLoggerClient') @@ -49,6 +50,7 @@ async function postData(url = '', data = {}) { } const prepFormData = (formDataOrig, language) => { + removeEditFlags(formDataOrig) Object.keys(formDataOrig).forEach((form) => { if (formDefaults[form]) { formDataOrig[form] = { diff --git a/f2/src/ContactInfoPage.js b/f2/src/ContactInfoPage.js index 153020f69..59aea682c 100644 --- a/f2/src/ContactInfoPage.js +++ b/f2/src/ContactInfoPage.js @@ -10,10 +10,12 @@ import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const ContactInfoPage = () => { - const [, dispatch] = useStateValue() + const [state, dispatch] = useStateValue() + const { doneForms } = state useLog('ContactInfoPage') return ( { { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { contactInfo: data }, diff --git a/f2/src/DevicesPage.js b/f2/src/DevicesPage.js index 3cfa80608..127c68575 100644 --- a/f2/src/DevicesPage.js +++ b/f2/src/DevicesPage.js @@ -13,6 +13,7 @@ import { whatWasAffectedPages, } from './utils/nextWhatWasAffectedUrl' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const DevicesPage = () => { @@ -46,6 +47,7 @@ export const DevicesPage = () => { whatWasAffectedNavState.nextPage.nextPageTextInPreviousPage } onSubmit={(data) => { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { devicesInfo: data }, diff --git a/f2/src/EvidencePage.js b/f2/src/EvidencePage.js index 3012b3efa..f8b9463a0 100644 --- a/f2/src/EvidencePage.js +++ b/f2/src/EvidencePage.js @@ -12,6 +12,7 @@ import { BackButton } from './components/backbutton' import { Stack, Box } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const EvidencePage = () => { @@ -56,6 +57,7 @@ export const EvidencePage = () => { { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { evidence: data } }) history.push(doneForms ? '/confirmation' : '/location') }} diff --git a/f2/src/HowDidItStartPage.js b/f2/src/HowDidItStartPage.js index 12822893a..9acf08562 100644 --- a/f2/src/HowDidItStartPage.js +++ b/f2/src/HowDidItStartPage.js @@ -10,6 +10,7 @@ import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const HowDidItStartPage = () => { @@ -34,8 +35,8 @@ export const HowDidItStartPage = () => { { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { howdiditstart: data }, diff --git a/f2/src/InformationPage.js b/f2/src/InformationPage.js index 270a4dc87..a3ba8c105 100644 --- a/f2/src/InformationPage.js +++ b/f2/src/InformationPage.js @@ -14,6 +14,7 @@ import { whatWasAffectedPages, } from './utils/nextWhatWasAffectedUrl' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const InformationPage = () => { @@ -47,6 +48,7 @@ export const InformationPage = () => { whatWasAffectedNavState.nextPage.nextPageTextInPreviousPage } onSubmit={(data) => { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { personalInformation: data }, diff --git a/f2/src/LocationAnonymousPage.js b/f2/src/LocationAnonymousPage.js index b6720e4dc..1afe64096 100644 --- a/f2/src/LocationAnonymousPage.js +++ b/f2/src/LocationAnonymousPage.js @@ -9,6 +9,7 @@ import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const LocationAnonymousPage = () => { @@ -32,6 +33,7 @@ export const LocationAnonymousPage = () => { { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { location: data } }) history.push(doneForms ? '/confirmation' : '/confirmation') }} diff --git a/f2/src/LocationPage.js b/f2/src/LocationPage.js index 48558b4cf..0bc28dcc7 100644 --- a/f2/src/LocationPage.js +++ b/f2/src/LocationPage.js @@ -12,6 +12,7 @@ import { useStateValue } from './utils/state' import { formatPostalCode } from './utils/formatPostalCode' import { Page } from './components/Page' import { formDefaults } from './forms/defaultValues' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const LocationPage = () => { @@ -48,6 +49,7 @@ export const LocationPage = () => { ) : ( { + editCheck(data, doneForms) data.postalCode = formatPostalCode(data.postalCode) dispatch({ type: 'saveFormData', data: { location: data } }) let isFromAnonymous = history.location.state diff --git a/f2/src/MoneyLostPage.js b/f2/src/MoneyLostPage.js index af6e0aa8e..0e6df2634 100644 --- a/f2/src/MoneyLostPage.js +++ b/f2/src/MoneyLostPage.js @@ -13,6 +13,7 @@ import { whatWasAffectedPages, } from './utils/nextWhatWasAffectedUrl' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const MoneyLostPage = () => { @@ -45,6 +46,7 @@ export const MoneyLostPage = () => { whatWasAffectedNavState.nextPage.nextPageTextInPreviousPage } onSubmit={(data) => { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { moneyLost: data }, diff --git a/f2/src/SuspectCluesPage.js b/f2/src/SuspectCluesPage.js index 7edd27ac2..4971317f6 100644 --- a/f2/src/SuspectCluesPage.js +++ b/f2/src/SuspectCluesPage.js @@ -10,6 +10,7 @@ import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const SuspectCluesPage = () => { @@ -35,6 +36,7 @@ export const SuspectCluesPage = () => { { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { suspectClues: data }, diff --git a/f2/src/WhatHappenedPage.js b/f2/src/WhatHappenedPage.js index 7b08d22cf..ea55605cd 100644 --- a/f2/src/WhatHappenedPage.js +++ b/f2/src/WhatHappenedPage.js @@ -14,6 +14,7 @@ import { useStateValue } from './utils/state' import { Page } from './components/Page' import { Li } from './components/list-item' import { formDefaults } from './forms/defaultValues' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const WhatHappenedPage = () => { @@ -95,6 +96,7 @@ export const WhatHappenedPage = () => { )} { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { whatHappened: data }, diff --git a/f2/src/WhatWasAffected.js b/f2/src/WhatWasAffected.js index e5d8210c5..1a65e0254 100644 --- a/f2/src/WhatWasAffected.js +++ b/f2/src/WhatWasAffected.js @@ -14,6 +14,7 @@ import { orderSelection, } from './utils/nextWhatWasAffectedUrl' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' import { useLog } from './useLog' export const WhatWasAffectedPage = () => { @@ -78,7 +79,7 @@ export const WhatWasAffectedPage = () => { { updateSelection(data.affectedOptions) - + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { whatWasAffected: data }, diff --git a/f2/src/WhenDidItHappenPage.js b/f2/src/WhenDidItHappenPage.js index 3ff3c54fa..69297baba 100644 --- a/f2/src/WhenDidItHappenPage.js +++ b/f2/src/WhenDidItHappenPage.js @@ -10,6 +10,7 @@ import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' export const WhenDidItHappenPage = () => { const [data, dispatch] = useStateValue() @@ -33,6 +34,7 @@ export const WhenDidItHappenPage = () => { { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { whenDidItHappen: data }, diff --git a/f2/src/WhoAreYouReportForPage.js b/f2/src/WhoAreYouReportForPage.js index 7823e780d..9ce6deaec 100644 --- a/f2/src/WhoAreYouReportForPage.js +++ b/f2/src/WhoAreYouReportForPage.js @@ -9,6 +9,7 @@ import { BackButton } from './components/backbutton' import { Stack } from '@chakra-ui/core' import { useStateValue } from './utils/state' import { Page } from './components/Page' +import { editCheck } from './utils/flagFieldEdited' export const WhoAreYouReportForPage = () => { const [data, dispatch] = useStateValue() @@ -27,6 +28,7 @@ export const WhoAreYouReportForPage = () => { { + editCheck(data, doneForms) dispatch({ type: 'saveFormData', data: { whoAreYouReportFor: data }, diff --git a/f2/src/components/EditButton/index.js b/f2/src/components/EditButton/index.js index d26674978..9b5c8f8ce 100644 --- a/f2/src/components/EditButton/index.js +++ b/f2/src/components/EditButton/index.js @@ -5,18 +5,19 @@ import { useLingui } from '@lingui/react' import { Link } from '../link' import { useStateValue } from '../../utils/state' -export const EditButton = ({ path, label }) => { +export const EditButton = (props) => { const { i18n } = useLingui() const [{ submitted }] = useStateValue() + const color = props.edited ? '#7834bc' : null return submitted ? null : ( - + ) } EditButton.propTypes = { - path: PropTypes.string.isRequired, + path: PropTypes.isRequired, label: PropTypes.string.isRequired, } diff --git a/f2/src/components/formik/alert/index.js b/f2/src/components/formik/alert/index.js index 0c2d17885..217b0ab12 100644 --- a/f2/src/components/formik/alert/index.js +++ b/f2/src/components/formik/alert/index.js @@ -124,6 +124,7 @@ export const ErrorSummary = (props) => { href={`#${key}`} marginBottom="0.5rem" color="initial" + visitedColor="initial" onClick={(e) => { e.preventDefault() focusElement(key) diff --git a/f2/src/components/formik/link/index.js b/f2/src/components/formik/link/index.js index e2259cbe9..de5201530 100644 --- a/f2/src/components/formik/link/index.js +++ b/f2/src/components/formik/link/index.js @@ -9,5 +9,9 @@ export const A = styled.a` outline: 0px; box-shadow: 0 0 0 4px rgba(99, 179, 237, 0.6); } + &:visited { + color: ${(props) => + props.visitedColor ? props.visitedColor : '#7834bc'} !important; + } ${fontSize}; ` diff --git a/f2/src/components/link/index.js b/f2/src/components/link/index.js index 8c4583df7..64f259d87 100644 --- a/f2/src/components/link/index.js +++ b/f2/src/components/link/index.js @@ -6,7 +6,7 @@ import { Button } from '../button' import { Link as ChakraLink } from '@chakra-ui/core' //A link using react-router-dom. Useful for internal links. Takes a "to" attribute -export const Link = props => ( +export const Link = (props) => ( ( +export const ButtonLink = (props) => ( @@ -39,7 +39,7 @@ ButtonLink.propTypes = { } // Looks like a link, acts as a button -export const LinkButton = props => ( +export const LinkButton = (props) => ( ( _active={{ boxShadow: 'outline', }} + _visited={{ + color: '#7834bc', + }} > {props.children} @@ -63,7 +66,7 @@ LinkButton.propTypes = { } // An anchor link. needs to contain an HREF. Useful for links outside the app -export const A = props => ( +export const A = (props) => ( ( color: 'blue.hover', }} {...props} + _visited={{ + color: '#7834bc', + }} > {props.children} diff --git a/f2/src/forms/LocationInfoForm.js b/f2/src/forms/LocationInfoForm.js index 2fc3ebdb5..83215c363 100644 --- a/f2/src/forms/LocationInfoForm.js +++ b/f2/src/forms/LocationInfoForm.js @@ -18,6 +18,7 @@ import { WarningModal } from '../components/formik/warningModal' export const LocationInfoForm = (props) => { const [, dispatch] = useStateValue() const [data] = useStateValue() + const { doneForms } = data const locationInfo = { ...formDefaults.location, ...data.formData.location, @@ -89,7 +90,7 @@ export const LocationInfoForm = (props) => { onClick={() => { RemoveData() }} - to="/contactinfo" + to={doneForms ? '/confirmation' : '/contactinfo'} /> diff --git a/f2/src/locales/en.json b/f2/src/locales/en.json index 31f86cb44..c6a7f1386 100644 --- a/f2/src/locales/en.json +++ b/f2/src/locales/en.json @@ -92,6 +92,7 @@ "confirmationPage.devices.nag": "No information provided.", "confirmationPage.devicesTitle": "Devices or accounts", "confirmationPage.devicesTitle.edit": "Edit How might your devices or accounts be affected?", + "confirmationPage.editedTag": "(Edited)", "confirmationPage.evidence.nag": "No information provided.", "confirmationPage.evidence.title": "Supporting evidence", "confirmationPage.evidence.title.edit": "Edit supporting evidence", diff --git a/f2/src/locales/fr.json b/f2/src/locales/fr.json index 8cea9bb50..4820f2fcf 100644 --- a/f2/src/locales/fr.json +++ b/f2/src/locales/fr.json @@ -92,6 +92,7 @@ "confirmationPage.devices.nag": "Aucune information fournie.", "confirmationPage.devicesTitle": "Appareils ou comptes", "confirmationPage.devicesTitle.edit": "Modifier les répercussions sur les appareils ou comptes", + "confirmationPage.editedTag": "(Modifié)", "confirmationPage.evidence.nag": "Aucune information fournie.", "confirmationPage.evidence.title": "Preuves à l’appui", "confirmationPage.evidence.title.edit": "Modifier les preuves à l’appui", diff --git a/f2/src/summary/AnonymousSummary.js b/f2/src/summary/AnonymousSummary.js index 4c3a8a0cd..880ed2b49 100644 --- a/f2/src/summary/AnonymousSummary.js +++ b/f2/src/summary/AnonymousSummary.js @@ -6,7 +6,7 @@ import { Stack, Flex } from '@chakra-ui/core' import { useStateValue } from '../utils/state' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { Text } from '../components/text' export const AnonymousSummary = (props) => { @@ -30,9 +30,15 @@ export const AnonymousSummary = (props) => {

+ {anonymous.edited && ( +

+ +

+ )} diff --git a/f2/src/summary/BusinessInfoSummary.js b/f2/src/summary/BusinessInfoSummary.js index af5810193..e42dbf36d 100644 --- a/f2/src/summary/BusinessInfoSummary.js +++ b/f2/src/summary/BusinessInfoSummary.js @@ -7,7 +7,7 @@ import { useStateValue } from '../utils/state' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { DescriptionListItem } from '../components/DescriptionListItem' import { Text } from '../components/text' @@ -43,10 +43,15 @@ export const BusinessInfoSummary = (props) => {

- + {businessInfo.edited && ( +

+ +

+ )} diff --git a/f2/src/summary/ContactInfoSummary.js b/f2/src/summary/ContactInfoSummary.js index 2995f2ce2..c43086da9 100644 --- a/f2/src/summary/ContactInfoSummary.js +++ b/f2/src/summary/ContactInfoSummary.js @@ -7,7 +7,7 @@ import { useStateValue } from '../utils/state' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { DescriptionListItem } from '../components/DescriptionListItem' import { Text } from '../components/text' @@ -42,9 +42,15 @@ export const ContactInfoSummary = (props) => {

+ {contactInfo.edited && ( +

+ +

+ )} {containsData(contactInfo) ? ( diff --git a/f2/src/summary/DevicesSummary.js b/f2/src/summary/DevicesSummary.js index 7968924a2..287c539cf 100644 --- a/f2/src/summary/DevicesSummary.js +++ b/f2/src/summary/DevicesSummary.js @@ -7,7 +7,7 @@ import { useStateValue } from '../utils/state' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { DescriptionListItem } from '../components/DescriptionListItem' import { Text } from '../components/text' @@ -41,9 +41,15 @@ export const DevicesSummary = (props) => {

+ {devices.edited && ( +

+ +

+ )} diff --git a/f2/src/summary/EvidenceInfoSummary.js b/f2/src/summary/EvidenceInfoSummary.js index ea62ce9a8..683e8d194 100644 --- a/f2/src/summary/EvidenceInfoSummary.js +++ b/f2/src/summary/EvidenceInfoSummary.js @@ -6,7 +6,7 @@ import { Stack, Flex, Box } from '@chakra-ui/core' import { useStateValue } from '../utils/state' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { Text } from '../components/text' export const EvidenceInfoSummary = (props) => { @@ -39,9 +39,15 @@ export const EvidenceInfoSummary = (props) => {

+ {evidence.edited && ( +

+ +

+ )} {evidence.files && evidence.files.length > 0 ? ( diff --git a/f2/src/summary/HowDidItStartSummary.js b/f2/src/summary/HowDidItStartSummary.js index 5581409b5..b0d135a93 100644 --- a/f2/src/summary/HowDidItStartSummary.js +++ b/f2/src/summary/HowDidItStartSummary.js @@ -5,10 +5,9 @@ import { useLingui } from '@lingui/react' import { Trans } from '@lingui/macro' import { Stack, Flex } from '@chakra-ui/core' import { useStateValue } from '../utils/state' -import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { DescriptionListItem } from '../components/DescriptionListItem' import { Text } from '../components/text' import { formatList } from '../utils/formatList' @@ -68,13 +67,19 @@ export const HowDidItStartSummary = (props) => {

+ {howdiditstart.edited && ( +

+ +

+ )} - {containsData(howdiditstart) ? ( + {howdiditstart.howDidTheyReachYou.length ? ( {

+ {personalInformation.edited && ( +

+ +

+ )} diff --git a/f2/src/summary/LocationInfoSummary.js b/f2/src/summary/LocationInfoSummary.js index 3252657de..57037cf17 100644 --- a/f2/src/summary/LocationInfoSummary.js +++ b/f2/src/summary/LocationInfoSummary.js @@ -4,10 +4,9 @@ import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { Stack, Flex } from '@chakra-ui/core' import { useStateValue } from '../utils/state' -import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { DescriptionListItem } from '../components/DescriptionListItem' import { Text } from '../components/text' @@ -41,12 +40,18 @@ export const LocationInfoSummary = (props) => {

+ {location.edited && ( +

+ +

+ )} - {containsData(location) ? ( + {location.city || location.province || location.postalCode ? ( {

+ {moneyLost.edited && ( +

+ +

+ )} diff --git a/f2/src/summary/SuspectCluesSummary.js b/f2/src/summary/SuspectCluesSummary.js index e44e2640f..69ccc3a7d 100644 --- a/f2/src/summary/SuspectCluesSummary.js +++ b/f2/src/summary/SuspectCluesSummary.js @@ -4,10 +4,9 @@ import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { Stack, Flex } from '@chakra-ui/core' import { useStateValue } from '../utils/state' -import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { DescriptionListItem } from '../components/DescriptionListItem' import { Text } from '../components/text' @@ -41,12 +40,20 @@ export const SuspectCluesSummary = (props) => {

+ {suspectClues.edited && ( +

+ +

+ )} - {containsData(suspectClues) ? ( + {suspectClues.suspectClues1 || + suspectClues.suspectClues2 || + suspectClues.suspectClues3 ? ( { @@ -39,13 +38,19 @@ export const WhatHappenedSummary = (props) => {

+ {whatHappened.edited && ( +

+ +

+ )} - {containsData(whatHappened) ? ( + {whatHappened.whatHappened ? ( {whatHappened.whatHappened} ) : ( diff --git a/f2/src/summary/WhatWasAffectedSummary.js b/f2/src/summary/WhatWasAffectedSummary.js index fead0cb89..26f489339 100644 --- a/f2/src/summary/WhatWasAffectedSummary.js +++ b/f2/src/summary/WhatWasAffectedSummary.js @@ -7,7 +7,7 @@ import { useStateValue } from '../utils/state' import { containsData } from '../utils/containsData' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { useLingui } from '@lingui/react' import { Text } from '../components/text' import { formatList } from '../utils/formatList' @@ -52,9 +52,15 @@ export const WhatWasAffectedSummary = (props) => {

+ {impact.edited && ( +

+ +

+ )} {containsData(impact) ? ( diff --git a/f2/src/summary/WhenDidItHappenSummary.js b/f2/src/summary/WhenDidItHappenSummary.js index de3223e8a..3f6d1d46d 100644 --- a/f2/src/summary/WhenDidItHappenSummary.js +++ b/f2/src/summary/WhenDidItHappenSummary.js @@ -4,11 +4,10 @@ import { jsx } from '@emotion/core' import { Trans } from '@lingui/macro' import { Stack, Flex } from '@chakra-ui/core' import { useStateValue } from '../utils/state' -import { containsData } from '../utils/containsData' import { formatDate } from '../utils/formatDate' import { testdata } from '../ConfirmationSummary' import { EditButton } from '../components/EditButton' -import { H2 } from '../components/header' +import { H2, H3 } from '../components/header' import { DescriptionListItem } from '../components/DescriptionListItem' import { Text } from '../components/text' @@ -56,13 +55,19 @@ export const WhenDidItHappenSummary = (props) => {

+ {whenDidItHappen.edited && ( +

+ +

+ )} - {containsData(whenDidItHappen) ? ( + {whenDidItHappen.incidentFrequency ? ( { whenDidItHappen.endYear, )} /> - {containsData(whenDidItHappen.description) ? ( + {whenDidItHappen.description ? ( {

+ {whoAreYouReportFor.edited && ( +

+ +

+ )} diff --git a/f2/src/utils/flagFieldEdited.js b/f2/src/utils/flagFieldEdited.js new file mode 100644 index 000000000..cb3e9ad4a --- /dev/null +++ b/f2/src/utils/flagFieldEdited.js @@ -0,0 +1,11 @@ +export const editCheck = (data, doneForms) => { + if (doneForms) { + data.edited = true + } +} + +export const removeEditFlags = (data) => { + Object.keys(data).forEach((key) => { + delete data[key].edited + }) +}