From d02793fea97a1f5864cf14db7a91b383088147d6 Mon Sep 17 00:00:00 2001
From: Abderrahmane Bennani
<93011714+AbderrahmaneBennani@users.noreply.github.com>
Date: Sat, 1 Feb 2025 13:39:55 +0100
Subject: [PATCH 1/2] Refactor(Drawer): Disable Drawer in Profile Screen:
Signed-off-by: Abderrahmane Bennani <93011714+AbderrahmaneBennani@users.noreply.github.com>
---
app/src/routes/AuthRoutes.tsx | 75 ++++++++++++++++++++++++++---------
1 file changed, 56 insertions(+), 19 deletions(-)
diff --git a/app/src/routes/AuthRoutes.tsx b/app/src/routes/AuthRoutes.tsx
index 5f97cc7..81280ac 100644
--- a/app/src/routes/AuthRoutes.tsx
+++ b/app/src/routes/AuthRoutes.tsx
@@ -2,9 +2,9 @@
// Description: This file defines the navigation structure for authenticated users using React Navigation.
// It sets up a drawer navigator with routes for various authenticated screens such as Home and Profile.
-import { createDrawerNavigator } from '@react-navigation/drawer';
-import { Drawer, Loading } from '@src/components';
-import { Collections, Screens, fireAuth, fireStore } from '@src/constants';
+import { createDrawerNavigator } from "@react-navigation/drawer";
+import { Drawer, Loading } from "@src/components";
+import { Collections, Screens, fireAuth, fireStore } from "@src/constants";
import {
ActivityPlayer,
Favorite,
@@ -14,11 +14,11 @@ import {
NewPlay,
Onboarding,
Profile,
- Welcome
-} from '@src/screens';
-import { doc, getDoc } from 'firebase/firestore';
-import { useEffect, useState } from 'react';
-import { useAuthState } from 'react-firebase-hooks/auth';
+ Welcome,
+} from "@src/screens";
+import { doc, getDoc } from "firebase/firestore";
+import { useEffect, useState } from "react";
+import { useAuthState } from "react-firebase-hooks/auth";
// Define the parameter types for the AuthRoutes drawer navigator
export type AuthRoutesParams = {
@@ -53,7 +53,7 @@ export const AuthRoutes: React.FC = () => {
if (!user) return;
const userDocRef = doc(fireStore, Collections.Users, user.uid);
const docData = await getDoc(userDocRef);
- setIsFirstTimeUser(!docData.exists() || !docData.get('kids'));
+ setIsFirstTimeUser(!docData.exists() || !docData.get("kids"));
} catch (error) {
console.log(error);
} finally {
@@ -64,7 +64,12 @@ export const AuthRoutes: React.FC = () => {
}, []);
if (isLoading) {
- return ;
+ return (
+
+ );
}
return (
@@ -75,39 +80,71 @@ export const AuthRoutes: React.FC = () => {
+
+
-
-
);
From d2db26b8b8362a98721e1538f7b0c0c582bb3a81 Mon Sep 17 00:00:00 2001
From: Abderrahmane Bennani
<93011714+AbderrahmaneBennani@users.noreply.github.com>
Date: Sat, 1 Feb 2025 14:24:32 +0100
Subject: [PATCH 2/2] fix(chores screen): fixed issue cannot go next after
chores selected
Signed-off-by: Abderrahmane Bennani <93011714+AbderrahmaneBennani@users.noreply.github.com>
---
.../ContextualQuestionActivityChoice.tsx | 62 ++++++++++---------
1 file changed, 33 insertions(+), 29 deletions(-)
diff --git a/app/src/components/ContextualQuestionActivityChoice.tsx b/app/src/components/ContextualQuestionActivityChoice.tsx
index 314c83e..9d409f5 100644
--- a/app/src/components/ContextualQuestionActivityChoice.tsx
+++ b/app/src/components/ContextualQuestionActivityChoice.tsx
@@ -1,23 +1,25 @@
-import { Text } from '@shadcn/components';
+import { Text } from "@shadcn/components";
-import type { ContextualQuestionProps, OnboardingFormData } from '@src/types';
-import { useFormikContext } from 'formik';
-import LottieView from 'lottie-react-native';
-import { Gamepad2 } from 'lucide-react-native';
-import { type ReactNode, useState } from 'react';
-import { TouchableOpacity, View } from 'react-native';
-import { ChoresButtonModal } from './ChoresButtonModal';
-import { InfoAlertIcon } from './InfoAlert';
+import type { ContextualQuestionProps, OnboardingFormData } from "@src/types";
+import { useFormikContext } from "formik";
+import LottieView from "lottie-react-native";
+import { Gamepad2 } from "lucide-react-native";
+import { type ReactNode, useState } from "react";
+import { TouchableOpacity, View } from "react-native";
+import { ChoresButtonModal } from "./ChoresButtonModal";
+import { InfoAlertIcon } from "./InfoAlert";
-export const ContextualQuestionActivityChoice: React.FC = (props) => {
+export const ContextualQuestionActivityChoice: React.FC<
+ ContextualQuestionProps
+> = (props) => {
const { onNext } = props;
const { setFieldValue, values } = useFormikContext();
- const [activityType, setActivityType] = useState('');
+ const [activityType, setActivityType] = useState("");
const onChange = (value: string | undefined) => {
if (!value) return;
setActivityType(value);
- setFieldValue('type', value);
+ setFieldValue("type", value);
};
const onChangeAndNext = (value: string | undefined) => {
@@ -26,56 +28,58 @@ export const ContextualQuestionActivityChoice: React.FC
};
const onChoreSelectionComplete = (choreType: string) => {
- setFieldValue('type', choreType);
+ setFieldValue("choreType", choreType);
onNext();
};
const IconWrapper = ({ children }: { children: ReactNode }) => (
- {children}
+ {children}
);
return (
-
-
+
+
-
-
-
- Select an activity type
+
+
+
+
+ Select an activity type
+
-
+
Are you looking to do some chores or play today?
-
+
onChange('chores')}
+ onPress={() => onChange("chores")}
onFinish={(chore) => onChoreSelectionComplete(chore)}
/>
onChangeAndNext('play')}
+ onPress={() => onChangeAndNext("play")}
className={`h-28 w-28 rounded-xl flex items-center justify-center ${
- activityType === 'play' ? 'bg-secondary' : 'bg-white'
+ activityType === "play" ? "bg-secondary" : "bg-white"
}`}
>
- Play
+ Play