1+ import { Text , View , ScrollView , Image , Pressable , FlatList , TouchableOpacity , Modal , Dimensions } from "react-native" ;
2+ import { useState } from "react" ;
3+ import { NavigationHeader } from "@/components/NavigationHeader" ;
4+ import { Icon } from "@/components/Icon" ;
5+ import { SvgXml } from "react-native-svg" ;
6+ import { searchDark } from "@/assets/icons/search" ;
7+ import { moreTransparent } from "@/assets/icons/more" ;
8+ import { messages , MessagesType } from "./data" ;
9+ import { back } from "@/assets/icons/userprofile/icons" ;
10+ import { doubleTick } from "@/assets/icons/doubletick" ;
11+ import { download } from "@/assets/icons/download" ;
12+ import { deleteBtn , deleteRed } from "@/assets/icons/delete" ;
13+ import Chat from "@/components/chats/chat" ;
14+
15+
16+ export default function Chathistory ( ) {
17+ const y = Dimensions . get ( "screen" ) . height ;
18+ const [ selected , setSelected ] = useState ( "Messages" ) ;
19+ const [ isModalVisible , setIsModalVisible ] = useState ( false ) ;
20+ const [ visible , setVisible ] = useState ( false ) ;
21+ const [ docName , setDocname ] = useState ( '' ) ;
22+ const handleDocName = ( doc : string ) => {
23+ setDocname ( doc ) ;
24+ setIsModalVisible ( true ) ;
25+ }
26+ const renderItems = ( { item } : { item : MessagesType } ) => {
27+ return (
28+ < View className = "flex flex-row w-1/1 justify-between items-center py-3 " >
29+ < View className = "flex-none w-[20%]" >
30+ < Image source = { item . image } style = { { width : 58 , height : 58 } } />
31+ </ View >
32+ < TouchableOpacity className = "flex-auto w-[73%] pl-2" onPress = { ( ) => handleDocName ( item . name ) } >
33+ < Text className = "font-UrbanistBold text-[16px] pb-2" > { item . name } </ Text >
34+ < Text className = "font-UrbanistRegular text-grey" > { item . message } </ Text >
35+ </ TouchableOpacity >
36+ < View className = "flex-auto w-[30%] justify-start" >
37+ < Text className = "font-UrbanistRegular text-grey pb-2 text-right" > { item . date } </ Text >
38+ < Text className = "font-UrbanistRegular text-grey text-right" > { item . time } </ Text >
39+ </ View >
40+ </ View >
41+ )
42+ }
43+ return (
44+ < >
45+ < Modal visible = { isModalVisible } transparent = { false } >
46+ < View className = { `${ visible ? '' : 'hidden' } absolute w-[100%] right-0 z-[0] top-[5px]` } >
47+ < View className = "w-[100%]" >
48+ < View className = "w-[37%] relative top-[50px] left-[59%] p-4 right-0 bg-white rounded-xl" >
49+ < TouchableOpacity className = "flex-row gap-2 py-2" >
50+ < SvgXml xml = { deleteBtn } />
51+ < Text className = "font-UrbanistSemiBold" > Clear chat</ Text >
52+ </ TouchableOpacity >
53+ < View className = "w-[85%] ml-3 pt-2 border-b-[1px] border-grey opacity-40" />
54+ < TouchableOpacity className = "flex-row gap-2 pb-2 pt-4 " >
55+ < SvgXml xml = { download } />
56+ < Text className = "font-UrbanistSemiBold" > Export chat</ Text >
57+ </ TouchableOpacity >
58+ < View className = "w-[85%] ml-3 pb-2 border-b-[1px] border-grey opacity-40" />
59+ < TouchableOpacity className = "flex-row gap-2 pt-3" onPress = { ( ) => { setVisible ( false ) } } >
60+ < SvgXml xml = { deleteRed } stroke = { '#F75555' } />
61+ < Text className = "font-UrbanistSemiBold text-[#F75555]" > Delete chat</ Text >
62+ </ TouchableOpacity >
63+ </ View >
64+ </ View >
65+ </ View >
66+ < View className = 'w-1/1 pt-7 mx-4' >
67+ < View className = 'flex-row items-center justify-between pb-5' >
68+ < View className = 'flex-row items-center justify-center ml-0' >
69+ < TouchableOpacity onPress = { ( ) => setIsModalVisible ( false ) } >
70+ < SvgXml xml = { back } />
71+ </ TouchableOpacity >
72+ < Text className = "text-[22px] px-2 font-UrbanistBold" > { docName } </ Text >
73+ </ View >
74+ < View className = 'flex-row items-center justify-center gap-3 mx-1' >
75+ < SvgXml xml = { searchDark } />
76+ < SvgXml xml = { moreTransparent } onPress = { ( ) => setVisible ( ! visible ) } />
77+ </ View >
78+ </ View >
79+ < ScrollView showsVerticalScrollIndicator = { false } className = "mb-5 z-[-1]" >
80+ < View className = "flex-row justify-center items-center my-3" >
81+ < View className = "w-1/3 bg-[#75757512] justify-center items-center rounded-xl" >
82+ < Text className = "text-[13px] p-1 text-[#757575] font-UrbanistSemiBold" > Session started</ Text >
83+ </ View >
84+ </ View >
85+
86+ < Chat direction = "end"
87+ message = "Hi, good afternoon Dr. Drake... 😁😁"
88+ time = "16:00 PM"
89+ color = "lightblue"
90+ />
91+ < Chat direction = "end"
92+ message = "I'm Andrew, I have a problem with my immune system 😢"
93+ time = "16:00 PM"
94+ color = "lightblue"
95+ />
96+ < Chat direction = "start"
97+ message = "Hello, good afternoon too Andrew 😁"
98+ time = "16:01 PM"
99+ color = "lightgrey"
100+ />
101+ < Chat direction = "start"
102+ message = "Can you tell me the problem you are having? So that I can identify it."
103+ time = "16:01 PM"
104+ color = "lightgrey"
105+ />
106+ < Chat direction = "end"
107+ message = "Recently I often feel unwell. I also sometimes experience pain in the legs, and I don't know why 😭😭
108+ Do you know anything doc?"
109+ time = "16:02 PM"
110+ color = "lightblue"
111+ />
112+ < View className = { `w-[100%] flex items-end my-3` } >
113+ < View className = { ` rounded-xl p-4 w-3/4 flex justify-end gap-r-2` } >
114+ < View className = { ` w-[73%] flex-row gap-x-4 pb-3` } >
115+ < Image source = { require ( "../../assets/images/chat/leg.png" ) } style = { { width : 100 , height : 100 } } resizeMode = "contain" />
116+ < Image source = { require ( "../../assets/images/chat/leg1.png" ) } style = { { width : 100 , height : 100 } } resizeMode = "contain" />
117+ </ View >
118+ { /* <View className="flex-row items-center gap-x-1 justify-end">
119+ <Text className={`font-UrbanistRegular text-[10px]`}>16:03 PM</Text>
120+ <SvgXml xml={doubleTick} stroke={'black'} />
121+ </View> */ }
122+ </ View >
123+ </ View >
124+ </ ScrollView >
125+
126+ </ View >
127+
128+ </ Modal >
129+ < View className = 'w-1/1 pt-10 mx-4 ' >
130+ < View className = 'flex-row items-center justify-between' >
131+ < View className = 'flex-row items-center justify-center' >
132+ < Image source = { require ( "../../assets/images/chat/logo.png" ) } style = { { width : 28 , height : 28 } } />
133+ < Text className = "text-[24px] font-UrbanistBold px-4" > History</ Text >
134+ </ View >
135+ < View className = 'flex-row items-center justify-center gap-3 mx-1' >
136+ < SvgXml xml = { searchDark } />
137+ < SvgXml xml = { moreTransparent } />
138+ </ View >
139+ </ View >
140+ < View className = "my-4 w-1/1 justify-between mr-3" >
141+ < View className = "flex-row justify-between w-[100%]" >
142+ < Pressable className = " flex-initial items-center w-1/3" onPress = { ( ) => setSelected ( "Messages" ) } >
143+ < Text className = { `font-UrbanistSemiBold text-[18px] ${ selected === 'Messages' ? 'text-lightblue' : 'text-grey' } pb-2` } > Messages</ Text >
144+ < View className = { `w-[100%] h-[4px] bg-lightblue rounded-xl ${ selected === 'Messages' ? '' : 'hidden' } ` } />
145+ </ Pressable >
146+ < Pressable className = "flex-initial items-center w-1/3" onPress = { ( ) => setSelected ( "Calls" ) } >
147+ < Text className = { `font-UrbanistSemiBold text-[18px] ${ selected === 'Calls' ? 'text-lightblue' : 'text-grey' } pb-2` } > Voice Call</ Text >
148+ < View className = { `w-[100%] h-[4px] bg-lightblue rounded-xl ${ selected === 'Calls' ? '' : 'hidden' } ` } />
149+ </ Pressable >
150+ < Pressable className = "flex-initial items-center w-1/3" >
151+ < Text className = { `font-UrbanistSemiBold text-[18px] ${ selected === 'Videos' ? 'text-lightblue' : 'text-grey' } pb-2` } onPress = { ( ) => setSelected ( "Videos" ) } >
152+ Video Call</ Text >
153+ < View className = { `w-[100%] h-[4px] bg-lightblue rounded-xl ${ selected === 'Videos' ? '' : 'hidden' } ` } > </ View >
154+ </ Pressable >
155+ </ View >
156+ < View className = "w-[100%] border-b-[2px] border-[#EEEEEE] relative bottom-[2.6px] z-[-1]" > </ View >
157+ </ View >
158+
159+ < FlatList data = { messages } renderItem = { renderItems } style = { { height :'82%' } } showsVerticalScrollIndicator = { false } />
160+
161+ </ View >
162+ </ >
163+ )
164+ }
0 commit comments