From 16bdd7590362edf4d297eee8193f51dd1c4ac3d6 Mon Sep 17 00:00:00 2001 From: Nareshkumar Rao Date: Fri, 13 Aug 2021 01:47:06 +0200 Subject: [PATCH] ran linter --- src/i18n.js | 32 ++++++------ src/index.js | 2 +- src/locales/en/common.json | 96 ++++++++++++++++++------------------ src/locales/ms/common.json | 96 ++++++++++++++++++------------------ src/screens/HomeScreen.js | 36 ++++++-------- src/screens/LockoutScreen.js | 30 +++++------ src/screens/LoginScreen.js | 58 +++++++++++----------- src/screens/ScannerScreen.js | 12 ++--- src/screens/SuccessScreen.js | 6 +-- src/screens/VerifyScreen.js | 8 +-- 10 files changed, 182 insertions(+), 194 deletions(-) diff --git a/src/i18n.js b/src/i18n.js index 671a87c..ef0a2e6 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -1,8 +1,8 @@ -import i18n from "i18next"; -import { initReactI18next } from "react-i18next"; +import i18n from 'i18next'; +import { initReactI18next } from 'react-i18next'; -import enTranslation from "./locales/en/common.json"; -import msTranslation from "./locales/ms/common.json"; +import enTranslation from './locales/en/common.json'; +import msTranslation from './locales/ms/common.json'; const resources = { en: { @@ -10,19 +10,17 @@ const resources = { }, ms: { common: msTranslation, - } + }, }; -i18n - .use(initReactI18next) - .init({ - resources, - lng: "ms", - defaultNS: 'common', - interpolation: { - escapeValue: false - }, - debug:true - }); +i18n.use(initReactI18next).init({ + resources, + lng: 'ms', + defaultNS: 'common', + interpolation: { + escapeValue: false, + }, + debug: true, +}); - export default i18n; \ No newline at end of file +export default i18n; diff --git a/src/index.js b/src/index.js index 1633881..bcf46b0 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,7 @@ import App from './App'; import { store } from './app/store'; import reportWebVitals from './reportWebVitals'; import * as serviceWorker from './serviceWorker'; -import "./i18n" +import './i18n'; import { Provider } from 'react-redux'; require('dotenv').config(); diff --git a/src/locales/en/common.json b/src/locales/en/common.json index 5edd55c..e1443d1 100644 --- a/src/locales/en/common.json +++ b/src/locales/en/common.json @@ -1,49 +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:
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.

All the code for this project is <8>Open Source, that means anyone, including you can audit and verify that your information is being handled securely.", - - "lockout": "Lockout", - "lockoutExplanation": "<0>You have reported that you have been tested <1>POSITIVE 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.

<5>Please avoid contact with other people for the duration of this lockout!", - - "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?" -} \ No newline at end of file + "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:
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.

All the code for this project is <8>Open Source, that means anyone, including you can audit and verify that your information is being handled securely.", + + "lockout": "Lockout", + "lockoutExplanation": "<0>You have reported that you have been tested <1>POSITIVE 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.

<5>Please avoid contact with other people for the duration of this lockout!", + + "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?" +} diff --git a/src/locales/ms/common.json b/src/locales/ms/common.json index 992d36f..8ba65e1 100644 --- a/src/locales/ms/common.json +++ b/src/locales/ms/common.json @@ -1,49 +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:
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.

All the code for this project is <8>Open Source, that means anyone, including you can audit and verify that your information is being handled securely.", - - "lockout": "Lockout", - "lockoutExplanation": "<0>You have reported that you have been tested <1>POSITIVE 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.

<5>Please avoid contact with other people for the duration of this lockout!", - - "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?" -} \ No newline at end of file + "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:
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.

All the code for this project is <8>Open Source, that means anyone, including you can audit and verify that your information is being handled securely.", + + "lockout": "Lockout", + "lockoutExplanation": "<0>You have reported that you have been tested <1>POSITIVE 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.

<5>Please avoid contact with other people for the duration of this lockout!", + + "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?" +} diff --git a/src/screens/HomeScreen.js b/src/screens/HomeScreen.js index 6c60708..901ab9a 100644 --- a/src/screens/HomeScreen.js +++ b/src/screens/HomeScreen.js @@ -59,10 +59,10 @@ function ConfirmCOVIDPositiveAlertDialog() { const onClose = () => { setOpen(false); }; - const showErrorToast = (errorMessage = t("defaultErrorToastDescription")) => { + const showErrorToast = (errorMessage = t('defaultErrorToastDescription')) => { toast.closeAll(); toast({ - title: t("errorToastTitle"), + title: t('errorToastTitle'), description: errorMessage, status: 'error', duration: 5000, @@ -70,8 +70,8 @@ function ConfirmCOVIDPositiveAlertDialog() { }; const onConfirm = () => { toast({ - title: t("confirmingToastTitle"), - description: t("confirmingToastDescription"), + title: t('confirmingToastTitle'), + description: t('confirmingToastDescription'), status: 'info', duration: 10000, }); @@ -88,7 +88,7 @@ function ConfirmCOVIDPositiveAlertDialog() { dispatch(setCovidPositive()); toast.closeAll(); toast({ - title: t("confirmedToastTitle"), + title: t('confirmedToastTitle'), status: 'info', duration: 2000, }); @@ -100,7 +100,7 @@ function ConfirmCOVIDPositiveAlertDialog() { console.log(err); try { if (err.response.status === 401) { - showErrorToast(t("notLoggedInToastDescription")); + showErrorToast(t('notLoggedInToastDescription')); history.push('/login'); } else { showErrorToast(); @@ -122,7 +122,7 @@ function ConfirmCOVIDPositiveAlertDialog() { setOpen(true); }} > - {t("covidPositiveReportButton")} + {t('covidPositiveReportButton')} - {t("covidPositiveAlertHeader")} + {t('covidPositiveAlertHeader')} - - {t("covidPositiveAlertBody")} - + {t('covidPositiveAlertBody')} @@ -199,7 +197,7 @@ function Home() { > - {t("homeExplanation")} + {t('homeExplanation')} {process.env.REACT_APP_DONATE_LINK && ( - - {t("donateButtonParagraph")} - + {t('donateButtonParagraph')} )} diff --git a/src/screens/LockoutScreen.js b/src/screens/LockoutScreen.js index 78280c6..1cbbf93 100644 --- a/src/screens/LockoutScreen.js +++ b/src/screens/LockoutScreen.js @@ -20,7 +20,7 @@ function Lockout() { useEffect(() => { toast({ - title: t("checkingLockoutToastTitle"), + title: t('checkingLockoutToastTitle'), status: 'info', duration: 10000, }); @@ -46,7 +46,7 @@ function Lockout() { history.push('/login'); } else { toast({ - title: t("defaultErrorToastDescription"), + title: t('defaultErrorToastDescription'), status: 'error', duration: 10000, }); @@ -74,20 +74,20 @@ function Lockout() { rounded={6} id="contentFlex" > - {t("Lockout")} + {t('Lockout')} - - You have reported that you have been tested POSITIVE 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. -
-
- - Please avoid contact with other people for the duration of this - lockout! - -
+ + You have reported that you have been tested POSITIVE 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. +
+
+ + Please avoid contact with other people for the duration of this + lockout! + +
diff --git a/src/screens/LoginScreen.js b/src/screens/LoginScreen.js index a4e5800..004c005 100644 --- a/src/screens/LoginScreen.js +++ b/src/screens/LoginScreen.js @@ -19,8 +19,8 @@ function Login() { const handleTelegramResponse = response => { toast({ - title: t("loggingInToastTitle"), - description: t("loggingInToastDescription"), + title: t('loggingInToastTitle'), + description: t('loggingInToastDescription'), status: 'info', duration: 10000, isClosable: false, @@ -48,7 +48,7 @@ function Login() { toast.closeAll(); dispatch(authLogout()); toast({ - title: t("defaultErrorToastDescription"), + title: t('defaultErrorToastDescription'), description: response.data.message, status: 'error', duration: 9000, @@ -62,8 +62,8 @@ function Login() { if (err.response.status === 401) { dispatch(authLogout()); toast({ - title: t("failedLoginToastTitle"), - description: t("failedLoginToastDescription"), + title: t('failedLoginToastTitle'), + description: t('failedLoginToastDescription'), status: 'error', duration: 9000, isClosable: true, @@ -71,8 +71,8 @@ function Login() { } } else { toast({ - title: t("errorToastTitle"), - description: t("defaultErrorToastDescription"), + title: t('errorToastTitle'), + description: t('defaultErrorToastDescription'), status: 'error', duration: 9000, isClosable: true, @@ -98,10 +98,10 @@ function Login() { id="contentFlex" > - {t("appTitle")} + {t('appTitle')} - {t("login")} + {t('login')} - - Privacy notes:
- 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. -
-
- All the code for this project is{' '} - - Open Source - - , that means anyone, including you can audit and verify that your - information is being handled securely. -
+ + Privacy notes:
+ 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. +
+
+ All the code for this project is{' '} + + Open Source + + , that means anyone, including you can audit and verify that your + information is being handled securely. +
diff --git a/src/screens/ScannerScreen.js b/src/screens/ScannerScreen.js index 3afcf26..0d4a47b 100644 --- a/src/screens/ScannerScreen.js +++ b/src/screens/ScannerScreen.js @@ -34,7 +34,7 @@ function Scanner() { const hash = re.exec(scanData); if (hash) { toast({ - title: t("checkingQRToastTitle"), + title: t('checkingQRToastTitle'), status: 'info', duration: 10000, isClosable: false, @@ -52,13 +52,13 @@ function Scanner() { if (res.data.loggedIn) { toast.closeAll(); toast({ - title: t("contactLoggedToastTitle"), + title: t('contactLoggedToastTitle'), status: 'info', duration: 2000, }); } else { toast({ - title: t("notLoggedInToastDescription"), + title: t('notLoggedInToastDescription'), status: 'error', duration: 2000, }); @@ -70,7 +70,7 @@ function Scanner() { .catch(e => { toast.closeAll(); toast({ - title: t("badVerificationToastTitle"), + title: t('badVerificationToastTitle'), status: 'error', duration: 2000, }); @@ -78,7 +78,7 @@ function Scanner() { } else { toast.closeAll(); toast({ - title: t("badQRCodeToastTitle"), + title: t('badQRCodeToastTitle'), status: 'error', duration: 3000, isClosable: true, @@ -135,7 +135,7 @@ function Scanner() { history.push('/home'); }} > - {t("showQRCode")} + {t('showQRCode')} diff --git a/src/screens/SuccessScreen.js b/src/screens/SuccessScreen.js index 0bd4448..58d0df9 100644 --- a/src/screens/SuccessScreen.js +++ b/src/screens/SuccessScreen.js @@ -22,15 +22,13 @@ function Success() { rounded={6} > Success! - - {t("contactSavedParagraph")} - + {t('contactSavedParagraph')} diff --git a/src/screens/VerifyScreen.js b/src/screens/VerifyScreen.js index 719c1bc..dcec47b 100644 --- a/src/screens/VerifyScreen.js +++ b/src/screens/VerifyScreen.js @@ -34,12 +34,8 @@ function Verify(props) { }); }, [verifyError, history, verifyID]); - const errorMessage = ( - {t("verifyingErrorParagraph")} - ); - const loadingMessage = ( - {t("verifyingParagraph")} - ); + const errorMessage = {t('verifyingErrorParagraph')}; + const loadingMessage = {t('verifyingParagraph')}; return (