Fix profile type

This commit is contained in:
Milan Paunovic
2024-08-21 20:30:07 +02:00
parent 6b42476ef0
commit 55a3091023
4 changed files with 24 additions and 19 deletions

View File

@ -1,6 +1,6 @@
import React, {useEffect, useState} from "react";
import {Button, Text, TextInput} from "react-native";
import {Checkbox, Picker, TextField, View} from "react-native-ui-lib";
import {Button, TextInput} from "react-native";
import {Checkbox, Picker, TextField, View, Text} from "react-native-ui-lib";
import useAuth from "@/hooks/firebase/useAuth";
import useChildren from "@/hooks/firebase/useChildren";
import useCaregivers from "@/hooks/firebase/useCaregivers";
@ -25,20 +25,17 @@ const Screen: React.FC = () => {
} = useAuth();
const {
children,
child,
setChild,
handleNewChild,
} = useChildren(user);
const {data: childrenByParentId} = useGetChildrenByParentId()
const {data: children} = useGetChildrenByParentId()
const {
caregivers,
caregiver,
setCaregiver,
fetchCaregivers,
handleNewCaregiver,
} = useCaregivers();
const {mutateAsync: createSubUser} = useCreateSubUser()
@ -121,13 +118,15 @@ const Screen: React.FC = () => {
</View>
);
console.log(profileType, profileData)
return (
<View>
{user ? (
<View paddingH-20>
{profileType === ProfileType.parent && <Text>Parent</Text>}
{profileType === ProfileType.child && <Text>Child</Text>}
{profileType === ProfileType.caregiver && <Text>Caregiver</Text>}
<View paddingH-20 marginT-20>
{profileType === ProfileType.PARENT && <Text>Parent</Text>}
{profileType === ProfileType.CHILD && <Text>Child</Text>}
{profileType === ProfileType.CAREGIVER && <Text>Caregiver</Text>}
<Button title="Sign Out" onPress={handleSignOut}/>
<TextField
placeholder={"Child Name"}
@ -198,7 +197,7 @@ const Screen: React.FC = () => {
/>
<View margin-20>
<Text>Children:</Text>
{children.map((child) => (
{children?.map((child) => (
<View key={child.name} row>
<Text>Name: {child.name} </Text>
<Picker label="Pick Caregiver">