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

remove submit button if already submitted #1683

Merged
merged 4 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
8 changes: 4 additions & 4 deletions f2/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ app
res.sendFile(path.join(__dirname, 'build', 'index.html'))
})

// uncomment to allow direct loading of arbitrary pages
// .get('/*', function(_req, res) {
// res.sendFile(path.join(__dirname, 'build', 'index.html'))
// })
// uncomment to allow direct loading of arbitrary pages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional for the staging server?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops! good catch!

.get('/*', function(_req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'))
})

const port = process.env.PORT || 3000
console.info(`Listening at port ${port}`)
Expand Down
3 changes: 0 additions & 3 deletions f2/src/ConfirmationPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ const submitToServer = async (data, dispatch) => {
export const ConfirmationPage = () => {
const [{ formData }, dispatch] = useStateValue() // eslint-disable-line no-unused-vars
const { i18n } = useLingui()
if (formData.reportId !== '') {
dispatch({ type: 'saveFormData', data: { reportId: '' } })
}
return (
<Route
render={({ history }) => (
Expand Down
20 changes: 16 additions & 4 deletions f2/src/forms/ConfirmationForm.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
/** @jsx jsx */
import PropTypes from 'prop-types'
import React from 'react'
import { Stack } from '@chakra-ui/core'
import { Trans } from '@lingui/macro'
import { jsx } from '@emotion/core'
import { Form } from 'react-final-form'
import { Well } from '../components/Messages'
import { NextAndCancelButtons } from '../components/next-and-cancel-buttons'
import { Stack } from '@chakra-ui/core'
import { useStateValue } from '../utils/state'

export const ConfirmationForm = props => {
const [{ formData }] = useStateValue()
return (
<React.Fragment>
<Form
Expand All @@ -19,9 +22,18 @@ export const ConfirmationForm = props => {
shouldWrapChildren
spacing={6}
>
<NextAndCancelButtons
button={<Trans id="confirmationPage.nextButton" />}
/>
{formData.submitted ? (
<Well variantColor="blue">
<Trans
id="confirmationPage.thankyou"
values={{ reference: formData.reportId }}
/>
</Well>
) : (
<NextAndCancelButtons
button={<Trans id="confirmationPage.nextButton" />}
/>
)}
</Stack>
)}
/>
Expand Down
3 changes: 2 additions & 1 deletion f2/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"confirmationPage.suspectClues.suspectClues3": "Other suspect clues",
"confirmationPage.suspectClues.title": "Suspect clues",
"confirmationPage.suspectClues.title.edit": "Edit suspect clues",
"confirmationPage.thankyou": "Keep your reference number ({reference}). You can use it to add more detail to your report by calling the Canadian Anti-Fraud Centre at 1-888-495-8501.",
"confirmationPage.title": "Review your report",
"confirmationPage.whatHappened.nag": "No information provided.",
"confirmationPage.whatHappened.title": "What happened?",
Expand Down Expand Up @@ -351,4 +352,4 @@
"whenDidItStart.startDay": "Day",
"whenDidItStart.startMonth": "Month",
"whenDidItStart.startYear": "Year"
}
}
3 changes: 2 additions & 1 deletion f2/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"confirmationPage.suspectClues.suspectClues3": "Autres indices",
"confirmationPage.suspectClues.title": "Indices sur le suspect",
"confirmationPage.suspectClues.title.edit": "Modifier les renseignements sur le suspect",
"confirmationPage.thankyou": "Conservez votre numéro de référence ({reference}). Vous pouvez l’utiliser pour ajouter plus de détail en communiquant avec le Centre antifraude du Canada au 1-888-495-8501.",
"confirmationPage.title": "Révisez votre rapport",
"confirmationPage.whatHappened.nag": "Aucune information fournie.",
"confirmationPage.whatHappened.title": "Que s’est-il passé?",
Expand Down Expand Up @@ -351,4 +352,4 @@
"whenDidItStart.startDay": "Jour",
"whenDidItStart.startMonth": "Mois",
"whenDidItStart.startYear": "Année"
}
}