Skip to content

Commit

Permalink
Merge pull request #70 from atlp-rwanda/ft-favoriteDoctorSearch
Browse files Browse the repository at this point in the history
Enhance Search Functionality with Result Count and No Results Feedback
  • Loading branch information
Nkbtemmy authored May 17, 2024
2 parents 49aa0d0 + 874ccec commit b643b4f
Show file tree
Hide file tree
Showing 11 changed files with 742 additions and 464 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Online Doctor Appointment & Consultation App

# Test coverage

[![codecov](https://codecov.io/gh/atlp-rwanda/matadors-rn-medica/graph/badge.svg?token=5OP0X0107C)](https://codecov.io/gh/atlp-rwanda/matadors-rn-medica)

For coverage on other branches, please visit the [Codecov project page](https://codecov.io/gh/atlp-rwanda/matadors-rn-medica) and select the appropriate branch.


## Table Of Content

- [Medica App](#medica-app)
Expand Down Expand Up @@ -124,8 +131,3 @@ Feel free to reach out to us:
## License

None At the moment !!
# Test coverage

[![codecov](https://codecov.io/gh/atlp-rwanda/matadors-rn-medica/graph/badge.svg?token=5OP0X0107C)](https://codecov.io/gh/atlp-rwanda/matadors-rn-medica)

For coverage on other branches, please visit the [Codecov project page](https://codecov.io/gh/atlp-rwanda/matadors-rn-medica) and select the appropriate branch.
78 changes: 50 additions & 28 deletions app/(app)/ActionMenu/FavoriteDoctorScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { leftArrow } from '@/assets/icons/left';
import data from "../../doctors.json"
import HeaderComponent from '@/components/HeaderComponent';
import SearchComponent from '@/components/SearchComponent';
import FoundDoctorCount from '@/components/FoundDoctorCount';
import NofoundComponent from '@/components/NofoundComponent';
import NotFoundScreen from '@/app/+not-found';


interface imageMapProp{
Expand Down Expand Up @@ -82,21 +85,18 @@ function DoctorScreen() {
!showSearch ? (
<HeaderComponent
onSearchPressed={handleSearchPressed}
headerText="Notification"
headerText="Top Doctor"

/>
) : (

<SearchComponent
onSearchSubmit={handleSearchSubmit}
<SearchComponent
onSearchSubmit={handleSearchSubmit}


/>
/>
)
}



</View>
<View style={styles.categoryBtnView}>
<ScrollView horizontal={true} showsHorizontalScrollIndicator={false} style={styles.categoryScroll}
Expand All @@ -108,15 +108,24 @@ function DoctorScreen() {
}}>

{data.categories.map((category, index) =>
<Pressable key={index} onPress={()=>handleCategoryChange(category)} style={[styles.categoryBtn,index==0?styles.firstCategoryBtn:{}]}>
<Pressable key={index} onPress={() => handleCategoryChange(category)} style={[styles.categoryBtn,
selectedCategory === category ? styles.firstCategoryBtn : {},
]}>

<Text style={[styles.categoryBtnText,index===0?styles.firstCategoryBtnText:{}]}>{category.name}</Text>
<Text style={[
styles.categoryBtnText,
selectedCategory === category ? styles.firstCategoryBtnText : {},
]}>{category.name}</Text>

</Pressable>
)}


</ScrollView>

</View>
<View style={styles.foundDoctorView}>
{showSearch && (
<FoundDoctorCount count={filteredDoctors.length } />
)}
</View>
<View>
<ScrollView
Expand All @@ -128,25 +137,31 @@ function DoctorScreen() {
paddingBottom: 150,
paddingTop:20
}}
>
{filteredDoctors.map((doctor:any,index:any) =>
>
{filteredDoctors.length > 0 ? (

filteredDoctors.map((doctor: any, index: any) =>

<View key={index } style={styles.componentView}>
<DoctorComponent
<View key={index} style={styles.componentView}>
<DoctorComponent

imageSource={imageMap[doctor.imageSource]}
name={doctor.name}
iconComponent={iconMapping[doctor.iconComponent]}
professionalTitle={doctor.professionalTitle}
hospital={doctor.hospital}
star={iconMapping[doctor.star]}
review={doctor.review}
rate={doctor.rate}
imageSource={imageMap[doctor.imageSource]}
name={doctor.name}
iconComponent={iconMapping[doctor.iconComponent]}
professionalTitle={doctor.professionalTitle}
hospital={doctor.hospital}
star={iconMapping[doctor.star]}
review={doctor.review}
rate={doctor.rate}

/>
</View>
/>
</View>

)}
)

) : (
<NofoundComponent/>
)}



Expand Down Expand Up @@ -186,6 +201,13 @@ const styles = StyleSheet.create({
marginTop: "8%",
backgroundColor:"white"
},
foundDoctorView: {
width: "100%",
display: "flex",
flexDirection: 'row',
justifyContent: "center",
alignItems: "center"
},
searchComponent: {

},
Expand All @@ -211,7 +233,7 @@ const styles = StyleSheet.create({
flexDirection: "row",
alignItems: 'center',
marginBottom: "5%",
backgroundColor:"white"
backgroundColor: "white",
},
categoryBtn: {
borderWidth: 2,
Expand Down Expand Up @@ -239,7 +261,7 @@ const styles = StyleSheet.create({
},
body: {
width: "98%",
backgroundColor: "#F7F7F7",
backgroundColor:"#F7F7F7",
},
scroll: {
width: "100%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const SessionEnded = () => {

<View style={styles.Button}>
<TouchableOpacity
onPress={()=>router.push("Appointments")}
style={[
styles.backButton,
{ backgroundColor: theme === "dark" ? "#35383F" : "#E9F0FF" },
Expand Down
14 changes: 7 additions & 7 deletions app/doctors.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@
"Doctors":[
{
"imageSource":"doctor1.png",
"name":"dentist Dr. Travis Westaby",
"name":"Dr. Travis Westaby",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"Alka Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -147,7 +147,7 @@
"imageSource":"doctor2.png",
"name":"Dr. Nathaniel Valle",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"B&B Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -157,7 +157,7 @@
"imageSource":"doctor3.png",
"name":"Dr. Beckett Calger",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"Venus Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -167,7 +167,7 @@
"imageSource":"doctor4.png",
"name":"Dr. Jada Srnsky",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"Alka Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -177,7 +177,7 @@
"imageSource":"doctor5.png",
"name":"Dr. Bernard Bliss",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"The Valley Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand All @@ -187,7 +187,7 @@
"imageSource":"doctor1.png",
"name":"Dr. Travis Westaby",
"iconComponent":"heart",
"professionalTitle":"Cardiologist",
"professionalTitle":"Dentist",
"hospital":"Alka Hospital",
"star":"star",
"review":"(4,5050 Reviews)",
Expand Down
7 changes: 7 additions & 0 deletions assets/icons/Defaulticon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const defaultIcon=`<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.0333 14.8035V3.45532" stroke="#246BFD" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M16.4311 11.3901L13.0329 14.804L9.63477 11.3901" stroke="#246BFD" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4.75984 1.19409V12.5422" stroke="#246BFD" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M1.36133 4.60749L4.75948 1.1936L8.15762 4.60749" stroke="#246BFD" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
`
Binary file added assets/images/Doctors/notFound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 99 additions & 0 deletions components/FoundDoctorCount.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import React,{ReactElement, useState} from 'react';
import { StyleSheet, Text, Image, View, TouchableHighlight, SafeAreaView, Button, Alert, Platform, StatusBar, Dimensions,TextInput, Pressable,ImageURISource} from 'react-native'
import Typography from '@/constants/Typography';
import { SvgXml } from "react-native-svg"
import { defaultIcon } from '@/assets/icons/Defaulticon';

interface foundDoctorProps{
count: number,

}

function FoundDoctorCount({ count }: foundDoctorProps) {
const foundText=count===0 ?"0 found":`${count} founds`
return (
<View style={styles.outer}>
<View style={styles.leftView}>
<View style={styles.countView}>
<Text style={styles.countText} >{foundText}</Text>

</View>

</View>
<View style={styles.RightView}>
<View style={styles.defaultView}>
<Text style={styles.defaultText}>Default</Text>

</View>
<Pressable style={styles.iconView}>
<SvgXml xml={defaultIcon} />

</Pressable>

</View>

</View>
);
}

export default FoundDoctorCount;
const styles = StyleSheet.create({
outer: {
width: "95%",
height: 30,
borderRadius: 10,
zIndex: 1000,
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems:"center"

},
leftView: {
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems:"center"

},
RightView: {
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
width: "24%",
},
countView: {


},
countText: {
color: "#212121",
fontWeight: "bold",
fontSize:16

},
foundView: {

},
foundText: {

},
defaultView: {

},
defaultText: {
color: "#246BFD",
fontWeight: "bold",
fontSize:16

},
iconView: {
display: "flex",
flexDirection: "row",
justifyContent: "center",
alignItems: "center",

}

})
Loading

0 comments on commit b643b4f

Please sign in to comment.