Skip to content

Commit

Permalink
feat:remove audio and video
Browse files Browse the repository at this point in the history
  • Loading branch information
Latiah committed Jul 24, 2024
1 parent 8d378b7 commit 6d5d1b6
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 99 deletions.
96 changes: 48 additions & 48 deletions app/chat-history/VideoCall.tsx
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;
16 changes: 8 additions & 8 deletions app/chat-history/chatHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { searchDark } from "@/assets/icons/search";
import { back } from "@/assets/icons/userprofile/icons";
import moment from "moment";
import Chat from "@/components/chats/chat";
import Index from "./VideoCall";
import VoiceCalls from "./voiceCalls";
// import Index from "./VideoCall";
// import VoiceCalls from "./voiceCalls";
import { supabase } from "../supabase";


Expand Down Expand Up @@ -163,11 +163,11 @@ fetchAppointments();
<View className="my-4 w-1/1 justify-between mr-3">
<View className="flex-row justify-between w-[100%]">
<Pressable
className=" flex-initial items-center w-1/3"
className=" flex-initial items-center w-full"
onPress={() => setSelected("Messages")}
>
<Text
className={`font-UrbanistSemiBold text-[18px] ${
className={`font-UrbanistSemiBold text-[18px] text-center ${
selected === "Messages" ? "text-lightblue" : "text-grey"
} pb-2`}
>
Expand All @@ -179,7 +179,7 @@ fetchAppointments();
}`}
/>
</Pressable>
<Pressable
{/* <Pressable
className="flex-initial items-center w-1/3"
onPress={() => setSelected("Calls")}
>
Expand Down Expand Up @@ -210,7 +210,7 @@ fetchAppointments();
selected === "Videos" ? "" : "hidden"
}`}
></View>
</Pressable>
</Pressable> */}
</View>
<View className="w-[100%] border-b-[2px] border-[#EEEEEE] relative bottom-[2.6px] z-[-1]"></View>
</View>
Expand All @@ -219,8 +219,8 @@ fetchAppointments();
{appointment.map((appointmentItem,index) => renderHistory(appointmentItem,index))}
</ScrollView>
)}
{selected==="Calls"&&<VoiceCalls/>}
{selected === "Videos" && <Index />}
{/* {selected==="Calls"&&<VoiceCalls/>}
{selected === "Videos" && <Index />} */}
</View>
</>
);
Expand Down
86 changes: 43 additions & 43 deletions app/chat-history/voiceCalls.tsx
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))}
// </>
// )
// }

0 comments on commit 6d5d1b6

Please sign in to comment.