-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: New care group screen #76
Changes from 1 commit
9a9e50e
9c2fcec
844ac6e
347dcdb
2aa027d
28ab7ea
bd7a930
0714d24
789b916
cc1d5e7
442fbef
7bf28b0
1cd68e1
f7445eb
7dc08ff
53c1628
fcd7240
7d50b65
4b9af68
7fd2ae3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
|
||
import { useNavigation } from '@react-navigation/native'; | ||
import { IconButton } from 'react-native-paper'; | ||
|
||
import Plus from '../../assets/profile/plus.svg'; | ||
import { AppStackNavigation } from '../../navigation/types'; | ||
|
||
export function AddButtom() { | ||
const navigation = useNavigation<AppStackNavigation>(); | ||
|
||
return ( | ||
<IconButton | ||
className="align-center m-2 flex h-[50px] w-[52px] justify-center rounded-xl bg-carewallet-blue" | ||
mode="contained" | ||
icon={({ color }) => <Plus fill={color} />} | ||
onPress={() => navigation.goBack()} | ||
/> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import { Text, TouchableOpacity, View } from 'react-native'; | ||
|
||
import { useNavigation } from '@react-navigation/native'; | ||
|
||
import { AppStackNavigation } from '../../navigation/types'; | ||
import { GroupRole, Role } from '../../types/group'; | ||
import { User } from '../../types/user'; | ||
|
||
interface CareProps { | ||
user: User | undefined; | ||
role: GroupRole | undefined; | ||
} | ||
|
||
export function CareTaker({ user, role }: CareProps) { | ||
if (!user) return null; | ||
const navigation = useNavigation<AppStackNavigation>(); | ||
// const { user: signedInUser, group } = useCareWalletContext(); | ||
// const [activeUser, setActiveUser] = useState(signedInUser.userID); | ||
|
||
const handlePress = () => { | ||
navigation.navigate('Profile'); | ||
}; | ||
|
||
return ( | ||
<TouchableOpacity onPress={handlePress}> | ||
<View className="mb-2 flex flex-row items-center rounded-xl border border-carewallet-lightgray bg-carewallet-white"> | ||
<View className="mb-3 ml-3 h-20 w-20 rounded-full border border-carewallet-lightgray bg-carewallet-white" /> | ||
<View className="mt-5 flex h-fit max-h-fit min-h-fit flex-row items-center"> | ||
<View className="mb-5 ml-8"> | ||
<Text className="flex-wrap text-left font-carewallet-manrope-semibold text-xl text-carewallet-black"> | ||
{user.first_name} {user.last_name} | ||
</Text> | ||
<View className="flex w-[60vw] flex-row pt-3"> | ||
<View className="flex flex-col"> | ||
<Text className="items-center justify-center text-left font-carewallet-manrope text-xs text-carewallet-black"> | ||
{`${role?.role} ${role?.role !== Role.PATIENT ? 'CARETAKER' : ''}`} | ||
</Text> | ||
<Text className="items-center justify-center text-left font-carewallet-manrope text-xs text-carewallet-black"> | ||
{user.phone ? user.phone : user.email} | ||
</Text> | ||
</View> | ||
</View> | ||
</View> | ||
</View> | ||
</View> | ||
</TouchableOpacity> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,100 @@ | ||||||||||||||||
import React, { useState } from 'react'; | ||||||||||||||||
import { ActivityIndicator, ScrollView, View } from 'react-native'; | ||||||||||||||||
|
||||||||||||||||
import { useNavigation } from '@react-navigation/native'; | ||||||||||||||||
import { GestureHandlerRootView } from 'react-native-gesture-handler'; | ||||||||||||||||
import { Button, Text } from 'react-native-paper'; | ||||||||||||||||
|
||||||||||||||||
import Settings from '../../assets/profile/settings.svg'; | ||||||||||||||||
import { BackButton } from '../../components/nav_buttons/BackButton'; | ||||||||||||||||
import { AddButtom } from '../../components/profile/AddButton'; | ||||||||||||||||
import { CareTaker } from '../../components/profile/CareTaker'; | ||||||||||||||||
import { useCareWalletContext } from '../../contexts/CareWalletContext'; | ||||||||||||||||
import { AppStackNavigation } from '../../navigation/types'; | ||||||||||||||||
import { useGroup } from '../../services/group'; | ||||||||||||||||
import { useUsers } from '../../services/user'; | ||||||||||||||||
|
||||||||||||||||
export function CareGroup() { | ||||||||||||||||
const navigation = useNavigation<AppStackNavigation>(); | ||||||||||||||||
const { user: signedInUser, group } = useCareWalletContext(); | ||||||||||||||||
const [activeUser] = useState(signedInUser.userID); | ||||||||||||||||
const { roles, rolesAreLoading } = useGroup(group.groupID); | ||||||||||||||||
const { users, usersAreLoading } = useUsers( | ||||||||||||||||
roles?.map((role) => role.user_id) ?? [] | ||||||||||||||||
); | ||||||||||||||||
|
||||||||||||||||
if (rolesAreLoading || usersAreLoading) { | ||||||||||||||||
return ( | ||||||||||||||||
<View className="w-full flex-1 items-center justify-center bg-carewallet-white text-3xl"> | ||||||||||||||||
<ActivityIndicator size="large" /> | ||||||||||||||||
<Text>Loading...</Text> | ||||||||||||||||
</View> | ||||||||||||||||
); | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
if (!roles || !users) { | ||||||||||||||||
return ( | ||||||||||||||||
<View className="w-full flex-1 items-center justify-center bg-carewallet-white text-3xl"> | ||||||||||||||||
<Text className="text-xl">Could Not Load Profile...</Text> | ||||||||||||||||
</View> | ||||||||||||||||
); | ||||||||||||||||
} | ||||||||||||||||
return ( | ||||||||||||||||
<GestureHandlerRootView className="bg-carewallet-white pt-5"> | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What this for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i have no idea but i removed it |
||||||||||||||||
<View className="flex flex-row items-center border-b border-carewallet-lightgray pb-5"> | ||||||||||||||||
<View className="pl-2"> | ||||||||||||||||
<BackButton /> | ||||||||||||||||
</View> | ||||||||||||||||
<View className="mx-auto "> | ||||||||||||||||
<Text className="text-center font-carewallet-manrope-bold text-lg text-carewallet-blue "> | ||||||||||||||||
Care Group | ||||||||||||||||
</Text> | ||||||||||||||||
</View> | ||||||||||||||||
<View className="pr-2"> | ||||||||||||||||
<AddButtom /> | ||||||||||||||||
</View> | ||||||||||||||||
</View> | ||||||||||||||||
|
||||||||||||||||
<ScrollView> | ||||||||||||||||
<View className="bg-carewallet-lightergray"> | ||||||||||||||||
<View className="flex h-[10vh] items-center"> | ||||||||||||||||
<View className="h-[10vh] scroll-pb-96"> | ||||||||||||||||
<View className="flex w-full flex-row justify-end text-carewallet-black"> | ||||||||||||||||
<Button | ||||||||||||||||
className="mx-auto mt-2 h-[50px] w-[96vw] items-start justify-center rounded-xl border-carewallet-lightgray bg-carewallet-white" | ||||||||||||||||
textColor="#000000" | ||||||||||||||||
mode="outlined" | ||||||||||||||||
icon={() => <Settings />} // Example using FontAwesome icon | ||||||||||||||||
> | ||||||||||||||||
<Text className="font-carewallet-manrope-semibold"> | ||||||||||||||||
{' '} | ||||||||||||||||
Manage Caregiver Capabiities{' '} | ||||||||||||||||
</Text> | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
</Button> | ||||||||||||||||
</View> | ||||||||||||||||
</View> | ||||||||||||||||
</View> | ||||||||||||||||
|
||||||||||||||||
<View className="mx-2 mt-2 flex h-[180vh] w-[96vw] flex-col items-center rounded-xl"> | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for 180vh here? Scroll view should handle height on its own There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||||||||||||||||
{users | ||||||||||||||||
.filter((user) => user.user_id !== activeUser) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should prob filter out patient as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||||||||||||||||
.map((user) => ( | ||||||||||||||||
<View | ||||||||||||||||
key={user.user_id} // <-- Add key prop here | ||||||||||||||||
onTouchEnd={() => { | ||||||||||||||||
navigation.navigate('Profile'); | ||||||||||||||||
}} | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this able to set the active profile on profile page depending on who you click on? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see ignore my comment from before. I'm trying to do it like this but I'm assuming that the navigate function doesn't take into account the new state even if it was set differently again?:
|
||||||||||||||||
> | ||||||||||||||||
<CareTaker | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noticed a scroll bug when I am scrolling and had pressed on a card it will visit the card after i lift up my finger. Look at other scroll views on how we handled this! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this part should be fixed, although it still will navigate to 'Profile' and not the profile of the person it touches. since the profile component doesn't take in a userId or anything not sure how to navigate to the profile of an actual user without refactoring the profile component. any ideas or is it okay as is? @MattCMcCoy |
||||||||||||||||
user={user} | ||||||||||||||||
role={roles.find((role) => role.user_id === user.user_id)} | ||||||||||||||||
/> | ||||||||||||||||
</View> | ||||||||||||||||
))} | ||||||||||||||||
<View className="h-[70vh] pt-10"></View> | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||||||||||||||||
</View> | ||||||||||||||||
</View> | ||||||||||||||||
</ScrollView> | ||||||||||||||||
</GestureHandlerRootView> | ||||||||||||||||
); | ||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,11 @@ export default function Profile() { | |
/> | ||
</View> | ||
<View className="mb-auto flex-1 items-center"> | ||
<CircleCard Icon={<Settings />} ButtonText="Settings" /> | ||
<CircleCard | ||
Icon={<Settings />} | ||
ButtonText="Settings" | ||
onTouchEnd={() => navigation.navigate('CareGroup')} | ||
/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This button is nested in settings on main. So when fixing merge conflicts, let caplan or I know if you have any problems. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in my latest commit i will have allowed it to navigate from the settings page by pressing the 'manage caregiver capabilities' button |
||
</View> | ||
<View className="mb-5 items-center"> | ||
<CircleCard | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be removed. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module carewallet | ||
|
||
go 1.21.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.