Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Update confirmation #2443

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a055e22
Update package-lock.json
justinr86 Oct 2, 2020
0beddd7
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 6, 2020
061798f
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 8, 2020
5a9d8f5
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 8, 2020
a5a5783
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 8, 2020
5e00778
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 9, 2020
2e2d58c
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 13, 2020
59a3d12
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 14, 2020
05bab20
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 14, 2020
1cd2034
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 15, 2020
d0a73b2
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 16, 2020
04aefb8
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 19, 2020
09865fa
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 20, 2020
243d577
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 22, 2020
5872c0d
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 23, 2020
deb29b0
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 26, 2020
c825585
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 26, 2020
adf8d98
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 27, 2020
d9e92ec
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 27, 2020
a075716
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 28, 2020
1e32f07
Merge branch 'master' of https://github.com/cds-snc/report-a-cybercrime
justinr86 Oct 28, 2020
0f2b10e
Indicate field has been modified in confirmation summary
justinr86 Oct 29, 2020
11b55b3
Indicate field has been modified in confirmation summary
justinr86 Oct 29, 2020
cd0d4e0
Merge branch 'master' into update-confirmation
justinr86 Oct 29, 2020
ed116ea
Remove unused import
justinr86 Oct 30, 2020
6023496
Merge branch 'master' into update-confirmation
justinr86 Oct 30, 2020
3c038be
Merge conflicts
justinr86 Oct 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions f2/src/AnonymousPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -36,6 +37,7 @@ export const AnonymousPage = () => {
</Lead>
<AnonymousInfoForm
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { anonymous: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/BusinessPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -45,6 +46,7 @@ export const BusinessPage = () => {
whatWasAffectedNavState.nextPage.nextPageTextInPreviousPage
}
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { businessInfo: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/ConfirmationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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] = {
Expand Down
5 changes: 4 additions & 1 deletion f2/src/ContactInfoPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Route
Expand All @@ -31,6 +33,7 @@ export const ContactInfoPage = () => {

<ContactInfoForm
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { contactInfo: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/DevicesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -46,6 +47,7 @@ export const DevicesPage = () => {
whatWasAffectedNavState.nextPage.nextPageTextInPreviousPage
}
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { devicesInfo: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/EvidencePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -56,6 +57,7 @@ export const EvidencePage = () => {

<EvidenceInfoForm
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({ type: 'saveFormData', data: { evidence: data } })
history.push(doneForms ? '/confirmation' : '/location')
}}
Expand Down
3 changes: 2 additions & 1 deletion f2/src/HowDidItStartPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -34,8 +35,8 @@ export const HowDidItStartPage = () => {
</Stack>

<HowDidItStartForm
history={history}
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { howdiditstart: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/InformationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -47,6 +48,7 @@ export const InformationPage = () => {
whatWasAffectedNavState.nextPage.nextPageTextInPreviousPage
}
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { personalInformation: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/LocationAnonymousPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -32,6 +33,7 @@ export const LocationAnonymousPage = () => {

<LocationAnonymousInfoForm
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({ type: 'saveFormData', data: { location: data } })
history.push(doneForms ? '/confirmation' : '/confirmation')
}}
Expand Down
2 changes: 2 additions & 0 deletions f2/src/LocationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -48,6 +49,7 @@ export const LocationPage = () => {
) : (
<LocationInfoForm
onSubmit={(data) => {
editCheck(data, doneForms)
data.postalCode = formatPostalCode(data.postalCode)
dispatch({ type: 'saveFormData', data: { location: data } })
let isFromAnonymous = history.location.state
Expand Down
2 changes: 2 additions & 0 deletions f2/src/MoneyLostPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -45,6 +46,7 @@ export const MoneyLostPage = () => {
whatWasAffectedNavState.nextPage.nextPageTextInPreviousPage
}
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { moneyLost: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/SuspectCluesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -35,6 +36,7 @@ export const SuspectCluesPage = () => {

<SuspectCluesForm
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { suspectClues: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/WhatHappenedPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -95,6 +96,7 @@ export const WhatHappenedPage = () => {
)}
<WhatHappenedForm
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { whatHappened: data },
Expand Down
3 changes: 2 additions & 1 deletion f2/src/WhatWasAffected.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -78,7 +79,7 @@ export const WhatWasAffectedPage = () => {
<WhatWasAffectedForm
onSubmit={(data) => {
updateSelection(data.affectedOptions)

editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { whatWasAffected: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/WhenDidItHappenPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -33,6 +34,7 @@ export const WhenDidItHappenPage = () => {

<WhenDidItHappenForm
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { whenDidItHappen: data },
Expand Down
2 changes: 2 additions & 0 deletions f2/src/WhoAreYouReportForPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -27,6 +28,7 @@ export const WhoAreYouReportForPage = () => {

<WhoAreYouReportForForm
onSubmit={(data) => {
editCheck(data, doneForms)
dispatch({
type: 'saveFormData',
data: { whoAreYouReportFor: data },
Expand Down
7 changes: 4 additions & 3 deletions f2/src/components/EditButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 : (
<Link to={path} aria-label={i18n._(label)} ml={4}>
<Link to={props.path} aria-label={i18n._(props.label)} ml={4} color={color}>
<Trans id="button.edit" />
</Link>
)
}

EditButton.propTypes = {
path: PropTypes.string.isRequired,
path: PropTypes.isRequired,
label: PropTypes.string.isRequired,
}
1 change: 1 addition & 0 deletions f2/src/components/formik/alert/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export const ErrorSummary = (props) => {
href={`#${key}`}
marginBottom="0.5rem"
color="initial"
visitedColor="initial"
onClick={(e) => {
e.preventDefault()
focusElement(key)
Expand Down
4 changes: 4 additions & 0 deletions f2/src/components/formik/link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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};
`
14 changes: 10 additions & 4 deletions f2/src/components/link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => (
<ChakraLink
as={ReactRouterLink}
color="blue.700"
Expand All @@ -27,7 +27,7 @@ Link.propTypes = {
}

// Looks like a button, acts as a link
export const ButtonLink = props => (
export const ButtonLink = (props) => (
<Button {...props} as={ReactRouterLink} role="button">
{props.children}
</Button>
Expand All @@ -39,7 +39,7 @@ ButtonLink.propTypes = {
}

// Looks like a link, acts as a button
export const LinkButton = props => (
export const LinkButton = (props) => (
<ChakraLink
color="blue.700"
textDecoration="underline"
Expand All @@ -52,6 +52,9 @@ export const LinkButton = props => (
_active={{
boxShadow: 'outline',
}}
_visited={{
color: '#7834bc',
}}
>
{props.children}
</ChakraLink>
Expand All @@ -63,14 +66,17 @@ LinkButton.propTypes = {
}

// An anchor link. needs to contain an HREF. Useful for links outside the app
export const A = props => (
export const A = (props) => (
<ChakraLink
color="blue.700"
textDecoration="underline"
_hover={{
color: 'blue.hover',
}}
{...props}
_visited={{
color: '#7834bc',
}}
>
{props.children}
</ChakraLink>
Expand Down
3 changes: 2 additions & 1 deletion f2/src/forms/LocationInfoForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -89,7 +90,7 @@ export const LocationInfoForm = (props) => {
onClick={() => {
RemoveData()
}}
to="/contactinfo"
to={doneForms ? '/confirmation' : '/contactinfo'}
/>
</FormRow>
<FormRow>
Expand Down
1 change: 1 addition & 0 deletions f2/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions f2/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading