From b3e8f09ac5d4be217903a6fe45465be29afefac1 Mon Sep 17 00:00:00 2001 From: Billy Lo Date: Fri, 27 Aug 2021 01:15:49 -0400 Subject: [PATCH] Version 1.1 incorporated feedback from the team --- .env.production | 1 + components/Form.tsx | 67 ++++++++++++++++++++---------------- public/locales/en/common.yml | 2 +- public/locales/en/index.yml | 9 +++-- src/colors.ts | 3 +- src/pass.ts | 1 + src/payload.ts | 24 ++++++------- src/process.ts | 13 +++---- 8 files changed, 67 insertions(+), 53 deletions(-) create mode 100644 .env.production diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..52f2093 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +API_BASE_URL=https://covidpassapinet-pnrnxf7lvq-pd.a.run.app diff --git a/components/Form.tsx b/components/Form.tsx index 6bb9ee3..a04b517 100644 --- a/components/Form.tsx +++ b/components/Form.tsx @@ -65,6 +65,10 @@ function Form(): JSX.Element { inputFile.current.click(); } + async function gotoOntarioHealth() { + window.location.href = 'https://covid19.ontariohealth.ca'; + } + // Hide camera view async function hideCameraView() { if (globalControls !== undefined) { @@ -125,6 +129,7 @@ function Form(): JSX.Element { // Add Pass to wallet async function addToWallet(event: FormEvent) { + event.preventDefault(); setLoading(true); @@ -146,15 +151,14 @@ function Form(): JSX.Element { try { if (file) { payloadBody = await getPayloadBodyFromFile(file, color); - } else { - payloadBody = await getPayloadBodyFromQR(qrCode, color); - } + let pass = await PassData.generatePass(payloadBody); + + const passBlob = new Blob([pass], {type: "application/vnd.apple.pkpass"}); + saveAs(passBlob, 'covid.pkpass'); + setLoading(false); + } - let pass = await PassData.generatePass(payloadBody); - const passBlob = new Blob([pass], {type: "application/vnd.apple.pkpass"}); - saveAs(passBlob, 'covid.pkpass'); - setLoading(false); } catch (e) { setErrorMessage(e.message); setLoading(false); @@ -164,7 +168,27 @@ function Form(): JSX.Element { return (
- +

+ {t('index:visit')}  + + + + {t('index:ontarioHealth')} + +   + {t('index:downloadSignedPDF')} +

+ +
+ }/> + +

{t('index:selectCertificateDescription')}

@@ -182,8 +206,8 @@ function Form(): JSX.Element {
-