diff --git a/app/(quiz)/quiz.tsx b/app/(quiz)/quiz.tsx index 41f80ac..91ac624 100644 --- a/app/(quiz)/quiz.tsx +++ b/app/(quiz)/quiz.tsx @@ -1,57 +1,107 @@ import BackButton from "@/components/BackButton"; import { toBgColor, toTextColor } from "@/components/Constants"; +import WeightQuestion, { + WeightQuestionRef, +} from "@/components/quiz/WeightQuestion"; +import React, { useRef, useState } from "react"; +import { View } from "react-native"; import Button from "@/components/ui/Button"; import Screen from "@/components/ui/Screen"; import Text from "@/components/ui/Text"; -import React from "react"; -import { View } from "react-native"; -import FrequencyQuestion from "@/components/quiz/FrequencyQuestion"; -import GoalQuestion from "@/components/quiz/GoalQuestion"; -import GenderQuestion from "@/components/quiz/GenderQuestion"; -import WeightQuestion from "@/components/quiz/WeightQuestion"; -import HeightQuestion from "@/components/quiz/HeightQuestion"; -import AgeQuestion from "@/components/quiz/AgeQuestion"; -import BeginnerQuestion from "@/components/quiz/BeginnerQuestion"; -import LvlQuestion from "@/components/quiz/LvlQuestion"; -import SleepQuestion from "@/components/quiz/SleepQuestion"; -import SportQuestion from "@/components/quiz/SportQuestion"; +import FrequencyQuestion, { + FrequencyQuestionRef, +} from "@/components/quiz/FrequencyQuestion"; +import GoalQuestion, { GoalQuestionRef } from "@/components/quiz/GoalQuestion"; +import GenderQuestion, { + GenderQuestionRef, +} from "@/components/quiz/GenderQuestion"; +import HeightQuestion, { + HeightQuestionRef, +} from "@/components/quiz/HeightQuestion"; +import AgeQuestion, { AgeQuestionRef } from "@/components/quiz/AgeQuestion"; +import BeginnerQuestion, { + BeginnerQuestionRef, +} from "@/components/quiz/BeginnerQuestion"; +import ActivityQuestion, { + ActivityQuestionRef, +} from "@/components/quiz/ActivityQuestion"; +import SportQuestion, { + SportQuestionRef, +} from "@/components/quiz/SportQuestion"; +import SleepQuestion, { + SleepQuestionRef, +} from "@/components/quiz/SleepQuestion"; export default function Quiz() { - const [currentQuestionIndex, setCurrentQuestionIndex] = React.useState(0); + const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0); + const goalRef = useRef(null); + const genderRef = useRef(null); + const weightRef = useRef(null); + const heightRef = useRef(null); + const ageRef = useRef(null); + const beginnerRef = useRef(null); + const activityRef = useRef(null); + const frequencyRef = useRef(null); + const sportQuestionRef = useRef(null); + const sleepQuestionRef = useRef(null); + interface Question { component: React.ForwardRefExoticComponent>; props: T; } + const questions: Question[] = [ - { component: GoalQuestion, props: {} }, - { component: GenderQuestion, props: {} }, - { component: WeightQuestion, props: {} }, - { component: HeightQuestion, props: {} }, - { component: AgeQuestion, props: {} }, - { component: BeginnerQuestion, props: {} }, - { component: LvlQuestion, props: {} }, - { component: FrequencyQuestion, props: { isMale: true } }, - { component: SportQuestion, props: {} }, - { component: SleepQuestion, props: {} }, + { component: GoalQuestion, props: { ref: goalRef } }, + { component: GenderQuestion, props: { ref: genderRef } }, + { + component: WeightQuestion, + props: { ref: weightRef }, + }, + { component: HeightQuestion, props: { ref: heightRef } }, + { component: AgeQuestion, props: { ref: ageRef } }, + { component: BeginnerQuestion, props: { ref: beginnerRef } }, + { component: ActivityQuestion, props: { ref: activityRef } }, + //{ component: IllnessQuestion, props: {} }, + { + component: FrequencyQuestion, + props: { ref: frequencyRef, isMale: genderRef.current?.getAnswer() }, + }, + { component: SportQuestion, props: { ref: sportQuestionRef } }, + { component: SleepQuestion, props: { ref: sleepQuestionRef } }, ]; - const goBack = () => { - if (currentQuestionIndex >= 1) { - setCurrentQuestionIndex(currentQuestionIndex - 1); - } - }; - const goNext = () => { if (currentQuestionIndex < questions.length - 1) { setCurrentQuestionIndex(currentQuestionIndex + 1); + } else { + collect(); } }; + const collect = () => { + console.log("Goal:", goalRef.current?.getAnswer()); + console.log("Sexe:", genderRef.current?.getAnswer()); + console.log("Weight:", weightRef.current?.getAnswer()); + console.log("Height:", heightRef.current?.getAnswer()); + console.log("Age:", ageRef.current?.getAnswer()); + console.log("Beginner:", beginnerRef.current?.getAnswer()); + console.log("Activity:", activityRef.current?.getAnswer()); + console.log("Frequency:", frequencyRef.current?.getAnswer()); + console.log("Sport:", sportQuestionRef.current?.getAnswer()); + console.log("Sleep:", sleepQuestionRef.current?.getAnswer()); + }; + return ( - - + + setCurrentQuestionIndex((i) => Math.max(i - 1, 0))} + /> + + Questionnaire + {currentQuestionIndex + 1} sur {questions.length} @@ -66,7 +116,9 @@ export default function Quiz() { }) )} diff --git a/assets/images/wheelchair.png b/assets/images/wheelchair.png new file mode 100644 index 0000000..e6005c3 Binary files /dev/null and b/assets/images/wheelchair.png differ diff --git a/components/BackButton.tsx b/components/BackButton.tsx index 05c40f8..2cab0db 100644 --- a/components/BackButton.tsx +++ b/components/BackButton.tsx @@ -1,26 +1,26 @@ import { router } from "expo-router"; import Button from "./ui/Button"; -import { TouchableOpacityProps } from "react-native"; +import { ButtonProps } from "./ui/Button"; import { AntDesign } from "@expo/vector-icons"; import React from "react"; import { AntDesignIconNames } from "./Icons"; -interface Props extends TouchableOpacityProps { +interface Props extends ButtonProps { icon?: AntDesignIconNames; } export default React.forwardRef( - (props, ref): React.ReactElement => { - const { icon, onPress } = props; + ({ icon, onPress, className, ...props }, ref): React.ReactElement => { const defaultOnPress = () => { router.back(); }; return ( diff --git a/components/CheckBox.tsx b/components/CheckBox.tsx new file mode 100644 index 0000000..6827d96 --- /dev/null +++ b/components/CheckBox.tsx @@ -0,0 +1,149 @@ +import React, { forwardRef } from "react"; +import { View, TouchableOpacity, ViewProps } from "react-native"; +import Text from "./ui/Text"; +import { + AntDesign, + Entypo, + FontAwesome6, + Ionicons, + MaterialCommunityIcons, +} from "@expo/vector-icons"; +import { + AntDesignIconNames, + CommunityIconNames, + EntypoIconNames, + FontAwesome6IconNames, + FontAwesomeIconNames, + IonIconNames, +} from "./Icons"; + +export type CheckBoxDirection = "row" | "col"; + +interface CheckBoxProps extends ViewProps { + label?: string; + onChange: () => void; + antIcon?: AntDesignIconNames; + entypoIcon?: EntypoIconNames; + fontAwesomeIcon?: FontAwesomeIconNames; + fontAwesome6Icon?: FontAwesome6IconNames; + communityIcon?: CommunityIconNames; + IonIcon?: IonIconNames; + value: boolean; + isCheckIconVisible?: boolean; + endText?: string; + direction?: CheckBoxDirection; +} + +export default forwardRef( + ( + { + label, + onChange, + antIcon, + entypoIcon, + fontAwesomeIcon, + fontAwesome6Icon, + communityIcon, + IonIcon, + value, + isCheckIconVisible, + endText, + direction, + className, + ...props + }, + ref + ) => { + return ( + + + {antIcon ? ( + + ) : null} + {entypoIcon ? ( + + ) : null} + {communityIcon ? ( + + ) : null} + {fontAwesomeIcon ? ( + + ) : null} + {fontAwesome6Icon ? ( + + ) : null} + {IonIcon ? ( + + ) : null} + + + {label != null ? ( + + {label} + + ) : null} + + {isCheckIconVisible ? ( + + {value && } + + ) : null} + + {endText != null ? ( + {endText} + ) : null} + + ); + } +); diff --git a/components/CheckButtonComponent.tsx b/components/CheckButtonComponent.tsx deleted file mode 100644 index 0340f2c..0000000 --- a/components/CheckButtonComponent.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import React, {Component} from "react"; -import {View, Text, TouchableOpacity, Image} from "react-native"; -import { - AntDesign, - Entypo, - FontAwesome6, - MaterialCommunityIcons, -} from "@expo/vector-icons"; -import { - AntDesignIconNames, - CommunityIconNames, - EntypoIconNames, - FontAwesomeIconNames, -} from "./Icons"; - -interface CheckButtonProps { - label: string; - value: boolean; - onChange: () => void; - antIcon?: AntDesignIconNames; - entypoIcon?: EntypoIconNames; - fontAwesomeIcon?: FontAwesomeIconNames; - communityIcon?: CommunityIconNames; -} - -const CheckButton: React.FC = ({ label, value, onChange, antIcon, - entypoIcon, - fontAwesomeIcon, - communityIcon, }) => { - return ( - - - {antIcon ? ( - - ) : null} - {entypoIcon ? ( - - ) : null} - {communityIcon ? ( - - ) : null} - {fontAwesomeIcon ? ( - - ) : null} - - {label} - - - ); -}; - -export default CheckButton; \ No newline at end of file diff --git a/components/CheckboxComponent.tsx b/components/CheckboxComponent.tsx deleted file mode 100644 index 9103363..0000000 --- a/components/CheckboxComponent.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React, {Component} from "react"; -import {View, Text, TouchableOpacity, Image} from "react-native"; -import {AntDesign, FontAwesome6} from "@expo/vector-icons"; -import {AntDesignIconNames} from "./Icons"; - -interface CheckBoxProps { - label: string; - value: boolean; - onChange: () => void; - icon: AntDesignIconNames | string; -} - -const CheckBox: React.FC = ({ label, value, onChange, icon }) => { - let AwesomIconList = ["weight-scale", "beer"]; - return ( - - - {AwesomIconList.includes(icon) ? ( - - ) : ( - - )} - - - {label} - - - {value && } - - - ); -}; - -export default CheckBox; \ No newline at end of file diff --git a/components/Icons.tsx b/components/Icons.tsx index 22831ae..272d8ee 100644 --- a/components/Icons.tsx +++ b/components/Icons.tsx @@ -1,3 +1,26 @@ -import { AntDesign } from "@expo/vector-icons"; +import { + AntDesign, + Entypo, + FontAwesome, + Ionicons, + MaterialCommunityIcons, +} from "@expo/vector-icons"; -export type AntDesignIconNames = keyof typeof AntDesign.glyphMap; \ No newline at end of file +export type AntDesignIconNames = keyof typeof AntDesign.glyphMap; +export type EntypoIconNames = keyof typeof Entypo.glyphMap; +export type FontAwesomeIconNames = keyof typeof FontAwesome.glyphMap; +export type FontAwesome6IconNames = + | "person-running" + | "person-walking" + | "person-hiking" + | "skateboarding" + | "bike" + | "basketball" + | "heart" + | "yoga" + | "setting" + | "beer" + | "shield-heart" + | "weight-scale"; +export type CommunityIconNames = keyof typeof MaterialCommunityIcons.glyphMap; +export type IonIconNames = keyof typeof Ionicons.glyphMap; diff --git a/components/form/FormError.tsx b/components/form/FormError.tsx index c0c16af..7e640ae 100644 --- a/components/form/FormError.tsx +++ b/components/form/FormError.tsx @@ -8,9 +8,7 @@ interface Props extends ExtendedTextProps { } export default React.forwardRef( - (props, ref): React.ReactElement => { - const { isVisible, ...rest } = props; - + ({ isVisible, ...props }, ref): React.ReactElement => { const buildClassName = (): string => { return ( "flex-row items-center gap-2 bg-red-300 p-4 border-2 border-red-500 rounded-3xl" + @@ -22,7 +20,7 @@ export default React.forwardRef( return ( - + ); } diff --git a/components/form/FormInput.tsx b/components/form/FormInput.tsx index 340d082..c348e35 100644 --- a/components/form/FormInput.tsx +++ b/components/form/FormInput.tsx @@ -12,8 +12,8 @@ interface Props extends FormInputProps { } export default React.forwardRef( - (props, ref): React.ReactElement => { - const { + ( + { onBlur, onChangeText, value, @@ -22,9 +22,10 @@ export default React.forwardRef( label, placeholder, onPress, - ...rest - } = props; - + ...props + }, + ref + ): React.ReactElement => { return ( {label} @@ -37,7 +38,7 @@ export default React.forwardRef( onChangeText={onChangeText} value={value} {...ref} - {...rest} + {...props} /> {afterIcon != null ? ( diff --git a/components/form/LoginForm.tsx b/components/form/LoginForm.tsx index b43e57d..7d8bbbb 100644 --- a/components/form/LoginForm.tsx +++ b/components/form/LoginForm.tsx @@ -10,8 +10,7 @@ import { useSession } from "@/ctx"; import { router } from "expo-router"; export default React.forwardRef( - (props, ref): React.ReactElement => { - const { ...rest } = props; + ({ ...props }, ref): React.ReactElement => { const [email, setEmail] = React.useState(""); const [password, setPassword] = React.useState(""); const [error, setError] = React.useState(""); @@ -47,7 +46,7 @@ export default React.forwardRef( }; return ( - + ( - (props, ref): React.ReactElement => { - const { onBlur, onChangeText, value, label, ...rest } = props; + ( + { onBlur, onChangeText, value, label, ...props }, + ref + ): React.ReactElement => { const [showPassword, setShowPassword] = useState(false); const toggleShowPassword = () => { @@ -22,7 +24,7 @@ export default React.forwardRef( onPress={toggleShowPassword} secureTextEntry={!showPassword} {...ref} - {...rest} + {...props} /> ); } diff --git a/components/form/SigninForm.tsx b/components/form/SigninForm.tsx index c1e5a1e..9c574df 100644 --- a/components/form/SigninForm.tsx +++ b/components/form/SigninForm.tsx @@ -8,8 +8,7 @@ import { EMPTY_FIELD, INVALID_EMAIL, NOT_MATCHING_PASSWORD } from "../Errors"; import FormError from "./FormError"; export default React.forwardRef( - (props, ref): React.ReactElement => { - const { ...rest } = props; + ({ ...props }, ref): React.ReactElement => { const [email, setEmail] = React.useState(""); const [password, setPassword] = React.useState(""); const [confirmPassword, setConfirmPassword] = React.useState(""); @@ -52,7 +51,7 @@ export default React.forwardRef( }; return ( - + ( - (props, ref): React.ReactElement => { - const { email, onPress, ...rest } = props; - + ({ email, onPress, ...props }, ref): React.ReactElement => { return ( - + diff --git a/components/quiz/ActivityQuestion.tsx b/components/quiz/ActivityQuestion.tsx index e72d312..b8f5a05 100644 --- a/components/quiz/ActivityQuestion.tsx +++ b/components/quiz/ActivityQuestion.tsx @@ -1,78 +1,78 @@ -import React from "react"; +import React, { useImperativeHandle, useState } from "react"; import Question, { QuestionChildProps } from "./Question"; -import Checkbox from "../CheckboxComponent"; -import {View} from "react-native"; -import {FontAwesome6} from "@expo/vector-icons"; +import Checkbox from "../CheckBox"; +import { View } from "react-native"; +import { + CommunityIconNames, + AntDesignIconNames, + EntypoIconNames, + FontAwesome6IconNames, +} from "../Icons"; +import { ESportLevel, SportLevels } from "@/model/enums/Enums"; -export default React.forwardRef( - (props, ref): React.ReactElement => { - const { ...rest } = props; +export interface ActivityQuestionRef { + getAnswer: () => ESportLevel; +} - const [checkedOne, setCheckedOne] = React.useState(true); - const [checkedTwo, setCheckedTwo] = React.useState(false); - const [checkedThree, setCheckedThree] = React.useState(false); - const [checkedFour, setCheckedFour] = React.useState(false); - const [checkedFive, setCheckedFive] = React.useState(false); - const handleChangeOne = () => { - if(!checkedOne) { - setCheckedOne(!checkedOne); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - } - }; - const handleChangeTwo = () => { - if(!checkedTwo) { - setCheckedOne(false); - setCheckedTwo(!checkedTwo); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - } - }; - const handleChangeThree = () => { - if(!checkedThree) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(!checkedThree); - setCheckedFour(false); - setCheckedFive(false); - } - }; - const handleChangeFour = () => { - if(!checkedFour) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(!checkedFour); - setCheckedFive(false); - } - }; - const handleChangeFive = () => { - if(!checkedFive) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(!checkedFive); - } - }; +export default React.forwardRef( + ({ ...props }, ref): React.ReactElement => { + const [checkedItems, setCheckedItems] = useState([ + true, + ...Array(4).fill(false), + ]); - return ( - - - - - - - - - - ); + const handleChange = (index: number) => { + const newCheckedState = checkedItems.map((_, i) => i === index); + setCheckedItems(newCheckedState); + }; + + useImperativeHandle(ref, () => ({ + getAnswer: () => { + var selected = 0; + checkedItems.forEach((item, index) => { + if (item) { + selected = index; + } + }); + return SportLevels[SportLevels.length - 1 - selected]; + }, + })); + + interface IData { + label: string; + commIcon?: CommunityIconNames; + antIcon?: AntDesignIconNames; + entypoIcon?: EntypoIconNames; + fontAwesomeIcon?: FontAwesome6IconNames; } + + const data: IData[] = [ + { label: "Athlète", antIcon: "smile-circle" }, + { label: "Très sportif", antIcon: "smileo" }, + { label: "Un peu sportif", antIcon: "meh" }, + { label: "Peu sportif", antIcon: "frowno" }, + { label: "Pas du tout sportif", antIcon: "frown" }, + ]; + + return ( + + + {data.map((item, index) => ( + handleChange(index)} + antIcon={item.antIcon} + endText={(data.length - index).toString()} + /> + ))} + + + ); + } ); diff --git a/components/quiz/AgeQuestion.tsx b/components/quiz/AgeQuestion.tsx index d262412..414a6ad 100644 --- a/components/quiz/AgeQuestion.tsx +++ b/components/quiz/AgeQuestion.tsx @@ -1,38 +1,53 @@ -import React from "react"; +import React, { + forwardRef, + ReactElement, + useImperativeHandle, + useState, +} from "react"; import Question, { QuestionChildProps } from "./Question"; import Slider from "../ui/Slider"; import { View } from "react-native"; import Text from "../ui/Text"; -export default React.forwardRef( - (props, ref): React.ReactElement => { - const MIN_AGE = 18; - const MAX_AGE = 100; - const [age, setAge] = React.useState(MIN_AGE); +const MIN_AGE = 18; +const MAX_AGE = 100; + +export interface AgeQuestionRef { + getAnswer: () => number; +} + +export default forwardRef( + (props, ref): ReactElement => { + const [answer, setAnswer] = useState(MIN_AGE); + + useImperativeHandle(ref, () => ({ + getAnswer: () => answer, + })); + return ( - {age <= MIN_AGE ? ( + {answer <= MIN_AGE ? ( - de ) : null} - {age >= MAX_AGE ? ( + {answer >= MAX_AGE ? ( + de ) : null} - {age} + {answer} - + ans ); diff --git a/components/quiz/BeginnerQuestion.tsx b/components/quiz/BeginnerQuestion.tsx index a6fb270..b694265 100644 --- a/components/quiz/BeginnerQuestion.tsx +++ b/components/quiz/BeginnerQuestion.tsx @@ -1,15 +1,35 @@ -import React from "react"; +import React, { + forwardRef, + ReactElement, + useImperativeHandle, + useState, +} from "react"; import Question, { QuestionChildProps } from "./Question"; -import SegmentedControl from "../ui/SegmentedControl"; -import { Image } from "react-native"; +import { Image, View } from "react-native"; //@ts-ignore import BenchImage from "@/assets/images/bench.png"; +import CheckBox from "../CheckBox"; -export default React.forwardRef( - (props, ref): React.ReactElement => { - const ANSWERS = ["Non", "Oui"]; - const [answer, setAnswer] = React.useState("Oui"); +export interface BeginnerQuestionRef { + getAnswer: () => boolean; +} + +export default forwardRef( + (props, ref): ReactElement => { + const [answer, setAnswer] = useState(false); + + useImperativeHandle(ref, () => ({ + getAnswer: () => answer, + })); + + function handleChangeOne() { + setAnswer(true); + } + + function handleChangeTwo() { + setAnswer(false); + } return ( ( {...props} > - + + + + ); } diff --git a/components/quiz/FrequencyQuestion.tsx b/components/quiz/FrequencyQuestion.tsx index 3b8d5a1..a228c6e 100644 --- a/components/quiz/FrequencyQuestion.tsx +++ b/components/quiz/FrequencyQuestion.tsx @@ -1,20 +1,33 @@ -import React from "react"; +import React, { useImperativeHandle } from "react"; import Question, { QuestionChildProps } from "./Question"; import Text from "../ui/Text"; import SegmentedControl from "../ui/SegmentedControl"; import { View } from "react-native"; +const ANSWERS = ["1", "2", "3", "4", "5"]; + +export interface FrequencyQuestionRef { + getAnswer: () => number; +} + export interface FrequencyQuestionProps extends QuestionChildProps { isMale: boolean; } -export default React.forwardRef( - (props, ref): React.ReactElement => { - const { isMale, ...rest } = props; - const ANSWERS = ["1", "2", "3", "4", "5"]; +export default React.forwardRef( + ({ isMale, ...props }, ref): React.ReactElement => { const [answer, setAnswer] = React.useState("1"); + + useImperativeHandle(ref, () => ({ + getAnswer: () => parseInt(answer), + })); + return ( - + Je suis {isMale ? "prêt" : "prête"} à m'entraîner diff --git a/components/quiz/GenderQuestion.tsx b/components/quiz/GenderQuestion.tsx index 993b448..fe49795 100644 --- a/components/quiz/GenderQuestion.tsx +++ b/components/quiz/GenderQuestion.tsx @@ -1,51 +1,55 @@ -import React from "react"; +import React, { + forwardRef, + ReactElement, + useImperativeHandle, + useState, +} from "react"; import Question, { QuestionChildProps } from "./Question"; -import Checkbox from "../CheckboxComponent"; -import {View} from "react-native"; -import {FontAwesome6} from "@expo/vector-icons"; +import Checkbox from "../CheckBox"; +import { View } from "react-native"; -export default React.forwardRef( - (props, ref): React.ReactElement => { - const { ...rest } = props; +export interface GenderQuestionRef { + getAnswer: () => boolean; +} - const [checkedOne, setCheckedOne] = React.useState(false); - const [checkedTwo, setCheckedTwo] = React.useState(false); - const [checkedThree, setCheckedThree] = React.useState(true); - const handleChangeOne = () => { - if(!checkedOne) - { - setCheckedOne(!checkedOne); - setCheckedTwo(false); - setCheckedThree(false); - } - }; - const handleChangeTwo = () => { - if(!checkedTwo) { - setCheckedOne(false); - setCheckedTwo(!checkedTwo); - setCheckedThree(false); - } - }; - const handleChangeThree = () => { - if(!checkedThree) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(!checkedThree); - } - }; +export default forwardRef( + ({ ...props }, ref): ReactElement => { + const [answer, setAnswer] = useState(true); - return ( - - - - - - - - ); - } + useImperativeHandle(ref, () => ({ + getAnswer: () => answer, + })); + + const handleChangeOne = () => { + setAnswer(true); + }; + const handleChangeTwo = () => { + setAnswer(false); + }; + + return ( + + + + + + + ); + } ); diff --git a/components/quiz/GoalQuestion.tsx b/components/quiz/GoalQuestion.tsx index cfa0978..80d4fb1 100644 --- a/components/quiz/GoalQuestion.tsx +++ b/components/quiz/GoalQuestion.tsx @@ -1,47 +1,87 @@ -import React from "react"; +import React, { + forwardRef, + ReactElement, + useImperativeHandle, + useState, +} from "react"; import Question, { QuestionChildProps } from "./Question"; -import Checkbox from "../CheckboxComponent"; -import {View} from "react-native"; -import {FontAwesome6} from "@expo/vector-icons"; +import { View } from "react-native"; +import { + CommunityIconNames, + AntDesignIconNames, + EntypoIconNames, + FontAwesome6IconNames, + IonIconNames, +} from "../Icons"; +import CheckBox from "../CheckBox"; +import { EGoal, Goals } from "@/model/enums/Enums"; -export default React.forwardRef( - (props, ref): React.ReactElement => { - const { ...rest } = props; +export interface GoalQuestionRef { + getAnswer: () => EGoal; +} - const [checkedOne, setCheckedOne] = React.useState(true); - const [checkedTwo, setCheckedTwo] = React.useState(false); - const [checkedThree, setCheckedThree] = React.useState(false); - const [checkedFour, setCheckedFour] = React.useState(false); - const [checkedFive, setCheckedFive] = React.useState(false); - const handleChangeOne = () => { - setCheckedOne(!checkedOne); +export default forwardRef( + ({ ...props }, ref): ReactElement => { + const [checkedItems, setCheckedItems] = useState([ + true, + ...Array(4).fill(false), + ]); + + interface IData { + label: string; + commIcon?: CommunityIconNames; + antIcon?: AntDesignIconNames; + entypoIcon?: EntypoIconNames; + fontAwesomeIcon?: FontAwesome6IconNames; + ionIcon?: IonIconNames; + } + + const data: IData[] = [ + { label: "Perte de poids", commIcon: "weight" }, + { label: "Renforcement musculaire", commIcon: "arm-flex-outline" }, + { label: "Prise de masse", ionIcon: "beer-outline" }, + { label: "Amélioration endurance", fontAwesomeIcon: "shield-heart" }, + { label: "Maintenir en forme", antIcon: "linechart" }, + ]; + + const handleChange = (index: number) => { + const newCheckedState = checkedItems.map((_, i) => i === index); + setCheckedItems(newCheckedState); }; - const handleChangeTwo = () => { - setCheckedTwo(!checkedTwo); - }; - const handleChangeThree = () => { - setCheckedThree(!checkedThree); - }; - const handleChangeFour = () => { - setCheckedFour(!checkedFour); - }; - const handleChangeFive = () => { - setCheckedFive(!checkedFive); - }; + + useImperativeHandle(ref, () => ({ + getAnswer: () => { + var selected = 0; + checkedItems.forEach((item, index) => { + if (item) { + selected = index; + } + }); + return Goals[selected]; + }, + })); return ( - - - - - - - + + {data.map((item, index) => ( + handleChange(index)} + fontAwesome6Icon={item.fontAwesomeIcon} + communityIcon={item.commIcon} + antIcon={item.antIcon} + entypoIcon={item.entypoIcon} + IonIcon={item.ionIcon} + /> + ))} + ); } diff --git a/components/quiz/HeightQuestion.tsx b/components/quiz/HeightQuestion.tsx index ef4afe6..cb11bcb 100644 --- a/components/quiz/HeightQuestion.tsx +++ b/components/quiz/HeightQuestion.tsx @@ -1,17 +1,32 @@ -import React from "react"; +import React, { + forwardRef, + ReactElement, + useImperativeHandle, + useState, +} from "react"; import Question, { QuestionChildProps } from "./Question"; import Slider from "../ui/Slider"; import Text from "../ui/Text"; import { View } from "react-native"; import SegmentedControl from "../ui/SegmentedControl"; -export default React.forwardRef( - (props, ref): React.ReactElement => { - const MIN_HEIGHT = 120; - const MAX_HEIGHT = 250; +const MIN_HEIGHT = 120; +const MAX_HEIGHT = 250; + +export interface HeightQuestionRef { + getAnswer: () => number; +} + +export default forwardRef( + ({ ...props }, ref): ReactElement => { + const [answer, setAnswer] = useState(MIN_HEIGHT); const UNITS = ["cm", "inch"]; - const [height, setHeight] = React.useState(MIN_HEIGHT); - const [unit, setUnit] = React.useState("cm"); + const [unit, setUnit] = useState("cm"); + + useImperativeHandle(ref, () => ({ + getAnswer: () => answer, + })); + return ( ( onValueChange={setUnit} /> - {height <= MIN_HEIGHT ? ( + {answer <= MIN_HEIGHT ? ( - de ) : null} - {height >= MAX_HEIGHT ? ( + {answer >= MAX_HEIGHT ? ( + de ) : null} - {height} + {answer} {unit} @@ -40,7 +55,7 @@ export default React.forwardRef( ); diff --git a/components/quiz/IllnessQuestion.tsx b/components/quiz/IllnessQuestion.tsx new file mode 100644 index 0000000..4822d66 --- /dev/null +++ b/components/quiz/IllnessQuestion.tsx @@ -0,0 +1,54 @@ +import React, { useState } from "react"; +import Question, { QuestionChildProps } from "./Question"; +import { Image, View, Text } from "react-native"; +import { MultiSelect } from "react-native-element-dropdown"; + +//@ts-ignore +import WheelChair from "@/assets/images/wheelchair.png"; +import { EHealthProblem } from "@/model/enums/Enums"; + +export default React.forwardRef( + ({ ...props }, ref) => { + const [selected, setSelected] = useState([]); + + type DataItem = { + label: string; + value: EHealthProblem; + }; + + const data: DataItem[] = [ + { label: "Arthrose", value: "ARTHROSE" }, + { label: "Migraine", value: "MIGRAINE" }, + ]; + + const renderItem = (item: { label: string }) => { + return ( + + {item.label} + + ); + }; + + return ( + + + + + + + ); + } +); diff --git a/components/quiz/LvlQuestion.tsx b/components/quiz/LvlQuestion.tsx deleted file mode 100644 index df81f7c..0000000 --- a/components/quiz/LvlQuestion.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from "react"; -import Question, { QuestionChildProps } from "./Question"; - -export default React.forwardRef( - (props, ref): React.ReactElement => { - const { ...rest } = props; - return ( - - ); - } -); diff --git a/components/quiz/Question.tsx b/components/quiz/Question.tsx index 1dea95d..84e0d9d 100644 --- a/components/quiz/Question.tsx +++ b/components/quiz/Question.tsx @@ -11,14 +11,13 @@ interface QuestionProps extends QuestionChildProps { } export default React.forwardRef( - (props, ref): React.ReactElement => { - const { question, isVisible, children, ...rest } = props; + ({ question, isVisible, children, ...props }, ref): React.ReactElement => { const getClassName = () => { return "gap-6" + " " + (isVisible ? "block" : "hidden"); }; return ( - + {question} diff --git a/components/quiz/SleepQuestion.tsx b/components/quiz/SleepQuestion.tsx index f7d36a9..6dd9752 100644 --- a/components/quiz/SleepQuestion.tsx +++ b/components/quiz/SleepQuestion.tsx @@ -1,78 +1,91 @@ -import React from "react"; +import React, { useImperativeHandle, useState } from "react"; import Question, { QuestionChildProps } from "./Question"; -import Checkbox from "../CheckboxComponent"; -import {View} from "react-native"; -import {FontAwesome6} from "@expo/vector-icons"; +import Checkbox from "../CheckBox"; +import { View } from "react-native"; +import { ESleepLevel, SleepLevels } from "@/model/enums/Enums"; +import { AntDesignIconNames } from "../Icons"; -export default React.forwardRef( - (props, ref): React.ReactElement => { - const { ...rest } = props; +export interface SleepQuestionRef { + getAnswer: () => ESleepLevel; +} - const [checkedOne, setCheckedOne] = React.useState(true); - const [checkedTwo, setCheckedTwo] = React.useState(false); - const [checkedThree, setCheckedThree] = React.useState(false); - const [checkedFour, setCheckedFour] = React.useState(false); - const [checkedFive, setCheckedFive] = React.useState(false); - const handleChangeOne = () => { - if(!checkedOne) { - setCheckedOne(!checkedOne); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - } - }; - const handleChangeTwo = () => { - if(!checkedTwo) { - setCheckedOne(false); - setCheckedTwo(!checkedTwo); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - } - }; - const handleChangeThree = () => { - if(!checkedThree) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(!checkedThree); - setCheckedFour(false); - setCheckedFive(false); - } - }; - const handleChangeFour = () => { - if(!checkedFour) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(!checkedFour); - setCheckedFive(false); - } - }; - const handleChangeFive = () => { - if(!checkedFive) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(!checkedFive); - } - }; +export default React.forwardRef( + ({ ...props }, ref): React.ReactElement => { + const [checkedItems, setCheckedItems] = useState([ + true, + ...Array(4).fill(false), + ]); - return ( - - - - - - - - - - ); + const handleChange = (index: number) => { + const newCheckedState = checkedItems.map((_, i) => i === index); + setCheckedItems(newCheckedState); + }; + + useImperativeHandle(ref, () => ({ + getAnswer: () => { + var selected = 0; + checkedItems.forEach((item, index) => { + if (item) { + selected = index; + } + }); + return SleepLevels[SleepLevels.length - 1 - selected]; + }, + })); + + interface IData { + label: string; + icon: AntDesignIconNames; + endText: string; } + + const data: IData[] = [ + { + label: "Excellent", + icon: "smile-circle", + endText: ">8 heures", + }, + { + label: "Bien", + icon: "smileo", + endText: "7-8 heures", + }, + { + label: "Mauvaise", + icon: "meh", + endText: "6-7 heures", + }, + { + label: "Très mauvaise", + icon: "frowno", + endText: "3-4 heures", + }, + { + label: "Insomniaque", + icon: "frown", + endText: "<2 heures", + }, + ]; + + return ( + + + {data.map((item, index) => ( + handleChange(index)} + antIcon={item.icon} + endText={item.endText} + /> + ))} + + + ); + } ); diff --git a/components/quiz/SportQuestion.tsx b/components/quiz/SportQuestion.tsx index 9dbd409..2bc3767 100644 --- a/components/quiz/SportQuestion.tsx +++ b/components/quiz/SportQuestion.tsx @@ -1,160 +1,86 @@ -import React from "react"; +import React, { + forwardRef, + ReactElement, + useImperativeHandle, + useState, +} from "react"; import Question, { QuestionChildProps } from "./Question"; -import CheckButton from "../CheckButtonComponent"; -import {View} from "react-native"; -import {FontAwesome6} from "@expo/vector-icons"; +import { View } from "react-native"; +import CheckBox from "../CheckBox"; +import { + AntDesignIconNames, + CommunityIconNames, + EntypoIconNames, + FontAwesome6IconNames, +} from "../Icons"; +import { ESport, Sports } from "@/model/enums/Enums"; -export default React.forwardRef( - (props, ref): React.ReactElement => { - const { ...rest } = props; +export interface SportQuestionRef { + getAnswer: () => ESport; +} - const [checkedOne, setCheckedOne] = React.useState(true); - const [checkedTwo, setCheckedTwo] = React.useState(false); - const [checkedThree, setCheckedThree] = React.useState(false); - const [checkedFour, setCheckedFour] = React.useState(false); - const [checkedFive, setCheckedFive] = React.useState(false); - const [checkedSix, setCheckedSix] = React.useState(false); - const [checkedSeven, setCheckedSeven] = React.useState(false); - const [checkedEight, setCheckedEight] = React.useState(false); - const [checkedNine, setCheckedNine] = React.useState(false); - const handleChangeOne = () => { - if(!checkedOne) { - setCheckedOne(!checkedOne); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - setCheckedSix(false); - setCheckedSeven(false); - setCheckedEight(false); - setCheckedNine(false); - } - }; - const handleChangeTwo = () => { - if(!checkedTwo) { - setCheckedOne(false); - setCheckedTwo(!checkedTwo); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - setCheckedSix(false); - setCheckedSeven(false); - setCheckedEight(false); - setCheckedNine(false); - } - }; - const handleChangeThree = () => { - if(!checkedThree) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(!checkedThree); - setCheckedFour(false); - setCheckedFive(false); - setCheckedSix(false); - setCheckedSeven(false); - setCheckedEight(false); - setCheckedNine(false); - } - }; - const handleChangeFour = () => { - if(!checkedFour) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(!checkedFour); - setCheckedFive(false); - setCheckedSix(false); - setCheckedSeven(false); - setCheckedEight(false); - setCheckedNine(false); - } - }; - const handleChangeFive = () => { - if(!checkedFive) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(!checkedFive); - setCheckedSix(false); - setCheckedSeven(false); - setCheckedEight(false); - setCheckedNine(false); - } - }; - const handleChangeSix = () => { - if(!checkedSix) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - setCheckedSix(!checkedSix); - setCheckedSeven(false); - setCheckedEight(false); - setCheckedNine(false); - } - }; - const handleChangeSeven = () => { - if(!checkedSeven) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - setCheckedSix(false); - setCheckedSeven(!checkedSeven); - setCheckedEight(false); - setCheckedNine(false); - } - }; - const handleChangeEight = () => { - if(!checkedEight) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - setCheckedSix(false); - setCheckedSeven(false); - setCheckedEight(!checkedEight); - setCheckedNine(false); - } - }; - const handleChangeNine = () => { - if(!checkedNine) { - setCheckedOne(false); - setCheckedTwo(false); - setCheckedThree(false); - setCheckedFour(false); - setCheckedFive(false); - setCheckedSix(false); - setCheckedSeven(false); - setCheckedEight(false); - setCheckedNine(!checkedNine); - } - }; +export default forwardRef( + (props, ref): ReactElement => { + const [checkedItems, setCheckedItems] = useState([ + true, + ...Array(8).fill(false), + ]); - return ( - - - - - + const handleChange = (index: number) => { + const newCheckedState = checkedItems.map((_, i) => i === index); + setCheckedItems(newCheckedState); + }; - - - + useImperativeHandle(ref, () => ({ + getAnswer: () => { + var selected = 0; + checkedItems.forEach((item, index) => { + if (item) { + selected = index; + } + }); + return Sports[selected]; + }, + })); - - - - - - ); + interface IData { + label: string; + commIcon?: CommunityIconNames; + antIcon?: AntDesignIconNames; + entypoIcon?: EntypoIconNames; + fontAwesomeIcon?: FontAwesome6IconNames; } + + const data: IData[] = [ + { label: "Course", fontAwesomeIcon: "person-running" }, + { label: "Marche", fontAwesomeIcon: "person-walking" }, + { label: "Rando", fontAwesomeIcon: "person-hiking" }, + { label: "Skate", commIcon: "skateboarding" }, + { label: "Cyclisme", commIcon: "bike" }, + { label: "Basket", fontAwesomeIcon: "basketball" }, + { label: "Cardio", antIcon: "heart" }, + { label: "Yoga", commIcon: "yoga" }, + { label: "Autre", entypoIcon: "dots-three-horizontal" }, + ]; + + return ( + + + {data.map((item, index) => ( + handleChange(index)} + fontAwesome6Icon={item.fontAwesomeIcon} + communityIcon={item.commIcon} + antIcon={item.antIcon} + entypoIcon={item.entypoIcon} + direction="col" + /> + ))} + + + ); + } ); diff --git a/components/quiz/WeightQuestion.tsx b/components/quiz/WeightQuestion.tsx index 8bfb597..fefadfd 100644 --- a/components/quiz/WeightQuestion.tsx +++ b/components/quiz/WeightQuestion.tsx @@ -1,37 +1,52 @@ -import React from "react"; +import React, { + forwardRef, + ReactElement, + useImperativeHandle, + useState, +} from "react"; import Question, { QuestionChildProps } from "./Question"; import Slider from "../ui/Slider"; import Text from "../ui/Text"; import { View } from "react-native"; import SegmentedControl from "../ui/SegmentedControl"; -export default React.forwardRef( - (props, ref): React.ReactElement => { - const MIN_WEIGHT = 40; - const MAX_WEIGHT = 200; +const MIN_WEIGHT = 40; +const MAX_WEIGHT = 200; + +export interface WeightQuestionRef { + getAnswer: () => number; +} + +const WeightQuestion = forwardRef( + (props, ref): ReactElement => { const UNITS = ["kg", "lb"]; - const [weight, setWeight] = React.useState(MIN_WEIGHT); - const [unit, setUnit] = React.useState("kg"); + const [answer, setAnswer] = useState(MIN_WEIGHT); + const [unit, setUnit] = useState("kg"); + + useImperativeHandle(ref, () => ({ + getAnswer: () => answer, + })); + return ( - + - {weight <= MIN_WEIGHT ? ( + {answer <= MIN_WEIGHT && ( - de - ) : null} - {weight >= MAX_WEIGHT ? ( + )} + {answer >= MAX_WEIGHT && ( + de - ) : null} + )} - {weight} + {answer} {unit} @@ -40,9 +55,11 @@ export default React.forwardRef( ); } ); + +export default WeightQuestion; diff --git a/components/ui/Button.tsx b/components/ui/Button.tsx index 5b9a0c9..6d53996 100644 --- a/components/ui/Button.tsx +++ b/components/ui/Button.tsx @@ -8,7 +8,7 @@ import { Size } from "../Constants"; export type ButtonStyle = "default" | "outline" | "secondary"; //@ts-ignore -interface Props extends TouchableOpacityProps { +export interface ButtonProps extends TouchableOpacityProps { size?: Size; style?: ButtonStyle; insideClassName?: string; @@ -16,9 +16,9 @@ interface Props extends TouchableOpacityProps { afterIcon?: AntDesignIconNames; } -export default React.forwardRef( - (props, ref): React.ReactElement => { - const { +export default React.forwardRef( + ( + { size, style, beforeIcon, @@ -27,9 +27,10 @@ export default React.forwardRef( className, insideClassName, children, - ...rest - } = props; - + ...props + }, + ref + ): React.ReactElement => { const getButtonStyle = (): string => { switch (style ?? "default") { case "default": @@ -83,7 +84,7 @@ export default React.forwardRef( }; return ( - + ( - (props, ref): React.ReactElement => { - const { children, ...rest } = props; + ({ children, ...props }, ref): React.ReactElement => { return ( - + {children} ); diff --git a/components/ui/Slider.tsx b/components/ui/Slider.tsx index 3e336dc..2af3987 100644 --- a/components/ui/Slider.tsx +++ b/components/ui/Slider.tsx @@ -2,8 +2,7 @@ import React from "react"; import Slider, { SliderProps } from "@react-native-community/slider"; export default React.forwardRef( - (props, ref): React.ReactElement => { - const { ...rest } = props; + ({ ...props }, ref): React.ReactElement => { return ( ( minimumTrackTintColor="#F97316" maximumTrackTintColor="#F97316" {...ref} - {...rest} + {...props} /> ); } diff --git a/components/ui/Text.tsx b/components/ui/Text.tsx index f37b73b..667d79e 100644 --- a/components/ui/Text.tsx +++ b/components/ui/Text.tsx @@ -20,18 +20,10 @@ export interface ExtendedTextProps extends TextProps { } export default React.forwardRef( - (props, ref): React.ReactElement => { - const { - position, - color, - size, - weight, - isLink, - className, - children, - ...rest - } = props; - + ( + { position, color, size, weight, isLink, className, children, ...props }, + ref + ): React.ReactElement => { const buildClassName = () => { const textSize = toTextSize(size ?? "lg"); const textColor = toTextColor(color ?? "black"); @@ -54,7 +46,7 @@ export default React.forwardRef( }; return ( - + {children} ); diff --git a/model/User.ts b/model/User.ts new file mode 100644 index 0000000..d671765 --- /dev/null +++ b/model/User.ts @@ -0,0 +1,146 @@ +import { + EHealthProblem, + ESleepLevel, + ESport, + ESportLevel, +} from "./enums/Enums"; + +export class User { + private _name: string; + private _age: number; + private _height: number; + private _weight: number; + private _sexe: boolean; // true = Male, false = Female + private _logo: string; + private _nbSessionPerWeek: number; + private _goal: string; + private _healthProblems: EHealthProblem[]; + private _sport: ESport; + private _sleepLevel: ESleepLevel; + private _sportLevel: ESportLevel; + + constructor( + name: string, + age: number, + height: number, + weight: number, + sexe: boolean, + logo: string, + nbSessionPerWeek: number, + goal: string, + healthProblems: EHealthProblem[], + sport: ESport, + sleepLevel: ESleepLevel, + sportLevel: ESportLevel + ) { + this._name = name; + this._age = age; + this._height = height; + this._weight = weight; + this._sexe = sexe; + this._logo = logo; + this._nbSessionPerWeek = nbSessionPerWeek; + this._goal = goal; + this._healthProblems = healthProblems; + this._sport = sport; + this._sleepLevel = sleepLevel; + this._sportLevel = sportLevel; + } + + get name(): string { + return this._name; + } + + get age(): number { + return this._age; + } + + get height(): number { + return this._height; + } + + get weight(): number { + return this._weight; + } + + get sexe(): boolean { + return this._sexe; + } + + get logo(): string { + return this._logo; + } + + get nbSessionPerWeek(): number { + return this._nbSessionPerWeek; + } + + get goals(): string { + return this._goal; + } + + get healthProblems(): EHealthProblem[] { + return this._healthProblems; + } + + get sports(): ESport { + return this._sport; + } + + get sleepLevel(): ESleepLevel { + return this._sleepLevel; + } + + get sportLevel(): ESportLevel { + return this._sportLevel; + } + + // Setters + set name(value: string) { + this._name = value; + } + + set age(value: number) { + this._age = value; + } + + set height(value: number) { + this._height = value; + } + + set weight(value: number) { + this._weight = value; + } + + set sexe(value: boolean) { + this._sexe = value; + } + + set logo(value: string) { + this._logo = value; + } + + set nbSessionPerWeek(value: number) { + this._nbSessionPerWeek = value; + } + + set goals(value: string) { + this._goal = value; + } + + set healthProblems(value: EHealthProblem[]) { + this._healthProblems = value; + } + + set sports(value: ESport) { + this._sport = value; + } + + set sleepLevel(value: ESleepLevel) { + this._sleepLevel = value; + } + + set sportLevel(value: ESportLevel) { + this._sportLevel = value; + } +} diff --git a/model/enums/Enums.ts b/model/enums/Enums.ts new file mode 100644 index 0000000..f147943 --- /dev/null +++ b/model/enums/Enums.ts @@ -0,0 +1,42 @@ +export const Goals = [ + "WEIGHT_LOSE", + "IMPROVE_MUSCLE", + "WEIGHT_GAIN", + "IMPROVE_STAMINA", + "KEEP_FIT", +] as const; + +export const SportLevels = [ + "NOT_SPORTY", + "BEGINNER", + "SPORTY", + "VERY_SPORTY", + "PERFORMER", +] as const; + +export const Sports = [ + "RUNNING", + "WALKING", + "RANDO", + "SKATEBOARD", + "BIKING", + "BASKETBALL", + "CARDIO", + "YOGA", + "ELSE", +] as const; + +export const SleepLevels = [ + "TERRIBLE", + "VERY_BAD", + "BAD", + "GOOD", + "EXCELLENT", +] as const; + +export type EGoal = (typeof Goals)[number]; +export type ESportLevel = (typeof SportLevels)[number]; +export type ESport = (typeof Sports)[number]; +export type ESleepLevel = (typeof SleepLevels)[number]; + +export type EHealthProblem = "ARTHROSE" | "MIGRAINE"; diff --git a/package-lock.json b/package-lock.json index 7abaa8c..923d197 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "react-dom": "18.3.1", "react-hook-form": "^7.54.2", "react-native": "0.76.6", + "react-native-element-dropdown": "^2.12.4", "react-native-gesture-handler": "^2.20.2", "react-native-gifted-charts": "^1.4.54", "react-native-reanimated": "^3.16.7", @@ -12247,6 +12248,22 @@ "node": ">=10" } }, + "node_modules/react-native-element-dropdown": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/react-native-element-dropdown/-/react-native-element-dropdown-2.12.4.tgz", + "integrity": "sha512-abZc5SVji9FIt7fjojRYrbuvp03CoeZJrgvezQoDoSOrpiTqkX69ix5m+j06W2AVncA0VWvbT+vCMam8SoVadw==", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.21" + }, + "engines": { + "node": ">= 16.0.0" + }, + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, "node_modules/react-native-gesture-handler": { "version": "2.22.0", "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-2.22.0.tgz", diff --git a/package.json b/package.json index d413f18..9bb52a4 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "react-dom": "18.3.1", "react-hook-form": "^7.54.2", "react-native": "0.76.6", + "react-native-element-dropdown": "^2.12.4", "react-native-gesture-handler": "^2.20.2", "react-native-gifted-charts": "^1.4.54", "react-native-reanimated": "^3.16.7",