Skip to content

Commit

Permalink
Merge pull request #38 from trevorpfiz/elektrikspark/ttp-87-dont-clea…
Browse files Browse the repository at this point in the history
…r-new-patient-allow-them-to-reopen-app-and-get-sent

ttp 87 dont clear new patient allow them to reopen app and get sent
  • Loading branch information
trevorpfiz authored Dec 30, 2023
2 parents f2d010c + 0e349b2 commit 5275ac3
Show file tree
Hide file tree
Showing 92 changed files with 1,190 additions and 614 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ next-env.d.ts
dist/
expo-env.d.ts
apps/expo/.gitignore
.p8

# production
build
Expand Down
14 changes: 7 additions & 7 deletions apps/expo/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import type { ExpoConfig } from "@expo/config";

const defineConfig = (): ExpoConfig => ({
name: "canvas-fhir-api-telehealth-starter",
name: "PatientX Starter",
slug: "canvas-fhir",
scheme: "expo",
version: "0.1.0",
version: "0.1.1",
orientation: "portrait",
icon: "./assets/icon.png",
userInterfaceStyle: "light",
splash: {
image: "./assets/icon.png",
image: "./assets/splash.png",
resizeMode: "contain",
backgroundColor: "#1F104A",
backgroundColor: "#000",
},
updates: {
fallbackToCacheTimeout: 0,
},
assetBundlePatterns: ["**/*"],
ios: {
bundleIdentifier: "com.trusttheprocess.canvas-fhir-api-telehealth-starter",
bundleIdentifier: "com.trusttheprocess.patientx",
supportsTablet: true,
},
android: {
package: "com.trusttheprocess.canvas-fhir-api-telehealth-starter",
package: "com.trusttheprocess.patientx",
adaptiveIcon: {
foregroundImage: "./assets/icon.png",
backgroundColor: "#1F104A",
backgroundColor: "#000",
},
},
extra: {
Expand Down
Binary file removed apps/expo/assets/icon-old.png
Binary file not shown.
Binary file modified apps/expo/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion apps/expo/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@
}
},
"submit": {
"production": {}
"production": {
"android": {
"serviceAccountKeyPath": "../path/to/api-xxx-yyy-zzz.json",
"track": "internal"
},
"ios": {
// "appleId": process.env.APPLE_ID,
// "ascAppId": process.env.ASC_APP_ID,
// "appleTeamId": process.env.APPLE_TEAM_ID,
// "ascApiKeyId": process.env.ASC_API_KEY_ID,
// "ascApiKeyIssuerId": process.env.ASC_API_KEY_ISSUER_ID,
// "ascApiKeyPath": process.env.ASC_API_KEY_PATH,
}
}
}
}
1 change: 1 addition & 0 deletions apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"expo-web-browser": "^12.3.2",
"jotai": "^2.6.0",
"lucide-react-native": "^0.294.0",
"moti": "^0.27.2",
"nativewind": "^4.0.16",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
18 changes: 18 additions & 0 deletions apps/expo/src/app/(main)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Slot } from "expo-router";
import { Provider, useAtom } from "jotai";

import { USE_PROVIDER_KEY_TO_RESET_ATOMS } from "~/lib/constants";
import { globalStore, providerKeyAtom } from "~/lib/global-store";
import { TRPCProvider } from "~/utils/api";

export default function MainLayout() {
const [providerKey] = useAtom(providerKeyAtom, { store: globalStore });

return (
<TRPCProvider>
<Provider key={USE_PROVIDER_KEY_TO_RESET_ATOMS ? providerKey : undefined}>
<Slot />
</Provider>
</TRPCProvider>
);
}
23 changes: 20 additions & 3 deletions apps/expo/src/app/index.tsx → apps/expo/src/app/(main)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
import { Text, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { Stack, useRouter } from "expo-router";
import { Redirect, Stack, useRouter } from "expo-router";
import { useAtom } from "jotai";

import SvgComponent from "~/components/ui/home-svg";
import { Button } from "~/components/ui/rn-ui/components/ui/button";
import { UserJourney } from "~/lib/constants";
import { atomWithMMKV } from "~/utils/atom-with-mmkv";

export const patientIdAtom = atomWithMMKV("patient_id", "");
export const patientNameAtom = atomWithMMKV("patient_name", {
firstName: "",
lastName: "",
});
export const userJourneyAtom = atomWithMMKV<UserJourney | "">(
"user_journey",
"",
);

const Index = () => {
const [, setPatientId] = useAtom(patientIdAtom);
const [patientId, setPatientId] = useAtom(patientIdAtom);
const [, setPatientName] = useAtom(patientNameAtom);
const [userJourney, setUserJourney] = useAtom(userJourneyAtom);
const router = useRouter();
console.log(patientId);
console.log(userJourney);
if (patientId) {
if (userJourney === UserJourney.Onboarding) {
return <Redirect href="/onboarding/overview" />;
} else if (userJourney === UserJourney.Confirmation) {
return <Redirect href="/onboarding/confirmation" />;
} else if (userJourney === UserJourney.Portal) {
return <Redirect href="/(main)/portal/(tabs)" />;
}
}

return (
<SafeAreaView className="flex-1 bg-white">
Expand All @@ -38,7 +55,7 @@ const Index = () => {
// use the demo patient Donna Lewis as the existing patient
setPatientId("e7836251cbed4bd5bb2d792bc02893fd");
setPatientName({ firstName: "Donna", lastName: "Lewis" });
router.replace("/portal/(tabs)/");
setUserJourney(UserJourney.Portal);
}}
textClass="text-center"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
import { Stack } from "expo-router";
import { Redirect, Stack } from "expo-router";
import { useAtom } from "jotai";

import { patientIdAtom, userJourneyAtom } from "~/app/(main)";
import { UserJourney } from "~/lib/constants";

export const unstable_settings = {
// Ensure any route can link back to `onboarding/index.tsx`?
initialRouteName: "index",
};

export default function OnboardingLayout() {
const [patientId] = useAtom(patientIdAtom);
const [userJourney] = useAtom(userJourneyAtom);

if (patientId) {
if (userJourney === UserJourney.Portal) {
return <Redirect href="/(main)/portal/(tabs)" />;
}
}

return (
<Stack>
<Stack.Screen
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
import React from "react";
import { SafeAreaView, Text, View } from "react-native";
import { useRouter } from "expo-router";
import { Redirect } from "expo-router";
import { useAtom } from "jotai";

import { patientIdAtom, userJourneyAtom } from "~/app/(main)";
import { Button } from "~/components/ui/rn-ui/components/ui/button";
import { UserJourney } from "~/lib/constants";
import { atomWithMMKV } from "~/utils/atom-with-mmkv";
import { formatAppointmentDateTime } from "~/utils/dates";

export const onboardingDateAtom = atomWithMMKV("onboarding_date", "");

export default function ConfirmationPage() {
const [onboardingDate] = useAtom(onboardingDateAtom);
const router = useRouter();
const [patientId] = useAtom(patientIdAtom);
const [userJourney, setUserJourney] = useAtom(userJourneyAtom);

const appointmentDate = formatAppointmentDateTime(onboardingDate);
if (!patientId) {
return <Redirect href="/" />;
}

if (patientId) {
if (userJourney === UserJourney.Onboarding) {
return <Redirect href="/onboarding/overview" />;
} else if (userJourney === UserJourney.Portal) {
return <Redirect href="/(main)/portal/(tabs)" />;
}
}

const appointmentDate = onboardingDate
? formatAppointmentDateTime(onboardingDate)
: "you";

return (
<>
Expand All @@ -27,7 +44,10 @@ export default function ConfirmationPage() {

<View className="px-12 pb-4">
<Button
onPress={() => router.replace("/portal/(tabs)/")}
onPress={() => {
// update the user journey to portal
setUserJourney(UserJourney.Portal);
}}
textClass="text-center"
>
Head to Patient Portal
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions apps/expo/src/app/(main)/onboarding/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from "react";
import { Redirect } from "expo-router";
import { useAtom } from "jotai";

import { userJourneyAtom } from "~/app/(main)";
import { WelcomeForm } from "~/components/forms/welcome-form";
import { UserJourney } from "~/lib/constants";

export default function WelcomePage() {
const [patientId] = useAtom(userJourneyAtom);
const [userJourney, setUserJourney] = useAtom(userJourneyAtom);

if (patientId) {
if (userJourney === UserJourney.Onboarding) {
return <Redirect href="/onboarding/overview" />;
}
}

return (
<WelcomeForm
onSuccess={() => {
// set the user journey to onboarding
setUserJourney(UserJourney.Onboarding);
}}
/>
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { useRouter } from "expo-router";
import { SafeAreaView } from "react-native";
import { Stack, useRouter } from "expo-router";

import { AllergiesForm } from "~/components/forms/allergies-form";
import { useStepStatusUpdater } from "~/hooks/use-step-status-updater";
Expand All @@ -9,16 +10,22 @@ export default function AllergiesFormPage() {
const router = useRouter();

return (
<>
<SafeAreaView className="flex-1 bg-gray-50">
<Stack.Screen
options={{
title: "Allergies",
headerTitleAlign: "center",
}}
/>
<AllergiesForm
onSuccess={() => {
// Update the allergies step as complete
updater.markStepAsComplete("allergies");

// Go to the next step in onboarding
// Go back to the medical history page
router.back();
}}
/>
</>
</SafeAreaView>
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { useRouter } from "expo-router";
import { SafeAreaView } from "react-native";
import { Stack, useRouter } from "expo-router";

import { ConditionsForm } from "~/components/forms/conditions-form";
import { useStepStatusUpdater } from "~/hooks/use-step-status-updater";
Expand All @@ -9,16 +10,22 @@ export default function ConditionsFormPage() {
const router = useRouter();

return (
<>
<SafeAreaView className="flex-1 bg-gray-50">
<Stack.Screen
options={{
title: "Allergies",
headerTitleAlign: "center",
}}
/>
<ConditionsForm
onSuccess={() => {
// Update the conditions step as complete
updater.markStepAsComplete("conditions");

// Go to the next step in onboarding
// Go back to the medical history page
router.back();
}}
/>
</>
</SafeAreaView>
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { useRouter } from "expo-router";
import { SafeAreaView } from "react-native";
import { Stack, useRouter } from "expo-router";

import { MedicationsForm } from "~/components/forms/medications-form";
import { useStepStatusUpdater } from "~/hooks/use-step-status-updater";
Expand All @@ -9,16 +10,22 @@ export default function MedicationsFormPage() {
const router = useRouter();

return (
<>
<SafeAreaView className="flex-1 bg-gray-50">
<Stack.Screen
options={{
title: "Allergies",
headerTitleAlign: "center",
}}
/>
<MedicationsForm
onSuccess={() => {
// Update the medications step as complete
updater.markStepAsComplete("medications");

// Go to the next step in onboarding
// Go back to the medical history page
router.back();
}}
/>
</>
</SafeAreaView>
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SafeAreaView, Text, View } from "react-native";
import { useAtom } from "jotai";

import { patientNameAtom } from "~/app";
import { patientNameAtom } from "~/app/(main)";
import Steps from "~/components/ui/steps";

export default function OverviewPage() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import React from "react";
import { SafeAreaView } from "react-native";
import { useRouter } from "expo-router";
import { useAtom } from "jotai";

import { userJourneyAtom } from "~/app/(main)";
import ScheduleAppointment from "~/components/schedule-appointment";
import { UserJourney } from "~/lib/constants";

export default function SchedulePage() {
const router = useRouter();
const [, setUserJourney] = useAtom(userJourneyAtom);

return (
<SafeAreaView className="flex-1 bg-white">
<ScheduleAppointment
onSuccess={() => router.replace("/onboarding/confirmation")}
onSuccess={() => {
// set the user journey to confirmation
setUserJourney(UserJourney.Confirmation);
}}
onboarding={true}
/>
</SafeAreaView>
Expand Down
Loading

0 comments on commit 5275ac3

Please sign in to comment.