-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
99 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
import React, {useState, useEffect} from "react"; | ||
import { View, ScrollView } from "react-native"; | ||
import DoctorVideo from "@/components/cards/DoctorVideo"; | ||
import { useRouter } from "expo-router"; | ||
import { DoctorCard } from "./types"; | ||
import { supabase } from "../supabase"; | ||
const VideoCall = () => { | ||
const router = useRouter(); | ||
const [appointment, setAppointment]=useState<any[]>([]); | ||
// import React, {useState, useEffect} from "react"; | ||
// import { View, ScrollView } from "react-native"; | ||
// import DoctorVideo from "@/components/cards/DoctorVideo"; | ||
// import { useRouter } from "expo-router"; | ||
// import { DoctorCard } from "./types"; | ||
// import { supabase } from "../supabase"; | ||
// const VideoCall = () => { | ||
// const router = useRouter(); | ||
// const [appointment, setAppointment]=useState<any[]>([]); | ||
|
||
useEffect(()=>{ | ||
const fetchAppointments=async()=>{ | ||
const {data, error}=await supabase.auth.getUser(); | ||
if(error) throw error; | ||
const userId=data?.user?.id; | ||
const {data:AppointmentData, error:Error}=await supabase.from("appointment").select("*, doctor(name,image)").eq("patient_id", userId).eq("package","Video Call") | ||
if(Error) throw Error | ||
if(AppointmentData){ | ||
setAppointment(AppointmentData); | ||
} | ||
} | ||
fetchAppointments(); | ||
},[]) | ||
// useEffect(()=>{ | ||
// const fetchAppointments=async()=>{ | ||
// const {data, error}=await supabase.auth.getUser(); | ||
// if(error) throw error; | ||
// const userId=data?.user?.id; | ||
// const {data:AppointmentData, error:Error}=await supabase.from("appointment").select("*, doctor(name,image)").eq("patient_id", userId).eq("package","Video Call") | ||
// if(Error) throw Error | ||
// if(AppointmentData){ | ||
// setAppointment(AppointmentData); | ||
// } | ||
// } | ||
// fetchAppointments(); | ||
// },[]) | ||
|
||
const handlePress = (appointmentId:any) => { | ||
router.push({ | ||
pathname: "/chat-history/VideoRecord", | ||
params: {appointmentId}, | ||
}); | ||
}; | ||
return ( | ||
<View style={{ backgroundColor: "white" }}> | ||
<ScrollView style={{ backgroundColor: "#FAFAFA", paddingBottom: 6 }}> | ||
{appointment.map((appointments, index) => ( | ||
<DoctorVideo | ||
key={index} | ||
onPress={() => handlePress(appointments.id)} | ||
doctorName={appointments.doctor.name} | ||
doctorImage={appointments.doctor.image} | ||
callType={appointments.package} | ||
callDay={appointments.appointment_date} | ||
callTime={appointments.appointment_time.slice(0,5)} | ||
isVideoCallScreen={false} | ||
/> | ||
))} | ||
</ScrollView> | ||
</View> | ||
); | ||
}; | ||
// const handlePress = (appointmentId:any) => { | ||
// router.push({ | ||
// pathname: "/chat-history/VideoRecord", | ||
// params: {appointmentId}, | ||
// }); | ||
// }; | ||
// return ( | ||
// <View style={{ backgroundColor: "white" }}> | ||
// <ScrollView style={{ backgroundColor: "#FAFAFA", paddingBottom: 6 }}> | ||
// {appointment.map((appointments, index) => ( | ||
// <DoctorVideo | ||
// key={index} | ||
// onPress={() => handlePress(appointments.id)} | ||
// doctorName={appointments.doctor.name} | ||
// doctorImage={appointments.doctor.image} | ||
// callType={appointments.package} | ||
// callDay={appointments.appointment_date} | ||
// callTime={appointments.appointment_time.slice(0,5)} | ||
// isVideoCallScreen={false} | ||
// /> | ||
// ))} | ||
// </ScrollView> | ||
// </View> | ||
// ); | ||
// }; | ||
|
||
export default VideoCall; | ||
// export default VideoCall; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
import DoctorCard from "@/components/cards/doctorCard"; | ||
import CallsCard, { CallsType } from "@/components/chats/voiceCard"; | ||
import { router } from "expo-router"; | ||
import { useEffect, useState } from "react"; | ||
import { Text, View, ScrollView, ImageSourcePropType } from "react-native"; | ||
import { FlatList } from "react-native"; | ||
import { supabase } from "../supabase"; | ||
// import DoctorCard from "@/components/cards/doctorCard"; | ||
// import CallsCard, { CallsType } from "@/components/chats/voiceCard"; | ||
// import { router } from "expo-router"; | ||
// import { useEffect, useState } from "react"; | ||
// import { Text, View, ScrollView, ImageSourcePropType } from "react-native"; | ||
// import { FlatList } from "react-native"; | ||
// import { supabase } from "../supabase"; | ||
|
||
|
||
export default function VoiceCalls() { | ||
const[appointment, setAppointment]=useState<any[]>([]); | ||
// export default function VoiceCalls() { | ||
// const[appointment, setAppointment]=useState<any[]>([]); | ||
|
||
useEffect(()=>{ | ||
const fetchAppointments=async()=>{ | ||
const {data, error}=await supabase.auth.getUser(); | ||
if(error) throw error; | ||
const userId=data?.user?.id; | ||
const {data:AppointmentData, error:Error}=await supabase.from("appointment").select("*, doctor(name,image)").eq("patient_id", userId).eq("package","Voice Call") | ||
if(Error) throw Error | ||
if(AppointmentData){ | ||
setAppointment(AppointmentData); | ||
} | ||
} | ||
fetchAppointments(); | ||
},[]) | ||
const renderItems = (appointment: any, index:any) => { | ||
return ( | ||
<> | ||
<CallsCard | ||
key={index} | ||
name={appointment.doctor.name} | ||
type={appointment.package} | ||
date={appointment.appointment_date} | ||
time={appointment.appointment_time.slice(0,5)} | ||
image={appointment.doctor.image} | ||
onPress={()=>router.push({pathname:'chat-history/singleCall', params:{appointmentId:appointment.id}})} | ||
/> | ||
</> | ||
) | ||
} | ||
// useEffect(()=>{ | ||
// const fetchAppointments=async()=>{ | ||
// const {data, error}=await supabase.auth.getUser(); | ||
// if(error) throw error; | ||
// const userId=data?.user?.id; | ||
// const {data:AppointmentData, error:Error}=await supabase.from("appointment").select("*, doctor(name,image)").eq("patient_id", userId).eq("package","Voice Call") | ||
// if(Error) throw Error | ||
// if(AppointmentData){ | ||
// setAppointment(AppointmentData); | ||
// } | ||
// } | ||
// fetchAppointments(); | ||
// },[]) | ||
// const renderItems = (appointment: any, index:any) => { | ||
// return ( | ||
// <> | ||
// <CallsCard | ||
// key={index} | ||
// name={appointment.doctor.name} | ||
// type={appointment.package} | ||
// date={appointment.appointment_date} | ||
// time={appointment.appointment_time.slice(0,5)} | ||
// image={appointment.doctor.image} | ||
// onPress={()=>router.push({pathname:'chat-history/singleCall', params:{appointmentId:appointment.id}})} | ||
// /> | ||
// </> | ||
// ) | ||
// } | ||
|
||
return ( | ||
<> | ||
{appointment.map((appointmentItem,index) => renderItems(appointmentItem,index))} | ||
</> | ||
) | ||
} | ||
// return ( | ||
// <> | ||
// {appointment.map((appointmentItem,index) => renderItems(appointmentItem,index))} | ||
// </> | ||
// ) | ||
// } |