Skip to content

Commit

Permalink
feat: add senior profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
cgarcia-lightit committed Nov 21, 2023
1 parent e59f88b commit 4cca613
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/eo_web/src/configs/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export const SENIOR_INTRO_QUESTION_PATIENT_ID =
export const SENIOR_INTRO_QUESTION_CAREGIVER_ID =
window.data.getEnv("SENIOR_INTRO_QUESTION_CAREGIVER_ID") || 233233204641040;
export const SENIOR_PROFILE_PATIENT_ID =
window.data.getEnv("SENIOR_PROFILE_PATIENT_ID") || 232564063321650;
window.data.getEnv("SENIOR_PROFILE_PATIENT_ID") || 233205444527149;
export const SENIOR_PROFILE_CAREGIVER_ID =
window.data.getEnv("SENIOR_PROFILE_CAREGIVER_ID") || 232564208467662;
window.data.getEnv("SENIOR_PROFILE_CAREGIVER_ID") || 233205444527149;

export const API_ELIXIR =
window.data.getEnv("API_URL") || "http://localhost:4200";
Expand Down
2 changes: 2 additions & 0 deletions apps/eo_web/src/router/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ProfilingThankYou } from "~/screens/ProfilingThankYou";
import { RecoveryPassword } from "~/screens/RecoveryPassword";
import { Register } from "~/screens/Register";
import { RegisterComplete } from "~/screens/RegisterComplete";
import { Profiling as SeniorProfiling } from "~/screens/Senior/Profiling";
import { UnavailableZipCode } from "~/screens/UnavailableZipCode";
import { UserRolSelector } from "~/screens/UserRolSelector";
import { ZipCodeValidation } from "~/screens/ZipCodeValidation";
Expand Down Expand Up @@ -108,6 +109,7 @@ export const Router = () => {
/>

{/* SENIOR */}
<Route element={<SeniorProfiling />} path={ROUTES.seniorForm} />
</Routes>
);
};
53 changes: 53 additions & 0 deletions apps/eo_web/src/screens/Senior/Profiling.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { useNavigate } from "react-router-dom";

import { SENIOR_PROFILE_PATIENT_ID } from "~/configs/env";
import { jotformScript } from "~/helpers/jotform_script";
import { useMount } from "~/hooks/useMount";
import { LayoutDefault } from "~/layouts";
import { ROUTES } from "~/router";
import { useProfilingStore } from "~/stores/useProfilingStore";





export const Profiling = () => {
const { type } = useProfilingStore((state) => state);
const navigate = useNavigate();

const seniorFormId =
type === "Patient" ? SENIOR_PROFILE_PATIENT_ID : SENIOR_PROFILE_PATIENT_ID;

if (!type) {
navigate(ROUTES.userRolSelector);
}

useMount(() => {
setTimeout(() => {
jotformScript(seniorFormId);
}, 400);
});

return (
<LayoutDefault>
<div className="mb-10 flex h-screen flex-col">
{/* uncomment for real flow */}
<iframe
id={`JotFormIFrame-${seniorFormId}`}
title=""
onLoad={() => window.parent.scrollTo(0, 0)}
allow="geolocation; microphone; camera"
allowTransparency={true}
allowFullScreen={true}
src={`https://form.jotform.com/${seniorFormId}`}
className="h-full w-full"
style={{
minWidth: "100%",
height: "539px",
border: "none",
}}
></iframe>
</div>
</LayoutDefault>
);
};

0 comments on commit 4cca613

Please sign in to comment.