@@ -12,7 +12,6 @@ import {
12
12
import React , { useContext , useEffect , useState } from "react" ;
13
13
import { useFonts as useFontsExpo } from "expo-font" ;
14
14
import { useNavigation } from "@react-navigation/native" ;
15
- import Line from "@/components/Line" ;
16
15
import { router } from "expo-router" ;
17
16
import { SvgXml } from "react-native-svg" ;
18
17
import {
@@ -21,11 +20,6 @@ import {
21
20
} from "@/assets/icons/Profile/Icons" ;
22
21
import { ThemeContext } from "@/ctx/ThemeContext" ;
23
22
import { blackHeart } from "@/components/UI/icons/blackHeart" ;
24
- import Chips from "@/components/UI/ChipsComponent" ;
25
- import {
26
- fullSmallBlueStar ,
27
- fullSmallWhiteStar ,
28
- } from "@/components/UI/icons/star" ;
29
23
import { Session } from "@supabase/supabase-js" ;
30
24
import { supabase } from "@/lib/supabase" ;
31
25
import {
@@ -34,17 +28,15 @@ import {
34
28
getPatientData ,
35
29
} from "@/utils/LoggedInUser" ;
36
30
import { Doctor } from "@/constants/Types" ;
37
- import DoctorDetails from "./Booking/Doctor_details" ;
38
31
import DoctorComponent from "@/components/DoctorComponent" ;
39
32
import { star } from "@/assets/icons/star" ;
40
33
import { whiteHeart } from "@/assets/icons/whiteHeart" ;
41
34
import { blueheart } from '@/assets/icons/blueHeart' ;
42
35
import NofoundComponent from "@/components/NofoundComponent" ;
43
- import { useAuth } from "@/ctx/AuthContext" ;
36
+ import { AuthContext , useAuth } from "@/ctx/AuthContext" ;
44
37
import RemovefavoritePopup from "@/components/RemovefavoriteIndexPopup" ;
45
38
46
39
export default function Index ( ) {
47
- const [ session , setSession ] = useState < Session | null > ( null ) ;
48
40
const [ searchTerm , setSearchTerm ] = useState < string > ( "" ) ;
49
41
const [ userData , setUserData ] = useState < [ ] > ( [ ] ) ;
50
42
const [ patientData , setPatientData ] = useState ( null ) ;
@@ -54,7 +46,6 @@ export default function Index() {
54
46
const { theme, changeTheme } = useContext ( ThemeContext ) ;
55
47
const navigation = useNavigation ( ) ;
56
48
const [ text , setText ] = useState ( "" ) ;
57
- const [ isLoading , setIsLoading ] = useState ( false ) ;
58
49
const [ doctors , setDoctors ] = useState < Doctor [ ] > ( [ ] ) ;
59
50
const [ greeting , setGreeting ] = useState ( "" ) ;
60
51
const { authType, imageUrl : otherAuthImageUrl } = useAuth ( ) ;
@@ -66,6 +57,7 @@ export default function Index() {
66
57
const [ favoriteDoctors , setFavoriteDoctors ] = useState < number [ ] > ( [ ] )
67
58
const [ loggeduser , setLoggedUser ] = useState < string > ( )
68
59
const [ profile , setProfile ] = useState < any > ( null )
60
+ const { userId } = useContext ( AuthContext ) ;
69
61
70
62
const [ fontsLoaded ] = useFontsExpo ( {
71
63
"Urbanist-regular" : require ( "@/assets/fonts/Urbanist-Regular.ttf" ) ,
@@ -86,11 +78,11 @@ export default function Index() {
86
78
} , [ ] ) ;
87
79
88
80
useEffect ( ( ) => {
89
- if ( userData ?. id ) {
90
- fetchPatientData ( userData ?. id , setPatientData ) ;
91
- getUserImageUrl ( "patients" , userData , setImageUrl ) ;
81
+ if ( userId ) {
82
+ fetchPatientData ( userId , setPatientData ) ;
83
+ getUserImageUrl ( "patients" , userId , setImageUrl ) ;
92
84
}
93
- } , [ userData ] ) ;
85
+ } , [ userId ] ) ;
94
86
95
87
useEffect ( ( ) => {
96
88
if ( imageUrl . length > 0 ) {
@@ -271,8 +263,8 @@ export default function Index() {
271
263
source = { {
272
264
uri :authType && authType !== "apple"
273
265
? otherAuthImageUrl
274
- : `${ CDNURL + userData ?. id + "/" + profilePhoto } ` ,
275
- } }
266
+ : `${ CDNURL + userId + "/" + profilePhoto } ` ,
267
+ } }
276
268
/>
277
269
</ View >
278
270
< View
@@ -832,4 +824,4 @@ const styles = StyleSheet.create({
832
824
color : "#246BFD" ,
833
825
fontSize : 16 ,
834
826
} ,
835
- } ) ;
827
+ } ) ;
0 commit comments