Browse Source

setup i18n

pull/9/head
Nareshkumar Rao 3 years ago
parent
commit
26329c7a0b
  1. 2
      package.json
  2. 28
      src/i18n.js
  3. 1
      src/index.js
  4. 49
      src/locales/en/common.json
  5. 49
      src/locales/ms/common.json
  6. 41
      src/screens/HomeScreen.js
  7. 12
      src/screens/LockoutScreen.js
  8. 23
      src/screens/LoginScreen.js
  9. 18
      src/screens/ScannerScreen.js
  10. 7
      src/screens/SuccessScreen.js
  11. 8
      src/screens/VerifyScreen.js
  12. 29
      yarn.lock

2
package.json

@ -13,9 +13,11 @@
"axios": "^0.21.1", "axios": "^0.21.1",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"framer-motion": "^4", "framer-motion": "^4",
"i18next": "^20.3.5",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-i18next": "^11.11.4",
"react-icons": "^3.0.0", "react-icons": "^3.0.0",
"react-qr-reader": "^2.2.1", "react-qr-reader": "^2.2.1",
"react-redux": "^7.2.4", "react-redux": "^7.2.4",

28
src/i18n.js

@ -0,0 +1,28 @@
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import enTranslation from "./locales/en/common.json";
import msTranslation from "./locales/ms/common.json";
const resources = {
en: {
common: enTranslation,
},
ms: {
common: msTranslation,
}
};
i18n
.use(initReactI18next)
.init({
resources,
lng: "ms",
defaultNS: 'common',
interpolation: {
escapeValue: false
},
debug:true
});
export default i18n;

1
src/index.js

@ -6,6 +6,7 @@ import App from './App';
import { store } from './app/store'; import { store } from './app/store';
import reportWebVitals from './reportWebVitals'; import reportWebVitals from './reportWebVitals';
import * as serviceWorker from './serviceWorker'; import * as serviceWorker from './serviceWorker';
import "./i18n"
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
require('dotenv').config(); require('dotenv').config();

49
src/locales/en/common.json

@ -0,0 +1,49 @@
{
"appTitle": "OurSejahtera Contact Tracing",
"homeExplanation": "This is your QR code. Show this to others to allow them to confirm a contact, or allow them to create an account!",
"scanButtonLabel": "Scan a QR Code",
"donateButtonLabel": "Donate!",
"donateButtonParagraph": "Servers require money to run, and apps require labor to develop and maintain. You can show your support by donating what you can. Every cent counts, buy me my next coffee, or help pay for a month of server usage!",
"logOutButtonLabel": "Log Out!",
"covidPositiveReportButton": "Report Positive COVID19",
"covidPositiveAlertHeader": "Confirm Tested COVID19 Positive",
"covidPositiveAlertBody": "Please confirm that you have been tested POSITIVE with COVID19. Upon confirmation, this app will inform the people you have come in contact with in the last 7 days.",
"confirm": "Confirm",
"cancel": "Cancel",
"errorToastTitle": "Error!",
"defaultErrorToastDescription": "An error has occured.",
"confirmedToastTitle": "Confirmed!",
"confirmingToastTitle": "Confirming",
"confirmingToastDescription": "Hold on while we confirm with our servers.",
"notLoggedInToastDescription": "You are not logged in!",
"failedLoginToastTitle": "Login Failed",
"failedLoginToastDescription": "The wrong credentials were used",
"loggingInToastTitle": "Logging you in",
"loggingInToastDescription": "Hold on, we're logging you in.",
"checkingLockoutToastTitle": "Checking your lockout status...",
"badVerificationToastTitle": "Bad Verification",
"badQRCodeToastTitle": "Bad QR Code",
"contactLoggedToastTitle": "Contact Successfully Logged",
"checkingQRToastTitle": "Hold on, we're checking this QR code.",
"login": "Login",
"loginPrivacyNotice": "<0><0>Privacy notes:</0> <br/>Telegram Login allows us to verify your identity, without collecting any of your data. Telegram does NOT give us your phone number. The only piece of information stored on our server is your Telegram ID, this is an internal ID Number Telegram uses that is SEPARATE from your Telegram Username.<br/><br/>All the code for this project is <8>Open Source</8>, that means anyone, including you can audit and verify that your information is being handled securely.</0>",
"lockout": "Lockout",
"lockoutExplanation": "<0>You have reported that you have been tested <1>POSITIVE</1> with COVID19. This lockout is to remind you to quarantine yourself according to local COVID19 health policies. This lockout will automatically be lifted after 14 days.<br/><br/><5>Please avoid contact with other people for the duration of this lockout!</5></0>",
"showQRCode": "Show my QR Code",
"contactSavedParagraph": "We have succesfully saved your contact! Stay safe out there, and let others scan your QR code too!",
"returnHomeButtonLabel": "Return home",
"verifyingParagraph": "We are currently verifying you. Please wait.",
"verifyingErrorParagraph": "An error has occured verifying you. Please try scanning the QR code again?"
}

49
src/locales/ms/common.json

@ -0,0 +1,49 @@
{
"appTitle": "OurSejahtera Contact Tracing",
"homeExplanation": "Inilah kod QR anda. Show this to others to allow them to confirm a contact!",
"scanButtonLabel": "Mengimbas kod QR",
"donateButtonLabel": "Menderma!",
"donateButtonParagraph": "Servers require money to run, and apps require labor to develop and maintain. You can show your support by donating what you can. Every cent counts, buy me my next coffee, or help pay for a month of server usage!",
"logOutButtonLabel": "Daftar keluar!",
"covidPositiveReportButton": "Lapor kes COVID19",
"covidPositiveAlertHeader": "Confirm Tested COVID19 Positive",
"covidPositiveAlertBody": "Please confirm that you have been tested POSITIVE with COVID19. Upon confirmation, this app will inform the people you have come in contact with in the last 7 days.",
"confirm": "Confirm",
"cancel": "Cancel",
"errorToastTitle": "Error!",
"defaultErrorToastDescription": "An error has occured.",
"confirmedToastTitle": "Confirmed!",
"confirmingToastTitle": "Confirming",
"confirmingToastDescription": "Hold on while we confirm with our servers.",
"notLoggedInToastDescription": "You are not logged in!",
"failedLoginToastTitle": "Login Failed",
"failedLoginToastDescription": "The wrong credentials were used",
"loggingInToastTitle": "Logging you in",
"loggingInToastDescription": "Hold on, we're logging you in.",
"checkingLockoutToastTitle": "Checking your lockout status...",
"badVerificationToastTitle": "Bad Verification",
"badQRCodeToastTitle": "Bad QR Code",
"contactLoggedToastTitle": "Contact Successfully Logged",
"checkingQRToastTitle": "Hold on, we're checking this QR code.",
"login": "Login",
"loginPrivacyNotice": "<0><0>Privacy notes:</0> <br/>Telegram Login allows us to verify your identity, without collecting any of your data. Telegram does NOT give us your phone number. The only piece of information stored on our server is your Telegram ID, this is an internal ID Number Telegram uses that is SEPARATE from your Telegram Username.<br/><br/>All the code for this project is <8>Open Source</8>, that means anyone, including you can audit and verify that your information is being handled securely.</0>",
"lockout": "Lockout",
"lockoutExplanation": "<0>You have reported that you have been tested <1>POSITIVE</1> with COVID19. This lockout is to remind you to quarantine yourself according to local COVID19 health policies. This lockout will automatically be lifted after 14 days.<br/><br/><5>Please avoid contact with other people for the duration of this lockout!</5></0>",
"showQRCode": "Show my QR Code",
"contactSavedParagraph": "We have succesfully saved your contact! Stay safe out there, and let others scan your QR code too!",
"returnHomeButtonLabel": "Return home",
"verifyingParagraph": "We are currently verifying you. Please wait.",
"verifyingErrorParagraph": "An error has occured verifying you. Please try scanning the QR code again?"
}

41
src/screens/HomeScreen.js

@ -16,6 +16,7 @@ import {
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import axios from 'axios'; import axios from 'axios';
import { Fragment, React, useEffect, useRef, useState } from 'react'; import { Fragment, React, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { Redirect, useHistory } from 'react-router-dom'; import { Redirect, useHistory } from 'react-router-dom';
import { authLogout } from '../features/auth/authSlice'; import { authLogout } from '../features/auth/authSlice';
@ -54,13 +55,14 @@ function ConfirmCOVIDPositiveAlertDialog() {
const toast = useToast(); const toast = useToast();
const history = useHistory(); const history = useHistory();
const dispatch = useDispatch(); const dispatch = useDispatch();
const [t] = useTranslation();
const onClose = () => { const onClose = () => {
setOpen(false); setOpen(false);
}; };
const showErrorToast = (errorMessage = 'An error has occured.') => {
const showErrorToast = (errorMessage = t("defaultErrorToastDescription")) => {
toast.closeAll(); toast.closeAll();
toast({ toast({
title: 'Error!',
title: t("errorToastTitle"),
description: errorMessage, description: errorMessage,
status: 'error', status: 'error',
duration: 5000, duration: 5000,
@ -68,8 +70,8 @@ function ConfirmCOVIDPositiveAlertDialog() {
}; };
const onConfirm = () => { const onConfirm = () => {
toast({ toast({
title: 'Confirming',
description: 'Hold on while we confirm with our servers.',
title: t("confirmingToastTitle"),
description: t("confirmingToastDescription"),
status: 'info', status: 'info',
duration: 10000, duration: 10000,
}); });
@ -86,7 +88,7 @@ function ConfirmCOVIDPositiveAlertDialog() {
dispatch(setCovidPositive()); dispatch(setCovidPositive());
toast.closeAll(); toast.closeAll();
toast({ toast({
title: 'Confirmed!',
title: t("confirmedToastTitle"),
status: 'info', status: 'info',
duration: 2000, duration: 2000,
}); });
@ -98,7 +100,7 @@ function ConfirmCOVIDPositiveAlertDialog() {
console.log(err); console.log(err);
try { try {
if (err.response.status === 401) { if (err.response.status === 401) {
showErrorToast('You are not logged in!');
showErrorToast(t("notLoggedInToastDescription"));
history.push('/login'); history.push('/login');
} else { } else {
showErrorToast(); showErrorToast();
@ -120,7 +122,7 @@ function ConfirmCOVIDPositiveAlertDialog() {
setOpen(true); setOpen(true);
}} }}
> >
Report Positive COVID19
{t("covidPositiveReportButton")}
</Button> </Button>
<AlertDialog <AlertDialog
isOpen={isOpen} isOpen={isOpen}
@ -130,19 +132,17 @@ function ConfirmCOVIDPositiveAlertDialog() {
<AlertDialogOverlay> <AlertDialogOverlay>
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
Confirm Tested COVID19 Positive
{t("covidPositiveAlertHeader")}
</AlertDialogHeader> </AlertDialogHeader>
<AlertDialogBody> <AlertDialogBody>
Please confirm that you have been tested POSITIVE with COVID19.
Upon confirmation, this app will inform the people you have come
in contact with in the last 7 days.
{t("covidPositiveAlertBody")}
</AlertDialogBody> </AlertDialogBody>
<AlertDialogFooter> <AlertDialogFooter>
<Button ref={cancelRef} onClick={onClose}> <Button ref={cancelRef} onClick={onClose}>
Cancel
{t("cancel")}
</Button> </Button>
<Button colorScheme="red" onClick={onConfirm} ml={3}> <Button colorScheme="red" onClick={onConfirm} ml={3}>
Confirm
{t("confirm")}
</Button> </Button>
</AlertDialogFooter> </AlertDialogFooter>
</AlertDialogContent> </AlertDialogContent>
@ -155,6 +155,7 @@ function ConfirmCOVIDPositiveAlertDialog() {
function Home() { function Home() {
const history = useHistory(); const history = useHistory();
const dispatch = useDispatch(); const dispatch = useDispatch();
const [t] = useTranslation();
const handleLogout = () => { const handleLogout = () => {
dispatch(authLogout()); dispatch(authLogout());
@ -198,8 +199,7 @@ function Home() {
> >
<QRCode /> <QRCode />
<Text mb={6} align="center" fontSize="lg"> <Text mb={6} align="center" fontSize="lg">
This is your QR code. Show this to others to allow them to confirm a
contact, or allow them to create an account!
{t("homeExplanation")}
</Text> </Text>
<Divider mb={6} /> <Divider mb={6} />
<Button <Button
@ -208,21 +208,18 @@ function Home() {
history.push('/scanner'); history.push('/scanner');
}} }}
> >
Scan a QR Code
{t("scanButtonLabel")}
</Button> </Button>
{process.env.REACT_APP_DONATE_LINK && ( {process.env.REACT_APP_DONATE_LINK && (
<Fragment> <Fragment>
<Divider mb={6} /> <Divider mb={6} />
<Link href={process.env.REACT_APP_DONATE_LINK}> <Link href={process.env.REACT_APP_DONATE_LINK}>
<Button style={{ width: '100% ' }} mb={6} colorScheme="blue"> <Button style={{ width: '100% ' }} mb={6} colorScheme="blue">
Donate!
{t("donateButtonlabel")}
</Button> </Button>
</Link> </Link>
<Text mb={6}> <Text mb={6}>
Servers require money to run, and apps require labor to develop
and maintain. You can show your support by donating what you can.
Every cent counts, buy me my next coffee, or help pay for a month
of server usage!
{t("donateButtonParagraph")}
</Text> </Text>
</Fragment> </Fragment>
)} )}
@ -230,7 +227,7 @@ function Home() {
<ConfirmCOVIDPositiveAlertDialog /> <ConfirmCOVIDPositiveAlertDialog />
<Divider mb={6} /> <Divider mb={6} />
<Button colorScheme="blackAlpha" mb={6} onClick={handleLogout}> <Button colorScheme="blackAlpha" mb={6} onClick={handleLogout}>
Log Out!
{t("logOutButtonLabel")}
</Button> </Button>
</Flex> </Flex>
</Flex> </Flex>

12
src/screens/LockoutScreen.js

@ -1,6 +1,7 @@
import { Flex, Heading, Text, useToast } from '@chakra-ui/react'; import { Flex, Heading, Text, useToast } from '@chakra-ui/react';
import axios from 'axios'; import axios from 'axios';
import { useEffect } from 'react'; import { useEffect } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { Redirect, useHistory } from 'react-router-dom'; import { Redirect, useHistory } from 'react-router-dom';
import { authLogout } from '../features/auth/authSlice'; import { authLogout } from '../features/auth/authSlice';
@ -15,10 +16,11 @@ function Lockout() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const history = useHistory(); const history = useHistory();
const toast = useToast(); const toast = useToast();
const [t] = useTranslation();
useEffect(() => { useEffect(() => {
toast({ toast({
title: 'Checking your lockout status...',
title: t("checkingLockoutToastTitle"),
status: 'info', status: 'info',
duration: 10000, duration: 10000,
}); });
@ -44,14 +46,14 @@ function Lockout() {
history.push('/login'); history.push('/login');
} else { } else {
toast({ toast({
title: 'Server Error Occurred',
title: t("defaultErrorToastDescription"),
status: 'error', status: 'error',
duration: 10000, duration: 10000,
}); });
} }
} catch (e) {} } catch (e) {}
}); });
}, [dispatch, history, toast]);
}, [dispatch, history, toast, t]);
if (!isAuthenticated) return <Redirect to="/login" />; if (!isAuthenticated) return <Redirect to="/login" />;
if (!isCovidPositive) return <Redirect to="/home" />; if (!isCovidPositive) return <Redirect to="/home" />;
@ -72,7 +74,8 @@ function Lockout() {
rounded={6} rounded={6}
id="contentFlex" id="contentFlex"
> >
<Heading>Lockout</Heading>
<Heading>{t("Lockout")}</Heading>
<Trans i18nKey="lockoutExplanation">
<Text> <Text>
You have reported that you have been tested <b>POSITIVE</b> with You have reported that you have been tested <b>POSITIVE</b> with
COVID19. This lockout is to remind you to quarantine yourself COVID19. This lockout is to remind you to quarantine yourself
@ -85,6 +88,7 @@ function Lockout() {
lockout! lockout!
</b> </b>
</Text> </Text>
</Trans>
</Flex> </Flex>
</Flex> </Flex>
); );

23
src/screens/LoginScreen.js

@ -1,6 +1,8 @@
import { Divider, Flex, Heading, Link, Text, useToast } from '@chakra-ui/react'; import { Divider, Flex, Heading, Link, Text, useToast } from '@chakra-ui/react';
import axios from 'axios'; import axios from 'axios';
import { React } from 'react'; import { React } from 'react';
import { useTranslation } from 'react-i18next';
import { Trans } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { Redirect, useHistory } from 'react-router-dom'; import { Redirect, useHistory } from 'react-router-dom';
import TelegramLoginButton from 'react-telegram-login'; import TelegramLoginButton from 'react-telegram-login';
@ -10,14 +12,15 @@ function Login() {
const toast = useToast(); const toast = useToast();
const history = useHistory(); const history = useHistory();
const dispatch = useDispatch(); const dispatch = useDispatch();
const [t] = useTranslation();
const isAuthenticated = useSelector(state => state.auth.isAuthenticated); const isAuthenticated = useSelector(state => state.auth.isAuthenticated);
if (isAuthenticated) return <Redirect to="/home" />; if (isAuthenticated) return <Redirect to="/home" />;
const handleTelegramResponse = response => { const handleTelegramResponse = response => {
toast({ toast({
title: 'Logging you in',
description: "Hold on, we're logging you in.",
title: t("loggingInToastTitle"),
description: t("loggingInToastDescription"),
status: 'info', status: 'info',
duration: 10000, duration: 10000,
isClosable: false, isClosable: false,
@ -45,7 +48,7 @@ function Login() {
toast.closeAll(); toast.closeAll();
dispatch(authLogout()); dispatch(authLogout());
toast({ toast({
title: 'An error occurred',
title: t("defaultErrorToastDescription"),
description: response.data.message, description: response.data.message,
status: 'error', status: 'error',
duration: 9000, duration: 9000,
@ -59,8 +62,8 @@ function Login() {
if (err.response.status === 401) { if (err.response.status === 401) {
dispatch(authLogout()); dispatch(authLogout());
toast({ toast({
title: 'Login Failed',
description: 'The wrong credentials were used.',
title: t("failedLoginToastTitle"),
description: t("failedLoginToastDescription"),
status: 'error', status: 'error',
duration: 9000, duration: 9000,
isClosable: true, isClosable: true,
@ -68,8 +71,8 @@ function Login() {
} }
} else { } else {
toast({ toast({
title: 'An error occurred',
description: 'Sorry, an error occurred on our side.',
title: t("errorToastTitle"),
description: t("defaultErrorToastDescription"),
status: 'error', status: 'error',
duration: 9000, duration: 9000,
isClosable: true, isClosable: true,
@ -95,16 +98,17 @@ function Login() {
id="contentFlex" id="contentFlex"
> >
<Heading size="xl" mb={6}> <Heading size="xl" mb={6}>
OurSejahtera Contact Tracing
{t("appTitle")}
</Heading> </Heading>
<Heading size="lg" mb={4}> <Heading size="lg" mb={4}>
Login
{t("login")}
</Heading> </Heading>
<TelegramLoginButton <TelegramLoginButton
dataOnauth={handleTelegramResponse} dataOnauth={handleTelegramResponse}
botName={process.env.REACT_APP_TELEGRAM_BOT_NAME} botName={process.env.REACT_APP_TELEGRAM_BOT_NAME}
/> />
<Divider mb={6} mt={6} /> <Divider mb={6} mt={6} />
<Trans i18nKey="loginPrivacyNotice">
<Text fontSize="sm"> <Text fontSize="sm">
<b>Privacy notes:</b> <br /> <b>Privacy notes:</b> <br />
Telegram Login allows us to verify your identity, without collecting Telegram Login allows us to verify your identity, without collecting
@ -125,6 +129,7 @@ function Login() {
, that means anyone, including you can audit and verify that your , that means anyone, including you can audit and verify that your
information is being handled securely. information is being handled securely.
</Text> </Text>
</Trans>
</Flex> </Flex>
</Flex> </Flex>
); );

18
src/screens/ScannerScreen.js

@ -1,6 +1,7 @@
import { Button, Divider, Flex, useToast } from '@chakra-ui/react'; import { Button, Divider, Flex, useToast } from '@chakra-ui/react';
import axios from 'axios'; import axios from 'axios';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import QrReader from 'react-qr-reader'; import QrReader from 'react-qr-reader';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { Redirect, useHistory } from 'react-router-dom'; import { Redirect, useHistory } from 'react-router-dom';
@ -11,6 +12,7 @@ function Scanner() {
const toast = useToast(); const toast = useToast();
const history = useHistory(); const history = useHistory();
const dispatch = useDispatch(); const dispatch = useDispatch();
const [t] = useTranslation();
const [scanData, setScanData] = useState(null); const [scanData, setScanData] = useState(null);
@ -32,8 +34,7 @@ function Scanner() {
const hash = re.exec(scanData); const hash = re.exec(scanData);
if (hash) { if (hash) {
toast({ toast({
title: 'Checking QR code.',
description: "Hold on, we're checking this QR code.",
title: t("checkingQRToastTitle"),
status: 'info', status: 'info',
duration: 10000, duration: 10000,
isClosable: false, isClosable: false,
@ -51,14 +52,13 @@ function Scanner() {
if (res.data.loggedIn) { if (res.data.loggedIn) {
toast.closeAll(); toast.closeAll();
toast({ toast({
title: 'Contact Succesfully Logged',
title: t("contactLoggedToastTitle"),
status: 'info', status: 'info',
duration: 2000, duration: 2000,
}); });
} else { } else {
toast({ toast({
title: "You're not logged in!",
description: 'Please log in and try again!',
title: t("notLoggedInToastDescription"),
status: 'error', status: 'error',
duration: 2000, duration: 2000,
}); });
@ -70,7 +70,7 @@ function Scanner() {
.catch(e => { .catch(e => {
toast.closeAll(); toast.closeAll();
toast({ toast({
title: 'Bad Verification',
title: t("badVerificationToastTitle"),
status: 'error', status: 'error',
duration: 2000, duration: 2000,
}); });
@ -78,14 +78,14 @@ function Scanner() {
} else { } else {
toast.closeAll(); toast.closeAll();
toast({ toast({
title: 'Bad QR code',
title: t("badQRCodeToastTitle"),
status: 'error', status: 'error',
duration: 3000, duration: 3000,
isClosable: true, isClosable: true,
}); });
} }
} }
}, [scanData, dispatch, history, toast]);
}, [scanData, dispatch, history, toast, t]);
const isAuthenticated = useSelector(state => state.auth.isAuthenticated); const isAuthenticated = useSelector(state => state.auth.isAuthenticated);
const isCovidPositive = useSelector(state => state.covid.isCovidPositive); const isCovidPositive = useSelector(state => state.covid.isCovidPositive);
@ -135,7 +135,7 @@ function Scanner() {
history.push('/home'); history.push('/home');
}} }}
> >
Show my QR Code
{t("showQRCode")}
</Button> </Button>
</Flex> </Flex>
</Flex> </Flex>

7
src/screens/SuccessScreen.js

@ -1,8 +1,10 @@
import { Button, Flex, Heading, Text } from '@chakra-ui/react'; import { Button, Flex, Heading, Text } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
function Success() { function Success() {
const history = useHistory(); const history = useHistory();
const [t] = useTranslation();
return ( return (
<Flex <Flex
@ -21,15 +23,14 @@ function Success() {
> >
<Heading>Success!</Heading> <Heading>Success!</Heading>
<Text fontSize="lg"> <Text fontSize="lg">
We have succesfully saved your contact! Stay safe out there, and let
others scan your QR code too!
{t("contactSavedParagraph")}
</Text> </Text>
<Button <Button
onClick={() => { onClick={() => {
history.push('/home'); history.push('/home');
}} }}
> >
Return home
{t("returnHomeButtonLabel")}
</Button> </Button>
</Flex> </Flex>
</Flex> </Flex>

8
src/screens/VerifyScreen.js

@ -1,12 +1,14 @@
import { Flex, Text } from '@chakra-ui/react'; import { Flex, Text } from '@chakra-ui/react';
import axios from 'axios'; import axios from 'axios';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
function Verify(props) { function Verify(props) {
const verifyID = props.match.params.id; const verifyID = props.match.params.id;
const [verifyError, setVerifyError] = useState(false); const [verifyError, setVerifyError] = useState(false);
const history = useHistory(); const history = useHistory();
const [t] = useTranslation();
useEffect(() => { useEffect(() => {
if (verifyError) return; if (verifyError) return;
@ -33,12 +35,10 @@ function Verify(props) {
}, [verifyError, history, verifyID]); }, [verifyError, history, verifyID]);
const errorMessage = ( const errorMessage = (
<Text>
An error has occured verifying you. Please try scanning the QR code again?
</Text>
<Text>{t("verifyingErrorParagraph")}</Text>
); );
const loadingMessage = ( const loadingMessage = (
<Text>We are currently verifying you. Please wait.</Text>
<Text>{t("verifyingParagraph")}</Text>
); );
return ( return (

29
yarn.lock

@ -1091,7 +1091,7 @@
dependencies: dependencies:
regenerator-runtime "^0.13.4" regenerator-runtime "^0.13.4"
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.9.2":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.14.5", "@babel/runtime@^7.9.2":
version "7.14.8" version "7.14.8"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.8.tgz#7119a56f421018852694290b9f9148097391b446" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.8.tgz#7119a56f421018852694290b9f9148097391b446"
integrity sha512-twj3L8Og5SaCRCErB4x4ajbvBIVV77CGeFglHpeg5WC5FF8TZzBWXtTJ4MqaD9QszLYTtr+IsaAL2rEUevb+eg== integrity sha512-twj3L8Og5SaCRCErB4x4ajbvBIVV77CGeFglHpeg5WC5FF8TZzBWXtTJ4MqaD9QszLYTtr+IsaAL2rEUevb+eg==
@ -6336,6 +6336,13 @@ html-minifier-terser@^5.0.1:
relateurl "^0.2.7" relateurl "^0.2.7"
terser "^4.6.3" terser "^4.6.3"
html-parse-stringify@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz#dfc1017347ce9f77c8141a507f233040c59c55d2"
integrity sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==
dependencies:
void-elements "3.1.0"
html-webpack-plugin@4.5.0: html-webpack-plugin@4.5.0:
version "4.5.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.5.0.tgz#625097650886b97ea5dae331c320e3238f6c121c" resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.5.0.tgz#625097650886b97ea5dae331c320e3238f6c121c"
@ -6443,6 +6450,13 @@ human-signals@^1.1.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
i18next@^20.3.5:
version "20.3.5"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-20.3.5.tgz#14308b79a3f1cafb24fdcd8e182d3673baf1e979"
integrity sha512-//MGeU6n4TencJmCgG+TCrpdgAD/NDEU/KfKQekYbJX6QV7sD/NjWQdVdBi+bkT0snegnSoB7QhjSeatrk3a0w==
dependencies:
"@babel/runtime" "^7.12.0"
iconv-lite@0.4.24: iconv-lite@0.4.24:
version "0.4.24" version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
@ -9913,6 +9927,14 @@ react-focus-lock@2.5.0:
use-callback-ref "^1.2.1" use-callback-ref "^1.2.1"
use-sidecar "^1.0.1" use-sidecar "^1.0.1"
react-i18next@^11.11.4:
version "11.11.4"
resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.11.4.tgz#f6f9a1c827e7a5271377de2bf14db04cb1c9e5ce"
integrity sha512-ayWFlu8Sc7GAxW1PzMaPtzq+yiozWMxs0P1WeITNVzXAVRhC0Httkzw/IiODBta6seJRBCLrtUeFUSXhAIxlRg==
dependencies:
"@babel/runtime" "^7.14.5"
html-parse-stringify "^3.0.1"
react-icons@^3.0.0: react-icons@^3.0.0:
version "3.11.0" version "3.11.0"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-3.11.0.tgz#2ca2903dfab8268ca18ebd8cc2e879921ec3b254" resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-3.11.0.tgz#2ca2903dfab8268ca18ebd8cc2e879921ec3b254"
@ -12019,6 +12041,11 @@ vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
void-elements@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-3.1.0.tgz#614f7fbf8d801f0bb5f0661f5b2f5785750e4f09"
integrity sha1-YU9/v42AHwu18GYfWy9XhXUOTwk=
w3c-hr-time@^1.0.2: w3c-hr-time@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"

Loading…
Cancel
Save