Skip to content

Commit

Permalink
Feat:history implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Latiah committed Jul 24, 2024
1 parent 1780d55 commit 6a1135d
Show file tree
Hide file tree
Showing 16 changed files with 239 additions and 307 deletions.
13 changes: 1 addition & 12 deletions app/(tabs)/articles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,7 @@ const Articles = () => {
return (
<>
<Article/>
</>




// <Article/>
// <SeeAllArticles/>
// <ArticlesDetails/>
// <BookMarkedArticle/>



</>
);
};

Expand Down
18 changes: 9 additions & 9 deletions app/(tabs)/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const Profile = () => {
nextTo: "notification",
leftIcon: icons.notification,
},
{ text: t("profile.payment"), nextTo: "payment", leftIcon: icons.wallet },
// { text: t("profile.payment"), nextTo: "payment", leftIcon: icons.wallet },
{
text: t("profile.security"),
nextTo: "security",
Expand All @@ -101,12 +101,12 @@ const Profile = () => {
nextTo: "language",
leftIcon: icons.language,
},
{
text: t("profile.dark_mode"),
nextTo: "mode",
leftIcon: icons.eye,
mode: true,
},
// {
// text: t("profile.dark_mode"),
// nextTo: "mode",
// leftIcon: icons.eye,
// mode: true,
// },
{
text: t("profile.help_center"),
nextTo: "help",
Expand Down Expand Up @@ -192,9 +192,9 @@ const Profile = () => {
{t("profile.title")}
</Text>
</View>
<Touchable>
{/* <Touchable>
<SvgXml xml={moreOutlinedIcon} className="self-end" />
</Touchable>
</Touchable> */}
</View>
<ScrollView
className="flex-1 p-6"
Expand Down
38 changes: 25 additions & 13 deletions app/Appointments/voice-call/writeReview.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useState, useEffect } from "react";
import { View, Text, TouchableOpacity, Image, TextInput, StyleSheet, Modal, ScrollView, SafeAreaView, Pressable } from "react-native";
import { router } from "expo-router";
import { router, useLocalSearchParams } from "expo-router";
import { useFonts } from 'expo-font';
import FiveStarRating from "../doctorcard/star";
import { supabase } from "@/app/supabase";

interface CustomCheckBoxProps {
selected: boolean;
Expand All @@ -21,25 +22,30 @@ export default function Writereview() {
const [isModalVisible, setIsModalVisible] = useState(false);
const [isoption, setIsoption] = useState("");
const [text, setText] = useState('');
const [fontLoaded] = useFonts({
'UrbanistBold': require('../../../assets/fonts/Urbanist-Bold.ttf'),
'UrbanistRegular': require("../../../assets/fonts/Urbanist-Regular.ttf"),
'Urbanist-SemiBold': require("../../../assets/fonts/Urbanist-SemiBold.ttf"),
'UrbanistMedium': require("../../../assets/fonts/Urbanist-Medium.ttf")
});
const [name, setName]=useState("");
const [image, setImage]=useState("");
const {appointmentId}=useLocalSearchParams();

const handleChangeText = (value: string) => {
setText(value);
};

const isSubmitEnabled = text.trim().length > 0 && isoption.length > 0;

if (!fontLoaded) {
return null;
}


const Options = ["Yes", "No"];

useEffect(()=>{
const fetchDoctor=async()=>{
const {data, error}=await supabase.from("doctor").select("*").eq("id",appointmentId).single();
if(data){
setName(data.name);
console.log(data.name);
setImage(data.image)
}
if (error) throw error}
fetchDoctor()},[])
return (
<>
<Modal
Expand Down Expand Up @@ -71,10 +77,10 @@ export default function Writereview() {
<Text className="text-[#212121] font-UrbanistBold text-[24px] pl-5">Write a Review</Text>
</View>
<View className="w-[370px] flex justify-center items-center gap-5 mb-2">
<Image source={require("../../../assets/doctors/Ellipse.png")} />
<Image source={{uri:image}} style={styles.doctorImage}/>
<View>
<Text className="text-[#212121] font-UrbanistBold text-[20px] text-center">How was your experience </Text>
<Text className="text-[#212121] font-UrbanistBold text-[20px] text-center">with Dr. Drake Boeson?</Text>
<Text className="text-[#212121] font-UrbanistBold text-[20px] text-center">with {name}?</Text>
</View>
<View className=" w-[350px] flex flex-row justify-center pb-3">
<SafeAreaView>
Expand All @@ -92,7 +98,7 @@ export default function Writereview() {
placeholder="Your review here..."
style={styles.textInput}
/>
<Text className="text-[#212121] font-UrbanistBold text-[20px] pb-5 pt-3">Would you recommend Dr. Drake Boeson to your friends?</Text>
<Text className="text-[#212121] font-UrbanistBold text-[20px] pb-5 pt-3">Would you recommend {name} to your friends?</Text>
<View className="flex flex-row items-center pl-2 justify-between w-[130px]">
{Options.map((option, index) => (
<View key={index} className="flex flex-row items-center justify-center gap-2">
Expand Down Expand Up @@ -184,4 +190,10 @@ const styles = StyleSheet.create({
width: '100%',
minHeight: 100,
},
doctorImage: {
width: 120,
height: 120,
borderRadius: 60,
marginBottom: 10,
},
});
30 changes: 4 additions & 26 deletions app/Doctors/searchDoctor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,22 @@ import { View, Image, Animated,
Easing
} from "react-native";
import { SearchInput } from "../../components/searchinput2";
import { UIActivityIndicator } from "react-native-indicators";

export default function searchDoctor() {

const [selectedCategory, setSelectedCategory] = useState("all");
const [searchQuery, setSearchQuery] = useState("");
const [selectedRating, setSelectedRating] = useState(0);
const rotateValue = new Animated.Value(0);
const rotate = rotateValue.interpolate({
inputRange: [0, 1],
outputRange: ["0deg", "360deg"],
});
const [loading, setLoading]=useState(true);

const spin = () => {
rotateValue.setValue(0);
Animated.timing(rotateValue, {
toValue: 1,
duration: 2500,
easing: Easing.linear,
useNativeDriver: true,
}).start(() => {
setTimeout(() => {
}, 2000);
});
};
useEffect(() => {

spin();

}
)


return (
<View className="flex-1 bg-white px-4 py-5">
<View className="flex-1 justify-center items-center">
<View>
<Animated.View style={{ transform: [{ rotate }] }}>
<Image source={require("../../assets/doctors/loading.png")} />
</Animated.View>
<UIActivityIndicator color={"#246BFD"} size={32} />
</View>
</View>
</View>
Expand Down
8 changes: 2 additions & 6 deletions app/articles/ArticlesDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Share,
} from "react-native";
import { supabase } from "../supabase";

import { UIActivityIndicator } from "react-native-indicators";
interface Article {
id: string;
title: string;
Expand Down Expand Up @@ -209,11 +209,7 @@ export default function ArticlesDetails() {
if (loading) {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<Text
style={{ fontSize: 20, fontFamily: "UrbanistBold", color: "#212121" }}
>
Loading...
</Text>
<UIActivityIndicator color={"#246BFD"} size={32} />
</View>
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/articles/ArticlesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { router, useLocalSearchParams, useNavigation } from "expo-router";
import FieldComponent from "@/components/FieldComponent";
import ArticleCard from "@/components/cards/ArticleCard";
import { supabase } from "../supabase";

import { UIActivityIndicator } from "react-native-indicators";
interface Article {
id: number;
title: string;
Expand Down Expand Up @@ -76,7 +76,7 @@ export default function Article() {
if (loading) {
return (
<View style={styles.loadingContainer}>
<Text style={styles.loadingText}>Loading...</Text>
<UIActivityIndicator color={"#246BFD"} size={32} />
</View>
);
}
Expand Down
4 changes: 2 additions & 2 deletions app/articles/BookMarkedArticle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ScrollView,
TouchableOpacity,
} from "react-native";

import { UIActivityIndicator } from "react-native-indicators";
interface Article {
id: number;
title: string;
Expand Down Expand Up @@ -133,7 +133,7 @@ export default function BookMarkedArticle() {

<ScrollView showsVerticalScrollIndicator={false}>
{loading ? (
<Text>Loading...</Text>
<UIActivityIndicator color={"#246BFD"} size={32} />
) : (
bookmarkedArticles.map((article, index) => (
<ArticleCard key={index} article={article} />
Expand Down
1 change: 0 additions & 1 deletion app/articles/SeeAllArticles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { router, useNavigation } from "expo-router";
import FieldComponent from "@/components/FieldComponent";
import ArticleCard from "@/components/cards/ArticleCard";
import { supabase } from "../supabase";

interface Article {
id: number;
title: string;
Expand Down
73 changes: 27 additions & 46 deletions app/chat-history/VideoCall.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,45 @@
import React from "react";
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 the types

import { DoctorCard } from "./types";
import { supabase } from "../supabase";
const VideoCall = () => {
const router = useRouter();
const [appointment, setAppointment]=useState<any[]>([]);

const docCards: DoctorCard[] = [
{
name: "Dr. Randy Wigham",
callDay: "Wednesday",
callTime: "1:00 PM",
images: require("../../assets/doctors/doc2.png"),
},
{
name: "Dr. Jenny Watson",
callDay: "Wednesday",
callTime: "1:00 PM",
images: require("../../assets/doctors/doc3.png"),
},
{
name: "Dr. Raul Zirkind",
callDay: "Wednesday",
callTime: "1:00 PM",
images: require("../../assets/doctors/doc1.png"),
},
{
name: "Dr. Elijah Baranick",
callDay: "Wednesday",
callTime: "1:00 PM",
images: require("../../assets/doctors/doc2.png"),
},
{
name: "Dr. Stephen Shute",
callDay: "Wednesday",
callTime: "1:00 PM",
images: require("../../assets/doctors/doc5.png"),
},
];

const handlePress = (doctor: DoctorCard) => {
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: { doctor: JSON.stringify(doctor) },
params: {appointmentId},
});
};

return (
<View style={{ backgroundColor: "white" }}>
<ScrollView style={{ backgroundColor: "#FAFAFA", paddingBottom: 6 }}>
{docCards.map((doctor, index) => (
{appointment.map((appointments, index) => (
<DoctorVideo
key={index}
onPress={() => handlePress(doctor)}
doctorName={doctor.name}
doctorImage={doctor.images}
callType="Video Call"
callDay={doctor.callDay}
callTime={doctor.callTime}
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}
/>
))}
Expand Down
Loading

0 comments on commit 6a1135d

Please sign in to comment.