1- import React from 'react' ;
2- import { View , ScrollView , TouchableOpacity , ActivityIndicator , useColorScheme } from 'react-native' ;
3- import { useRouter } from 'expo-router' ;
4- import { useSafeAreaInsets } from 'react-native-safe-area-context' ;
5- import { ThemedText } from '@/components/themed-text' ;
6- import { ThemedView } from '@/components/themed-view' ;
7- import { IconSymbol } from '@/components/ui/icon-symbol' ;
8- import { useGetChildrenByGuardianId , useGetGuardianById } from '@skillspark/api-client' ;
9- import { Colors , AppColors } from '@/constants/theme' ;
10- import { ChildListItem } from '@/components/ChildListItem' ;
11- import { SectionHeader } from '@/components/SectionHeader' ;
12- import { useAuthContext } from '@/hooks/use-auth-context' ;
13- import { ErrorScreen } from '@/components/ErrorScreen' ;
1+ import React from "react" ;
2+ import {
3+ View ,
4+ ScrollView ,
5+ TouchableOpacity ,
6+ ActivityIndicator ,
7+ useColorScheme ,
8+ } from "react-native" ;
9+ import { useRouter } from "expo-router" ;
10+ import { useSafeAreaInsets } from "react-native-safe-area-context" ;
11+ import { ThemedText } from "@/components/themed-text" ;
12+ import { ThemedView } from "@/components/themed-view" ;
13+ import { IconSymbol } from "@/components/ui/icon-symbol" ;
14+ import {
15+ useGetChildrenByGuardianId ,
16+ useGetGuardianById ,
17+ } from "@skillspark/api-client" ;
18+ import { Colors , AppColors } from "@/constants/theme" ;
19+ import { ChildListItem } from "@/components/ChildListItem" ;
20+ import { SectionHeader } from "@/components/SectionHeader" ;
21+ import { useAuthContext } from "@/hooks/use-auth-context" ;
22+ import { ErrorScreen } from "@/components/ErrorScreen" ;
1423
1524export default function FamilyListScreen ( ) {
1625 const router = useRouter ( ) ;
1726 const insets = useSafeAreaInsets ( ) ;
1827 const colorScheme = useColorScheme ( ) ;
19- const theme = Colors [ colorScheme ?? ' light' ] ;
28+ const theme = Colors [ colorScheme ?? " light" ] ;
2029
2130 const { guardianId } = useAuthContext ( ) ;
2231
23- const { data : guardianResponse , isLoading : guardianLoading } = useGetGuardianById ( guardianId ! , {
24- query : {
25- enabled : ! ! guardianId ,
26- }
27- } ) ;
28- const { data : childrenResponse , isLoading : childrenLoading } = useGetChildrenByGuardianId ( guardianId ! , {
29- query : {
30- enabled : ! ! guardianId ,
31- }
32- } ) ;
32+ const { data : guardianResponse , isLoading : guardianLoading } =
33+ useGetGuardianById ( guardianId ! , {
34+ query : {
35+ enabled : ! ! guardianId ,
36+ } ,
37+ } ) ;
38+ const { data : childrenResponse , isLoading : childrenLoading } =
39+ useGetChildrenByGuardianId ( guardianId ! , {
40+ query : {
41+ enabled : ! ! guardianId ,
42+ } ,
43+ } ) ;
3344
34- const guardian = guardianResponse ?. status === 200 ? guardianResponse . data : null ;
35- const children = childrenResponse ?. status === 200 ? childrenResponse . data : [ ] ;
45+ const guardian =
46+ guardianResponse ?. status === 200 ? guardianResponse . data : null ;
47+ const children =
48+ childrenResponse ?. status === 200 ? childrenResponse . data : [ ] ;
3649
3750 const handleAddChild = ( ) => {
38- router . push ( ' /family/manage' ) ;
51+ router . push ( " /family/manage" ) ;
3952 } ;
4053
4154 const handleEditChild = ( child : any ) => {
4255 router . push ( {
43- pathname : ' /family/manage' ,
56+ pathname : " /family/manage" ,
4457 params : {
4558 id : child . id ,
4659 name : child . name ,
4760 birth_month : child . birth_month ,
4861 birth_year : child . birth_year ,
49- school_id : child . school_id ?? '' ,
62+ school_id : child . school_id ?? "" ,
5063 interests : child . interests ?? [ ] ,
5164 } ,
5265 } ) ;
@@ -68,61 +81,111 @@ export default function FamilyListScreen() {
6881 < ThemedView className = "flex-1" style = { { paddingTop : insets . top } } >
6982 < View className = "flex-row items-center justify-between px-5 py-3" >
7083 < TouchableOpacity
71- onPress = { ( ) => router . navigate ( ' /profile' ) }
84+ onPress = { ( ) => router . navigate ( " /profile" ) }
7285 className = "w-10 justify-center items-start"
7386 hitSlop = { { top : 10 , bottom : 10 , left : 10 , right : 10 } }
7487 >
7588 < IconSymbol name = "chevron.left" size = { 24 } color = { theme . text } />
7689 </ TouchableOpacity >
77- < ThemedText className = "text-xl text-center font-nunito-bold" > Family Information</ ThemedText >
90+ < ThemedText className = "text-xl text-center font-nunito-bold" >
91+ Family Information
92+ </ ThemedText >
7893 < View className = "w-10" />
7994 </ View >
8095
81- < ScrollView contentContainerStyle = { { paddingHorizontal : 20 , paddingTop : 12 } } showsVerticalScrollIndicator = { false } >
82- < TouchableOpacity className = "flex-row items-start py-4 gap-3" activeOpacity = { 0.7 } >
96+ < ScrollView
97+ contentContainerStyle = { { paddingHorizontal : 20 , paddingTop : 12 } }
98+ showsVerticalScrollIndicator = { false }
99+ >
100+ < TouchableOpacity
101+ className = "flex-row items-start py-4 gap-3"
102+ activeOpacity = { 0.7 }
103+ >
83104 < View className = "w-11 h-11 items-center justify-center" >
84105 < IconSymbol name = "person.circle" size = { 40 } color = { theme . text } />
85106 </ View >
86107 < View className = "flex-1 gap-1" >
87- < ThemedText className = "text-base font-nunito-semibold" > { guardian ?. name } </ ThemedText >
88- < ThemedText className = "text-[13px] font-nunito" style = { { color : AppColors . mutedText } } > @{ guardian ?. username } </ ThemedText >
89- < ThemedText className = "text-[13px] font-nunito" style = { { color : AppColors . mutedText } } > { guardian ?. email } </ ThemedText >
108+ < ThemedText className = "text-base font-nunito-semibold" >
109+ { guardian ?. name }
110+ </ ThemedText >
111+ < ThemedText
112+ className = "text-[13px] font-nunito"
113+ style = { { color : AppColors . mutedText } }
114+ >
115+ @{ guardian ?. username }
116+ </ ThemedText >
117+ < ThemedText
118+ className = "text-[13px] font-nunito"
119+ style = { { color : AppColors . mutedText } }
120+ >
121+ { guardian ?. email }
122+ </ ThemedText >
90123 </ View >
91124 </ TouchableOpacity >
92- < View className = "h-px my-3" style = { { backgroundColor : AppColors . divider } } />
125+ < View
126+ className = "h-px my-3"
127+ style = { { backgroundColor : AppColors . divider } }
128+ />
93129 < SectionHeader
94130 title = "Child Profile"
95131 actionLabel = "add profile +"
96132 onAction = { handleAddChild }
97133 />
98134 { children . length === 0 && (
99- < ThemedText className = "text-sm pb-4 font-nunito" style = { { color : AppColors . subtleText } } > No child profiles added yet.</ ThemedText >
135+ < ThemedText
136+ className = "text-sm pb-4 font-nunito"
137+ style = { { color : AppColors . subtleText } }
138+ >
139+ No child profiles added yet.
140+ </ ThemedText >
100141 ) }
101142 { children . map ( ( child : any , idx : number ) => (
102143 < React . Fragment key = { child . id } >
103144 < ChildListItem
104145 child = { child }
105146 onPress = { ( ) => handleEditChild ( child ) }
106147 />
107- { idx < children . length - 1 && < View className = "h-px my-3" style = { { backgroundColor : AppColors . divider } } /> }
148+ { idx < children . length - 1 && (
149+ < View
150+ className = "h-px my-3"
151+ style = { { backgroundColor : AppColors . divider } }
152+ />
153+ ) }
108154 </ React . Fragment >
109155 ) ) }
110- < View className = "h-px my-3" style = { { backgroundColor : AppColors . divider } } />
156+ < View
157+ className = "h-px my-3"
158+ style = { { backgroundColor : AppColors . divider } }
159+ />
111160 < SectionHeader
112161 title = "Emergency Contact"
113162 actionLabel = "add contact +"
114163 onAction = { ( ) => { } }
115164 />
116165 { /* TODO: Replace with real emergency contact data from API */ }
117- < TouchableOpacity className = "flex-row items-start py-4 gap-3" activeOpacity = { 0.7 } >
166+ < TouchableOpacity
167+ className = "flex-row items-start py-4 gap-3"
168+ activeOpacity = { 0.7 }
169+ >
118170 < View className = "w-11 h-11 items-center justify-center" >
119171 < IconSymbol name = "person.circle" size = { 40 } color = { theme . text } />
120172 </ View >
121173 < View className = "flex-1 gap-1" >
122- < ThemedText className = "text-base font-nunito-semibold" > Martha Smith</ ThemedText >
123- < ThemedText className = "text-[13px] font-nunito" style = { { color : AppColors . mutedText } } > (555) 123-4567</ ThemedText >
174+ < ThemedText className = "text-base font-nunito-semibold" >
175+ Martha Smith
176+ </ ThemedText >
177+ < ThemedText
178+ className = "text-[13px] font-nunito"
179+ style = { { color : AppColors . mutedText } }
180+ >
181+ (555) 123-4567
182+ </ ThemedText >
124183 </ View >
125- < IconSymbol name = "chevron.right" size = { 18 } color = { AppColors . subtleText } />
184+ < IconSymbol
185+ name = "chevron.right"
186+ size = { 18 }
187+ color = { AppColors . subtleText }
188+ />
126189 </ TouchableOpacity >
127190 < View className = "h-10" />
128191 </ ScrollView >
0 commit comments