isometrik-chat 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/README.md +74 -0
  2. package/babel.config.js +6 -0
  3. package/dist/index.js +684 -0
  4. package/package.json +59 -0
  5. package/public/Logo-192x192.png +0 -0
  6. package/public/Logo-512x512.png +0 -0
  7. package/public/favicon.ico +0 -0
  8. package/public/fonts/BenjaminVictoria.ttf +0 -0
  9. package/public/icons/arrow_logo.svg +9 -0
  10. package/public/icons/assets/ic_placeholder_banner.svg +1 -0
  11. package/public/icons/attach-file.svg +9 -0
  12. package/public/icons/audio_pause.svg +1 -0
  13. package/public/icons/audio_play.svg +6 -0
  14. package/public/icons/back.svg +3 -0
  15. package/public/icons/bell.svg +1 -0
  16. package/public/icons/block.svg +1 -0
  17. package/public/icons/bottom-arrow.svg +1 -0
  18. package/public/icons/camera-switch.svg +12 -0
  19. package/public/icons/camera.svg +4 -0
  20. package/public/icons/cancel.svg +1 -0
  21. package/public/icons/chat empty placeholder.svg +58 -0
  22. package/public/icons/chat_audio_pause.png +0 -0
  23. package/public/icons/chat_audio_play.png +0 -0
  24. package/public/icons/close.svg +5 -0
  25. package/public/icons/crossCarousel.svg +3 -0
  26. package/public/icons/delete.svg +3 -0
  27. package/public/icons/disappear.svg +24 -0
  28. package/public/icons/document.png +0 -0
  29. package/public/icons/document.svg +1 -0
  30. package/public/icons/downloadCarousel.svg +6 -0
  31. package/public/icons/edit-pencil.svg +6 -0
  32. package/public/icons/emoji.svg +8 -0
  33. package/public/icons/emojiCarousel.svg +3 -0
  34. package/public/icons/filter.svg +1 -0
  35. package/public/icons/forwardCarousel.svg +3 -0
  36. package/public/icons/gallery.svg +1 -0
  37. package/public/icons/goToMessageCarousel.svg +3 -0
  38. package/public/icons/ic_uil_arrow-left.svg +1 -0
  39. package/public/icons/ic_uil_eye-slash.svg +1 -0
  40. package/public/icons/ic_uil_eye.svg +1 -0
  41. package/public/icons/leftArrowCarousel.svg +6 -0
  42. package/public/icons/light-mode.svg +14 -0
  43. package/public/icons/lock.svg +1 -0
  44. package/public/icons/login_background.png +0 -0
  45. package/public/icons/menu .svg +5 -0
  46. package/public/icons/menuCarousel.svg +5 -0
  47. package/public/icons/message.svg +3 -0
  48. package/public/icons/placeholder.svg +958 -0
  49. package/public/icons/poll.svg +1 -0
  50. package/public/icons/retake.png +0 -0
  51. package/public/icons/right-arrow.svg +3 -0
  52. package/public/icons/right.svg +3 -0
  53. package/public/icons/round-star.svg +1 -0
  54. package/public/icons/search.svg +3 -0
  55. package/public/icons/send.svg +10 -0
  56. package/public/icons/starCarousel.svg +3 -0
  57. package/public/icons/status.svg +1 -0
  58. package/public/icons/sticker.svg +1 -0
  59. package/public/icons/thumb-down.svg +1 -0
  60. package/public/icons/user.svg +1 -0
  61. package/public/icons/users.svg +1 -0
  62. package/public/icons/voice.png +0 -0
  63. package/public/index.html +38 -0
  64. package/public/logo192.png +0 -0
  65. package/public/logo512.png +0 -0
  66. package/public/manifest.json +25 -0
  67. package/public/offline.html +12 -0
  68. package/public/robots.txt +3 -0
  69. package/public/service-worker.js +81 -0
  70. package/src/App.js +15 -0
  71. package/src/App.test.js +8 -0
  72. package/src/Authpage.js +16 -0
  73. package/src/ChatContext.js +172 -0
  74. package/src/Data/index.js +110 -0
  75. package/src/assets/icons.js +49 -0
  76. package/src/assets/images/WhatsApp.html +258 -0
  77. package/src/assets/images/WhatsApp_files/301446776_522918349234681_1974693392291574064_n.jpg +0 -0
  78. package/src/assets/images/WhatsApp_files/app-bf223f825866ee433b07.css +242 -0
  79. package/src/assets/images/WhatsApp_files/app.77ee8aa7a4c593101105.js +77 -0
  80. package/src/assets/images/WhatsApp_files/lazy_loaded_high_priority_components.85a06e74a0a4ade1640b.css +16 -0
  81. package/src/assets/images/WhatsApp_files/lazy_loaded_low_priority_components.8621270bc215a9298a97.css +47 -0
  82. package/src/assets/images/WhatsApp_files/libsignal-protocol-ee5b8ba.min.js +21 -0
  83. package/src/assets/images/WhatsApp_files/main.48b845d68e066fb27a75.css +161 -0
  84. package/src/assets/images/WhatsApp_files/runtime.e6018f3c1e255e8f4dc7.js +2 -0
  85. package/src/assets/images/WhatsApp_files/stylex-d50abd61e6cf7eab2afd855adccf14e5.css +2841 -0
  86. package/src/assets/images/WhatsApp_files/vendor1_app.58a51d93a250f83ab555.js +79 -0
  87. package/src/assets/images/bg.jpeg +0 -0
  88. package/src/assets/images/drkbg.jpg +0 -0
  89. package/src/assets/images/notFound.jpeg +0 -0
  90. package/src/assets/images/watsapp.jpg +0 -0
  91. package/src/assets/images/watsappbg.png +0 -0
  92. package/src/assets/images/wb.jpg +0 -0
  93. package/src/assets/images/whatsapp.jpeg +0 -0
  94. package/src/components/ChatBox/AudioBubble.js +162 -0
  95. package/src/components/ChatBox/ChatBubble.js +232 -0
  96. package/src/components/ChatBox/DocumentBubble.js +87 -0
  97. package/src/components/ChatBox/MessagesBox.js +533 -0
  98. package/src/components/CustomModal.js +60 -0
  99. package/src/components/Icon.js +10 -0
  100. package/src/components/ImageComponent.js +24 -0
  101. package/src/components/MediaDocs.js +155 -0
  102. package/src/components/MediaDocumentContainer.js +55 -0
  103. package/src/components/MessageInfoDropdown.js +124 -0
  104. package/src/components/Modal/AllowMicPermissionModal.js +63 -0
  105. package/src/components/Modal/BlockUnblockChatModal.js +78 -0
  106. package/src/components/Modal/CameraPermissionBlockedModal.js +61 -0
  107. package/src/components/Modal/CameraPermissionRequestModal.js +60 -0
  108. package/src/components/Modal/ClearChatModal.js +78 -0
  109. package/src/components/Modal/DeleteChatModal.js +79 -0
  110. package/src/components/Modal/MicPermissionDisableModal.js +63 -0
  111. package/src/components/Modal/Modal.js +103 -0
  112. package/src/components/Modal/ModalDialog.js +103 -0
  113. package/src/components/Modal/ProfilePictureUploadPreview.js +160 -0
  114. package/src/components/OutsideAlerter/OutsideAlerter.js +38 -0
  115. package/src/components/ProfilePicture/ProfilePicture.js +127 -0
  116. package/src/components/Registration/Login.js +265 -0
  117. package/src/components/Registration/SignUp.js +322 -0
  118. package/src/components/SnackBar.js +42 -0
  119. package/src/components/common/Modal/useDetectOutsideClick.js +23 -0
  120. package/src/components/common/styled/PageWrapper.js +25 -0
  121. package/src/components/formcontrol/CustomButton.js +38 -0
  122. package/src/components/formcontrol/InputText.js +60 -0
  123. package/src/global-styles.js +42 -0
  124. package/src/hooks/useDeviceType.js +28 -0
  125. package/src/hooks/useThrottle.js +29 -0
  126. package/src/index.css +225 -0
  127. package/src/index.js +23 -0
  128. package/src/lib/constant.js +21 -0
  129. package/src/lib/functionality.js +13 -0
  130. package/src/lib/helpers.js +320 -0
  131. package/src/lib/mockData/index.js +76 -0
  132. package/src/lib/session/index.js +31 -0
  133. package/src/lib/validation.js +4 -0
  134. package/src/logo.svg +1 -0
  135. package/src/pages/WhatsappMainBox/index.js +574 -0
  136. package/src/reportWebVitals.js +13 -0
  137. package/src/services/deliveryStatus.js +27 -0
  138. package/src/setupTests.js +5 -0
  139. package/src/utils/chatSdk.js +14 -0
  140. package/src/utils/global.js +57 -0
  141. package/src/utils/media.js +79 -0
  142. package/src/view/component/BlockedContactSlide.js +134 -0
  143. package/src/view/component/Carousle/UpperMenuBar.js +106 -0
  144. package/src/view/component/Carousle/index.js +204 -0
  145. package/src/view/component/Chatbox.js/AudioRecorder.js +311 -0
  146. package/src/view/component/Chatbox.js/ChatBubbleReply.js +27 -0
  147. package/src/view/component/Chatbox.js/TakePhoto.js +363 -0
  148. package/src/view/component/Chatbox.js/index.js +856 -0
  149. package/src/view/component/Chatbox.js/styles.css +231 -0
  150. package/src/view/component/Contact/index.js +56 -0
  151. package/src/view/component/Contact/styles.css +208 -0
  152. package/src/view/component/ContactInfo/index.js +543 -0
  153. package/src/view/component/ContactInfo/styles.css +289 -0
  154. package/src/view/component/Context/index.js +3 -0
  155. package/src/view/component/DialogBox.js +15 -0
  156. package/src/view/component/ImageCropper/ImageCropper.js +128 -0
  157. package/src/view/component/Loader/Loader.js +52 -0
  158. package/src/view/component/Loader/UserPagingLoader.js +62 -0
  159. package/src/view/component/MainChatBox/index.js +819 -0
  160. package/src/view/component/MainChatBox/styles.css +124 -0
  161. package/src/view/component/Menu/index.js +261 -0
  162. package/src/view/component/Menu/styles.css +68 -0
  163. package/src/view/component/Profile/ProfileInfoContainer.js +112 -0
  164. package/src/view/component/Profile/ProfileUpdate.js +178 -0
  165. package/src/view/component/Profile/TakeProfilePhoto.js +391 -0
  166. package/src/view/component/Profile/index.js +550 -0
  167. package/src/view/component/Profile/styles.css +370 -0
  168. package/src/view/component/ReplyChatMessage/ReplyChatMessage.js +48 -0
  169. package/src/view/component/SeachBar/index.js +106 -0
  170. package/src/view/component/SeachBar/styles.css +53 -0
  171. package/src/view/component/Siderbar/index.js +512 -0
  172. package/src/view/component/Siderbar/styles.css +138 -0
  173. package/src/view/component/Toaster/Toaster.js +117 -0
  174. package/src/view/component/UserDetailsCard/UserDetailCard.js +337 -0
  175. package/src/view/component/deleteMessageMoal.js +80 -0
  176. package/src/view/component/emoji/index.js +22 -0
  177. package/src/view/component/emoji/sstyles.css +0 -0
  178. package/src/view/component/forwardData/index.js +327 -0
  179. package/src/view/component/forwardData/styles.css +112 -0
  180. package/src/view/component/forwardPopup/index.js +55 -0
  181. package/src/view/component/forwardPopup/styles.css +144 -0
  182. package/src/view/component/mediaList/index.js +92 -0
  183. package/src/view/component/menuDialog/index.js +71 -0
  184. package/src/view/component/menuDialog/styles.css +24 -0
  185. package/src/view/component/pagination/pagination.js +52 -0
  186. package/src/view/component/pagination/paginationForMsg.js +43 -0
  187. package/src/view/component/sidebarChat/index.js +321 -0
  188. package/src/view/component/sidebarChat/styles.css +109 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,162 @@
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import styled, { css } from 'styled-components';
3
+ import WaveSurfer from 'wavesurfer.js';
4
+ import ImageComponent from '../ImageComponent';
5
+ import { AUDIO_PAUSE, AUDIO_PLAY, CHAT_AUDIO_PAUSE, CHAT_AUDIO_PLAY } from '../../utils/global';
6
+ import { mobile } from '../../utils/media';
7
+ import { getCookie } from '../../lib/session';
8
+ import { convertSecondsToMinutes } from '../../lib/helpers';
9
+
10
+ const AudioBubbleWrapper = styled.div`
11
+ position: relative;
12
+ display: flex;
13
+ align-items: center;
14
+ gap: 1.5rem;
15
+ padding: 0 1rem 0 0;
16
+ margin: 0.25rem 0 0.25rem auto;
17
+ border-radius: 7.5px;
18
+ --wt-bg-opacity: 1;
19
+ background-color: ${props => props.selfChat ? 'var(--sender_chatbg)' : 'var(--white)'};
20
+ width: 336px;
21
+
22
+ .wavesurfer-timeline-progress{
23
+ width: 10px !important;
24
+ height: 10px !important;
25
+ border-radius: 50% !important;
26
+ background-color: red !important;
27
+ }
28
+
29
+ .user_profile_picture{
30
+ width: 55px;
31
+ height: 55px;
32
+ object-fit: cover;
33
+ border-radius: 50%;
34
+ }
35
+
36
+ ${mobile(css`
37
+ width: 280px;
38
+ `)}
39
+
40
+ .chat_audio_play_pause{
41
+ width: 20px;
42
+ height: 20px;
43
+ filter: ${props => props.theme === true ? 'invert(1)' : 'unset'};
44
+ }
45
+
46
+ .wave_container{
47
+ width: 100%;
48
+ wave{
49
+ z-index: 0;
50
+ ::-webkit-scrollbar {
51
+ display: none;
52
+ }
53
+ -ms-overflow-style: none; /* IE and Edge */
54
+ scrollbar-width: none; /* Firefox */
55
+ }
56
+ }
57
+ `;
58
+
59
+ const AudioTime = styled.p`
60
+ font-size: 14px;
61
+ color: var(--chat_timing);
62
+ position: absolute;
63
+ bottom: 0;
64
+ left: 80px;
65
+ margin-bottom: -8px;
66
+ `;
67
+
68
+ const AudioBubble = (props) => {
69
+ const { chat, theme } = props;
70
+ const [isPlaying, setIsPlaying] = useState(false);
71
+ const [audioDuration, setAudioDuration] = useState(0);
72
+ const [currentAudioId, setCurrentAudioId] = useState(null);
73
+ const waveformRef = useRef(null);
74
+ const wavesurfer = useRef(null);
75
+ const userId = getCookie('userId');
76
+ let audioUrl = chat?.attachments?.[0].mediaUrl || chat?.attachments?.[0].thumbnailUrl;
77
+
78
+
79
+ useEffect(() => {
80
+ try {
81
+ wavesurfer.current = WaveSurfer.create({
82
+ container: waveformRef.current,
83
+ waveColor: '#6f8171',
84
+ progressColor: '#6f8171',
85
+ height: 40,
86
+ barHeight: 1.5,
87
+ barWidth: 3,
88
+ barGap: 2,
89
+ });
90
+ wavesurfer.current.load(audioUrl);
91
+
92
+ wavesurfer.current.on('ready', () => {
93
+ const totalDuration = wavesurfer.current.getDuration();
94
+ const getSortedTime = convertSecondsToMinutes(Math.round(totalDuration));
95
+ setAudioDuration(getSortedTime);
96
+ });
97
+ wavesurfer.current.on('audioprocess', () => {
98
+ const totalDuration = wavesurfer.current.getCurrentTime();
99
+ const getSortedTime = convertSecondsToMinutes(Math.round(totalDuration));
100
+ setAudioDuration(getSortedTime);
101
+ });
102
+
103
+ wavesurfer.current.on('finish', () => {
104
+ setIsPlaying(false);
105
+ wavesurfer.current.seekTo(0);
106
+ });
107
+ } catch (error) {
108
+ console.error(error, 'error')
109
+ }
110
+
111
+
112
+ return () => {
113
+ wavesurfer.current.destroy();
114
+ setIsPlaying(false);
115
+ };
116
+ }, []);
117
+
118
+ // const audioHandler = () => {
119
+ // if (!wavesurfer.current.isPlaying()) {
120
+ // setIsPlaying(true);
121
+ // wavesurfer.current.play();
122
+ // }else{
123
+ // setIsPlaying(false);
124
+ // wavesurfer.current.pause();
125
+ // }
126
+ // };
127
+
128
+ const pauseAudioHandler = () => {
129
+ setIsPlaying(false);
130
+ wavesurfer.current.pause();
131
+
132
+ }
133
+
134
+ const playAudioHandler = (currentId) => {
135
+ setIsPlaying(true);
136
+ wavesurfer.current.play();
137
+ }
138
+
139
+ const getPlayPauseIcon = () => {
140
+ if (isPlaying) {
141
+ return (
142
+ <ImageComponent onClick={pauseAudioHandler} className="chat_audio_play_pause pointer" src={AUDIO_PLAY} alt="chat_audio_pause" />
143
+ )
144
+ }else{
145
+ return (
146
+ <ImageComponent onClick={playAudioHandler} className="chat_audio_play_pause pointer" src={AUDIO_PAUSE} alt="chat_audio_play" />
147
+ )
148
+ }
149
+ }
150
+
151
+ return (
152
+ <AudioBubbleWrapper theme={theme} key={chat?.messageId} selfChat={userId === chat?.senderInfo?.userId || userId === chat?.senderId} >
153
+ <ImageComponent className={'user_profile_picture'} src={chat?.senderProfileImageUrl} alt={'user_profile_picture'} />
154
+ <AudioTime>{audioDuration}</AudioTime>
155
+ <div>{getPlayPauseIcon()}</div>
156
+ <div className='wave_container' ref={waveformRef}></div>
157
+
158
+ </AudioBubbleWrapper>
159
+ );
160
+ }
161
+
162
+ export default AudioBubble;
@@ -0,0 +1,232 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import styled,{css}from "styled-components";
3
+ import { decodeChatBody, getTimeWithMeridian } from "../../lib/helpers";
4
+ import { userChatMessageOption, userMenuOptions } from "../../lib/mockData";
5
+ import ChatBubbleReply from "../../view/component/Chatbox.js/ChatBubbleReply";
6
+ import Icon from "../Icon";
7
+ import MessageInfoDropdown from "../MessageInfoDropdown";
8
+ import AudioBubble from "./AudioBubble";
9
+ import { mobile } from "../../utils/media";
10
+ import DocumentBubble from "./DocumentBubble";
11
+
12
+ const ChatMessageReceiver = styled.div`
13
+ padding: 3px 5px;
14
+ font-size: 14px;
15
+ width:100%;
16
+ word-break:break-all;
17
+ align-items:end;
18
+ border-radius: 5px;
19
+ margin-bottom: 2px;
20
+ color: var(--black);
21
+ margin-left: auto;
22
+ position:relative;
23
+ display: flex;
24
+ ${(props) =>
25
+ (props.messageLength || props?.messageDataLength) &&
26
+ css`
27
+ flex-direction:column;
28
+ position:relative;
29
+ `}
30
+ ${(props) =>
31
+ props.isMedia &&
32
+ css`
33
+ position:absolute !important;
34
+ display:flex !important;
35
+ bottom: 15px !important;
36
+ right:10px !important;
37
+ justify-content:end !important;
38
+
39
+ `}
40
+
41
+ .chat__msg-status-icon {
42
+ color: #b3b3b3;
43
+ margin-left: 3px;
44
+ }
45
+
46
+ .chat__msg-status-icon--blue {
47
+ color: #0da9e5;
48
+ margin-left: 4px;
49
+ }
50
+
51
+ .message{
52
+ ${(props) =>
53
+ props.messageDataLength &&
54
+ css`
55
+ margin-bottom:5px;
56
+ `}
57
+ }
58
+ `;
59
+
60
+ const ChatTime = styled.div`
61
+ font-size: 0.6875rem;
62
+ display:flex;
63
+ color: ${props => props.isAttachments ? 'var(--primary-white)' : 'var(--chat_timing)'};
64
+ margin-bottom:-7px;
65
+ margin-left:${props => props.isChatDocumentType ? 'auto' : '10px'};
66
+ ${(props) =>
67
+ (props?.messageLength) &&
68
+ css`
69
+ margin-bottom:5px;
70
+ `}
71
+ ${(props) =>
72
+ (props?.messageDataLength) &&
73
+ css`
74
+ margin-bottom:unset;
75
+ `}
76
+ ${mobile(css`
77
+ white-space: nowrap;
78
+ margin-bottom: -4px;
79
+ `)}
80
+ `;
81
+
82
+
83
+ const ChatMsgFooter = styled.span`
84
+ display: flex;
85
+ align-items: flex-end;
86
+ ${mobile(css`
87
+ justify-content: flex-end;
88
+ `)}
89
+
90
+ ${(props) =>
91
+ props.messageLength &&
92
+ css`
93
+ position:absolute;
94
+ top:100%;
95
+ bottom:0px;
96
+ right:0px;
97
+ left:unset;
98
+ `}
99
+ `;
100
+ const MessageArrow = styled.div`
101
+ ${(props) =>
102
+ props.messageLength &&
103
+ css`
104
+ top:0px !important;
105
+ // right:100px !imporant;
106
+ `}
107
+ ${(props) =>
108
+ props?.messageDataLength &&
109
+ css`
110
+ top:-30px !important;
111
+ right:-6px !imporant;
112
+ `}
113
+
114
+ ${(props) =>
115
+ props?.isMedia &&
116
+ css`
117
+ top:0px !important;
118
+ right:0px !important;
119
+ `}
120
+
121
+ `;
122
+
123
+ const ChatMessageBubbleBody = styled.div`
124
+ display: flex;
125
+ justify-content: space-between;
126
+ position: relative;
127
+ flex-direction: ${props => props.isChatDocumentType ? 'column' : 'row'};
128
+ ${mobile(css`
129
+ flex-direction: ${props => props.isAttachments ? 'column' : ''};
130
+ `)}
131
+ `;
132
+
133
+ function ChatBubble(props) {
134
+ const { chat, chatProfileData, deliverMessage, readMessage,theme,setslideShow,setMessageInfo,messageInfo,setMessageChat,setSearchShow, isMedia,setIsReply,isReply,setReply,reply,setDeleteMessage ,deleteMessage,getReplyMessageData, isOpen , setIsOpen , isNotShowDropDown} =
135
+ props;
136
+ const [messageLength , setmessageLength] = useState(false);
137
+ // const [reciver ,isReciver] = useState(false);
138
+ useEffect(()=>{
139
+ // if(chat.senderInfo?.userId == chatProfileData){
140
+ // isReciver(true);
141
+ // }
142
+ if(chat?.body?.length >74){
143
+ setmessageLength (true);
144
+ }
145
+ },[chat,chat?.body?.length]);
146
+
147
+ return (
148
+ <>
149
+ <ChatMessageReceiver messageDataLength={chat?.body?.length ===74} messageLength={chat?.body?.length >74} isMedia={isMedia}>
150
+ <div style={{display:"block"}}>
151
+ {/* {
152
+ getReplyMessageData?.body?.length && <ChatBubbleReply reply={getReplyMessageData} />
153
+ } */}
154
+
155
+ <ChatMessageBubbleBody isChatDocumentType={chat?.customType === 'document'} isAttachments={chat?.attachments?.length > 0}>
156
+ <>
157
+ {
158
+ chat?.customType === "document" && <DocumentBubble chat={chat} />
159
+ }
160
+ </>
161
+ {isMedia ? "" :
162
+ chat?.customType === 'audio' ? <AudioBubble theme={theme} chat={chat} /> :
163
+ <>
164
+ {
165
+ chat?.customType !== 'document' &&
166
+ <div className="message" messageDataLength={chat?.body?.length ===74}>{decodeChatBody(chat?.body) }</div>
167
+ }
168
+ </>
169
+ }
170
+
171
+ <ChatMsgFooter messageLength={chat?.body?.length >74} >
172
+ <ChatTime isChatDocumentType={chat?.customType === 'document'} isAttachments={chat?.attachments?.length > 0 && chat?.customType !== 'audio' && chat?.customType !== 'document'} messageLength={chat?.body?.length >= 74} messageDataLength={chat?.body?.length ===74} >
173
+ { getTimeWithMeridian(new Date(chat?.sentAt))}
174
+ <div>
175
+ {(chat.senderInfo?.userId || chat?.senderId) !== chatProfileData?.userId && (
176
+ <Icon style={{marginLeft:"2px"}} id={'singleTick'}
177
+ />
178
+ )}
179
+ </div>
180
+ </ChatTime>
181
+ </ChatMsgFooter>
182
+ </ChatMessageBubbleBody>
183
+ </div>
184
+ </ChatMessageReceiver>
185
+ {
186
+ !isNotShowDropDown &&
187
+ <MessageArrow className="messageChat" messageLength={chat?.body?.length >74} messageDataLength={chat?.body?.length ===74} isMedia={isMedia}>
188
+ {(chat?.senderInfo?.userId || chat?.senderId) !== chatProfileData?.userId ? (
189
+ <>
190
+ <MessageInfoDropdown theme={theme} messageInfo={messageInfo} setMessageInfo={setMessageInfo} chat={chat} setMessageChat={setMessageChat} setslideShow={setslideShow} setSearchShow={setSearchShow} menuData={userChatMessageOption} messageLength={messageLength} setIsReply={setIsReply} isReply={isReply} setReply={setReply} reply={reply} setDeleteMessage={setDeleteMessage} deleteMessage={deleteMessage}
191
+ // getReplyMessageData={getReplyMessageData}
192
+ isOpen={isOpen} setIsOpen={setIsOpen}
193
+ />
194
+ </>
195
+ ) :
196
+ (
197
+ <></>
198
+ // <MessageInfoDropdown theme={theme} messageInfo={messageInfo} setMessageInfo={setMessageInfo} chat={chat} setMessageChat={setMessageChat} setslideShow={setslideShow} setSearchShow={setSearchShow} menuData={userMenuOptions} userChat={userMenuOptions} messageLength={messageLength} isMedia={isMedia} setIsReply={setIsReply} isReply={isReply} setReply={setReply} reply={reply} deleteMessage={deleteMessage} setDeleteMessage={setDeleteMessage}
199
+ // // getReplyMessageData={getReplyMessageData}
200
+ // isOpen={isOpen} setIsOpen={setIsOpen} />
201
+
202
+ )}
203
+ </MessageArrow>
204
+ }
205
+ <style jsx>{`
206
+ .user_self_chat .messageChat{
207
+ display:none;
208
+ }
209
+ .user_self_chat:hover .messageChat {
210
+ display:inline-block !important;
211
+ right:0px;
212
+ position:absolute;
213
+ top:-10%;
214
+ right:0px;
215
+ }
216
+
217
+ .user_chat .messageChat{
218
+ display:none;
219
+ }
220
+ .user_chat:hover .messageChat {
221
+ display:inline-block !important;
222
+ right:0px;
223
+ position:absolute;
224
+ top:-10%;
225
+ right:0px;
226
+ }
227
+ `}</style>
228
+ </>
229
+ );
230
+ }
231
+
232
+ export default ChatBubble;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import styled, { css } from 'styled-components';
3
+ import { mobile } from '../../utils/media';
4
+ import ImageComponent from '../ImageComponent';
5
+ import { DOCUMENT, DOWNLOAD_CAROUSEL } from '../../utils/global';
6
+ import { formatBytes } from '../../lib/helpers';
7
+ import { getCookie } from '../../lib/session';
8
+ import { saveAs } from 'file-saver';
9
+
10
+ const DocumentBubbleWrapper = styled.div`
11
+ position: relative;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: space-between;
15
+ padding: 1rem;
16
+ margin: 0.25rem 0 1rem auto;
17
+ border-radius: 7.5px;
18
+ background-color: ${props => props.selfChat ? 'var(--reply-background-color)' : 'var( --chat_hover)'};
19
+ width: 336px;
20
+ cursor: pointer;
21
+
22
+ ${mobile(css`
23
+ width: 280px;
24
+ `)}
25
+
26
+ .document_icon{
27
+ width: 26px;
28
+ height: 30px;
29
+ }
30
+ `;
31
+
32
+ const DocumentInfoWrapper = styled.div`
33
+ display: flex;
34
+ align-items: center;
35
+ gap: 1rem;
36
+ `;
37
+
38
+ const DocumentBubbleWrapperInfoContainer = styled.div`
39
+ position: relative;
40
+ `;
41
+
42
+ const DocumentBubbleWrapperName = styled.p`
43
+ margin-bottom: 0;
44
+
45
+ `;
46
+
47
+ const DocumentBubbleWrapperSize = styled.p`
48
+ color: var(--chat_timing);
49
+ margin-bottom: 0;
50
+ `;
51
+
52
+ const DownloadIconWrapper = styled.div`
53
+ width: 40px;
54
+ height: 40px;
55
+ border-radius: 50%;
56
+ border: 1px solid var(--chat_timing);
57
+ display: flex;
58
+ justify-content: center;
59
+ align-items: center;
60
+ `;
61
+
62
+ const DocumentBubble = (props) => {
63
+ const { chat } = props;
64
+ const userId = getCookie('userId');
65
+
66
+ const downloadDocumentHandler = () => {
67
+ saveAs(chat?.attachments?.[0]?.mediaUrl, chat?.attachments?.[0]?.name);
68
+ }
69
+
70
+ return (
71
+ <DocumentBubbleWrapper selfChat={userId === chat?.senderInfo?.userId || userId === chat?.senderId}
72
+ onClick={downloadDocumentHandler} >
73
+ <DocumentInfoWrapper>
74
+ <ImageComponent className="document_icon" src={DOCUMENT} alt="document" />
75
+ <DocumentBubbleWrapperInfoContainer>
76
+ <DocumentBubbleWrapperName>{chat?.attachments?.[0]?.name}</DocumentBubbleWrapperName>
77
+ <DocumentBubbleWrapperSize>{formatBytes(chat?.attachments?.[0]?.size)}</DocumentBubbleWrapperSize>
78
+ </DocumentBubbleWrapperInfoContainer>
79
+ </DocumentInfoWrapper>
80
+ <DownloadIconWrapper>
81
+ <ImageComponent src={DOWNLOAD_CAROUSEL} alt="download_document" />
82
+ </DownloadIconWrapper>
83
+ </DocumentBubbleWrapper>
84
+ )
85
+ }
86
+
87
+ export default DocumentBubble;