l-min-components 1.0.294 → 1.0.297
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.
- package/package.json +1 -1
- package/src/components/index.js +4 -2
- package/src/components/messageAddon/InputSection/index.jsx +336 -0
- package/src/components/messageAddon/assets/images/avatar.jpg +0 -0
- package/src/components/messageAddon/assets/svg/bin.jsx +14 -0
- package/src/components/messageAddon/assets/svg/check_circle.jsx +25 -0
- package/src/components/messageAddon/assets/svg/emoji.jsx +38 -0
- package/src/components/messageAddon/assets/svg/gallery.jsx +31 -0
- package/src/components/messageAddon/assets/svg/microphone.jsx +38 -0
- package/src/components/messageAddon/assets/svg/more.jsx +22 -0
- package/src/components/messageAddon/assets/svg/noMessage.jsx +49 -0
- package/src/components/messageAddon/assets/svg/send.jsx +24 -0
- package/src/components/messageAddon/assets/svg/send_fail.jsx +15 -0
- package/src/components/messageAddon/assets/svg/sending_status.jsx +22 -0
- package/src/components/messageAddon/assets/svg/warning.jsx +14 -0
- package/src/components/messageAddon/hooks/messagesContext.js +19 -0
- package/src/components/messageAddon/hooks/useFriends.js +30 -0
- package/src/components/messageAddon/hooks/useMedia.js +81 -0
- package/src/components/messageAddon/hooks/useMessaging.js +241 -0
- package/src/components/messageAddon/hooks/useRooms.js +210 -0
- package/src/components/messageAddon/messages/chatheader/index.jsx +94 -0
- package/src/components/messageAddon/messages/dropdown/chat-dropdown.jsx +45 -0
- package/src/components/messageAddon/messages/index.jsx +17 -0
- package/src/components/messageAddon/messages/index.styled.js +988 -0
- package/src/components/messageAddon/messages/message-modals/deleteChat-modal.jsx +111 -0
- package/src/components/messageAddon/messages/message-modals/index.styled.js +366 -0
- package/src/components/messageAddon/messages/message-modals/report-modal.jsx +238 -0
- package/src/components/messageAddon/messages/messagebox/messageBubble.jsx +73 -0
- package/src/components/messageAddon/messages/messagebox/waveSurferPlayer.jsx +69 -0
- package/src/components/messageAddon/messages/messages.jsx +374 -0
- package/src/components/messageAddon/utils/helpers.js +41 -0
package/package.json
CHANGED
package/src/components/index.js
CHANGED
|
@@ -28,5 +28,7 @@ export { default as Calender } from "./calender/input";
|
|
|
28
28
|
export { default as ErrorPage } from "./errorPage";
|
|
29
29
|
export { default as AppMainLayout } from "./AppMainLayout";
|
|
30
30
|
export { OutletContext as OutletContext } from "./AppMainLayout";
|
|
31
|
-
export { default as DatePickerCalender } from "./datePicker";
|
|
32
|
-
export { default as
|
|
31
|
+
export { default as DatePickerCalender } from "./datePicker";
|
|
32
|
+
export { default as DatePickerCalender } from "./datePicker";
|
|
33
|
+
export { default as TextEditor } from "./textEditor";
|
|
34
|
+
export { default as MessageAddon } from "./messageAddon/messages";
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useLayoutEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
} from "react";
|
|
8
|
+
import { EmojiIcon } from "../../../assets/svg/emoji";
|
|
9
|
+
import { GalleryIcon } from "../../../assets/svg/gallery";
|
|
10
|
+
import { MicrophoneIcon } from "../../../assets/svg/microphone";
|
|
11
|
+
import { SendIcon } from "../../../assets/svg/send";
|
|
12
|
+
import { TextMessagePanel } from "../messages/index.styled";
|
|
13
|
+
import Picker from "emoji-picker-react";
|
|
14
|
+
import cx from "classnames";
|
|
15
|
+
import { ReactMic } from "react-mic";
|
|
16
|
+
import WaveSurfer from "wavesurfer.js";
|
|
17
|
+
import moment from "moment";
|
|
18
|
+
import { RecorderIcon } from "../../../assets/svg/recorder";
|
|
19
|
+
import { RecorderPlayIcon } from "../../../assets/svg/recorderPlay";
|
|
20
|
+
import { PauseIcon } from "../../../assets/svg/pause";
|
|
21
|
+
import { Bin } from "../../../assets/svg/bin";
|
|
22
|
+
import useMessaging from "../../../hooks/useMessaging";
|
|
23
|
+
import useMedia from "../../../hooks/useMedia";
|
|
24
|
+
import { getCookie } from "../../../utils/helpers";
|
|
25
|
+
import InputEmoji from "react-input-emoji";
|
|
26
|
+
|
|
27
|
+
/** The input section of an open chat, for sending texts, emojis and audios
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
const InputSection = ({
|
|
31
|
+
userID,
|
|
32
|
+
setPreviewModalIsOpen,
|
|
33
|
+
mediaForm,
|
|
34
|
+
setMediaForm,
|
|
35
|
+
setAllMessages,
|
|
36
|
+
allMessages,
|
|
37
|
+
newMessages,
|
|
38
|
+
setNewMessages,
|
|
39
|
+
setIsMessageSending,
|
|
40
|
+
}) => {
|
|
41
|
+
const [showEmoji, setShowEmoji] = useState();
|
|
42
|
+
const [inputMethod, setInputMethod] = useState("text"); // text | recorder
|
|
43
|
+
const [text, setText] = useState({ text: "", user_message: true }); // state for user text
|
|
44
|
+
const [blobData, setBlobData] = useState({}); //state for audio
|
|
45
|
+
const [recording, setRecording] = useState(false);
|
|
46
|
+
const imageRef = useRef();
|
|
47
|
+
const {
|
|
48
|
+
handleCreateMessage,
|
|
49
|
+
createMessageData,
|
|
50
|
+
handleCreateMessageWithMedia,
|
|
51
|
+
createMessageWithMediaData,
|
|
52
|
+
} = useMessaging();
|
|
53
|
+
const { handleUploadMedia, uploadMediaData } = useMedia();
|
|
54
|
+
|
|
55
|
+
console.log(text);
|
|
56
|
+
|
|
57
|
+
// Handle Send when Enter key pressed
|
|
58
|
+
const handleEnterKey = (e) => {
|
|
59
|
+
if (e.key === "Enter") {
|
|
60
|
+
handleSendMessage();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// handle sending a text and audio when button clicked
|
|
65
|
+
const handleSendMessage = (e) => {
|
|
66
|
+
if (inputMethod === "recorder") {
|
|
67
|
+
// const file = new File([blobData.blob], `record-${Date.now()}.wav`);
|
|
68
|
+
const file = new File([blobData.blob], `record-${Date.now()}.wav`, {
|
|
69
|
+
type: "audio/wav",
|
|
70
|
+
});
|
|
71
|
+
const data = {
|
|
72
|
+
media: file,
|
|
73
|
+
};
|
|
74
|
+
handleCreateMessageWithMedia(data.media, userID);
|
|
75
|
+
setInputMethod("text");
|
|
76
|
+
console.log("uploas", file);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (inputMethod === "text") {
|
|
80
|
+
// setNewMessages((prev) => [...prev, text]);
|
|
81
|
+
setIsMessageSending(true);
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
handleCreateMessage(userID, text);
|
|
84
|
+
}, 1000);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
console.log("createMessageData", createMessageData);
|
|
89
|
+
|
|
90
|
+
// handle open modal for image preview when an image selected (future note)
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (mediaForm?.media) {
|
|
93
|
+
setPreviewModalIsOpen(true);
|
|
94
|
+
}
|
|
95
|
+
}, [mediaForm]);
|
|
96
|
+
|
|
97
|
+
//handle update messages state when a message sent successfully for text and audio
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (createMessageData?.response?.status === 201) {
|
|
100
|
+
setNewMessages((prev) => [...prev, createMessageData?.data]);
|
|
101
|
+
// newMessages[newMessages.length - 1] = createMessageData?.data;
|
|
102
|
+
setIsMessageSending(false);
|
|
103
|
+
setText({
|
|
104
|
+
...text,
|
|
105
|
+
text: "",
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}, [createMessageData?.response]);
|
|
109
|
+
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (createMessageWithMediaData?.response?.status === 201) {
|
|
112
|
+
setNewMessages((prev) => [...prev, createMessageWithMediaData?.data]);
|
|
113
|
+
// newMessages[newMessages.length - 1] = createMessageData?.data;
|
|
114
|
+
setText({
|
|
115
|
+
...text,
|
|
116
|
+
text: "",
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}, [createMessageWithMediaData?.response]);
|
|
120
|
+
|
|
121
|
+
//handle update messages state when a message sent successfully for text and audio ends here
|
|
122
|
+
|
|
123
|
+
console.log("media", mediaForm);
|
|
124
|
+
console.log("media2", uploadMediaData);
|
|
125
|
+
console.log("media3", imageRef);
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<TextMessagePanel>
|
|
129
|
+
<div
|
|
130
|
+
className={cx("text-input-wrapper", {
|
|
131
|
+
"text-mode": inputMethod === "text",
|
|
132
|
+
})}
|
|
133
|
+
>
|
|
134
|
+
{inputMethod === "text" && (
|
|
135
|
+
<>
|
|
136
|
+
<div className="icon-box">
|
|
137
|
+
<>
|
|
138
|
+
{/* for handling sending of media (future note) */}
|
|
139
|
+
{/* <span onClick={(e) => imageRef.current.click()}>
|
|
140
|
+
<GalleryIcon />
|
|
141
|
+
</span>
|
|
142
|
+
<input
|
|
143
|
+
ref={imageRef}
|
|
144
|
+
type="file"
|
|
145
|
+
accept="image/*"
|
|
146
|
+
style={{ display: "none" }}
|
|
147
|
+
onChange={async (e) => {
|
|
148
|
+
console.log("media", e);
|
|
149
|
+
if (e.target.files) {
|
|
150
|
+
const file = e.target.files[0];
|
|
151
|
+
let imageDataUrl = await readFile(file);
|
|
152
|
+
setMediaForm({
|
|
153
|
+
...mediaForm,
|
|
154
|
+
media: e.target.files[0],
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}}
|
|
158
|
+
/> */}
|
|
159
|
+
</>
|
|
160
|
+
<span
|
|
161
|
+
onClick={(e) => {
|
|
162
|
+
setInputMethod("recorder");
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
<MicrophoneIcon />
|
|
166
|
+
</span>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<InputEmoji
|
|
170
|
+
value={text.text}
|
|
171
|
+
cleanOnEnter
|
|
172
|
+
onEnter={handleSendMessage}
|
|
173
|
+
placeholder="Start typing..."
|
|
174
|
+
onChange={(e) => {
|
|
175
|
+
setText((prev) => ({
|
|
176
|
+
...prev,
|
|
177
|
+
text: e,
|
|
178
|
+
}));
|
|
179
|
+
}}
|
|
180
|
+
theme="light"
|
|
181
|
+
/>
|
|
182
|
+
</>
|
|
183
|
+
)}
|
|
184
|
+
{inputMethod === "recorder" && (
|
|
185
|
+
<>
|
|
186
|
+
<Recorder
|
|
187
|
+
{...{
|
|
188
|
+
setInputMethod,
|
|
189
|
+
blobData,
|
|
190
|
+
setBlobData,
|
|
191
|
+
recording,
|
|
192
|
+
setRecording,
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
195
|
+
</>
|
|
196
|
+
)}
|
|
197
|
+
</div>
|
|
198
|
+
<button
|
|
199
|
+
className={`send-box ${
|
|
200
|
+
!text.text && (inputMethod === "text" || recording) ? "disabled" : ""
|
|
201
|
+
}`}
|
|
202
|
+
onClick={handleSendMessage}
|
|
203
|
+
disabled={
|
|
204
|
+
!text.text &&
|
|
205
|
+
(inputMethod === "text" || recording || createMessageData?.loading)
|
|
206
|
+
}
|
|
207
|
+
>
|
|
208
|
+
<SendIcon />
|
|
209
|
+
</button>
|
|
210
|
+
</TextMessagePanel>
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/** For audio recording and waves functionality
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
const Recorder = ({
|
|
218
|
+
blobData,
|
|
219
|
+
setBlobData,
|
|
220
|
+
setInputMethod,
|
|
221
|
+
recording,
|
|
222
|
+
setRecording,
|
|
223
|
+
}) => {
|
|
224
|
+
const [recordingTime, setRecordingTime] = useState(0);
|
|
225
|
+
const waveSurfer = useRef(null);
|
|
226
|
+
const counterRef = useRef();
|
|
227
|
+
|
|
228
|
+
console.log("blob", blobData);
|
|
229
|
+
// on record stop, concatenate blob to form a pause and continue recording feature
|
|
230
|
+
const handleStop = (data) => {
|
|
231
|
+
const { blob } = data;
|
|
232
|
+
setBlobData((state) => {
|
|
233
|
+
const newBlob = state.blob
|
|
234
|
+
? new Blob([state.blob, blob], { type: "audio/wav" })
|
|
235
|
+
: blob;
|
|
236
|
+
|
|
237
|
+
const url = URL.createObjectURL(newBlob);
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
blob: newBlob,
|
|
241
|
+
url,
|
|
242
|
+
};
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
useLayoutEffect(() => {
|
|
247
|
+
setRecording(true);
|
|
248
|
+
}, []);
|
|
249
|
+
|
|
250
|
+
// handle counting time while recording
|
|
251
|
+
useEffect(() => {
|
|
252
|
+
let time = 0;
|
|
253
|
+
if (recording) {
|
|
254
|
+
counterRef.current = setInterval(() => {
|
|
255
|
+
time++;
|
|
256
|
+
const currentDuration = waveSurfer.current?.getDuration() ?? 0;
|
|
257
|
+
// console.log(waveSurfer.current?.getDuration() ?? 0);
|
|
258
|
+
setRecordingTime(() => {
|
|
259
|
+
return Math.floor(currentDuration + time);
|
|
260
|
+
});
|
|
261
|
+
}, 1000);
|
|
262
|
+
}
|
|
263
|
+
return () => {
|
|
264
|
+
if (counterRef.current) {
|
|
265
|
+
clearInterval(counterRef.current);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}, [recording]);
|
|
269
|
+
|
|
270
|
+
//handle creating waves each time
|
|
271
|
+
useEffect(() => {
|
|
272
|
+
if (blobData.blob) {
|
|
273
|
+
if (!waveSurfer.current) {
|
|
274
|
+
waveSurfer.current = WaveSurfer.create({
|
|
275
|
+
container: "#waves",
|
|
276
|
+
waveColor: "#E5AD0E",
|
|
277
|
+
progressColor: "#FECF4C",
|
|
278
|
+
cursorWidth: 0,
|
|
279
|
+
height: 58,
|
|
280
|
+
barWidth: 2.5,
|
|
281
|
+
barGap: 4,
|
|
282
|
+
barRadius: 2,
|
|
283
|
+
barMinHeight: 3,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
waveSurfer.current.loadBlob(blobData.blob);
|
|
288
|
+
}
|
|
289
|
+
}, [blobData.blob]);
|
|
290
|
+
|
|
291
|
+
return (
|
|
292
|
+
<>
|
|
293
|
+
<div className="left-recorder-state">
|
|
294
|
+
<span className="icon" onClick={(e) => setRecording((state) => !state)}>
|
|
295
|
+
{recording ? <PauseIcon /> : <RecorderIcon />}
|
|
296
|
+
</span>
|
|
297
|
+
<div className="timer">
|
|
298
|
+
{moment.duration(recordingTime, "seconds").minutes()}:
|
|
299
|
+
{moment.duration(recordingTime, "seconds").seconds()}
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
<div className="waves-section">
|
|
303
|
+
{!recording && (
|
|
304
|
+
<span
|
|
305
|
+
className="icon"
|
|
306
|
+
onClick={() => {
|
|
307
|
+
waveSurfer.current.playPause();
|
|
308
|
+
}}
|
|
309
|
+
>
|
|
310
|
+
<RecorderPlayIcon />
|
|
311
|
+
</span>
|
|
312
|
+
)}
|
|
313
|
+
<div id="waves"></div>
|
|
314
|
+
{!recording && (
|
|
315
|
+
<span
|
|
316
|
+
className="icon"
|
|
317
|
+
onClick={
|
|
318
|
+
() => setInputMethod("text") // resetting input method, everything about recorder shutdown
|
|
319
|
+
}
|
|
320
|
+
>
|
|
321
|
+
<Bin />
|
|
322
|
+
</span>
|
|
323
|
+
)}
|
|
324
|
+
<div className="react-mic">
|
|
325
|
+
<ReactMic
|
|
326
|
+
onStop={handleStop}
|
|
327
|
+
record={recording}
|
|
328
|
+
mimeType="audio/wav"
|
|
329
|
+
/>
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
</>
|
|
333
|
+
);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export default InputSection;
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const Bin = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "14"}
|
|
4
|
+
height={height || "18"}
|
|
5
|
+
viewBox="0 0 14 18"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M1 16C1 17.1 1.9 18 3 18H11C12.1 18 13 17.1 13 16V4H1V16ZM3 6H11V16H3V6ZM10.5 1L9.5 0H4.5L3.5 1H0V3H14V1H10.5Z"
|
|
11
|
+
fill="#ADB3B3"
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const CheckCircleIcon = ({ width, height, fill, onClick }) => (
|
|
2
|
+
<svg
|
|
3
|
+
onClick={onClick}
|
|
4
|
+
width={width || "13"}
|
|
5
|
+
height={height || "13"}
|
|
6
|
+
viewBox="0 0 13 13"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
>
|
|
10
|
+
<g id="Check circle" clip-path="url(#clip0_14342_79747)">
|
|
11
|
+
<path
|
|
12
|
+
id="Icon"
|
|
13
|
+
fill-rule="evenodd"
|
|
14
|
+
clip-rule="evenodd"
|
|
15
|
+
d="M6.50313 12.9984C10.0947 12.9984 13.0063 10.0869 13.0063 6.49531C13.0063 2.90374 10.0947 -0.0078125 6.50313 -0.0078125C2.91155 -0.0078125 0 2.90374 0 6.49531C0 10.0869 2.91155 12.9984 6.50313 12.9984ZM9.5166 5.44433C9.83405 5.12688 9.83405 4.61219 9.5166 4.29473C9.19915 3.97728 8.68445 3.97728 8.367 4.29473L5.69024 6.97149L4.63925 5.92051C4.3218 5.60306 3.80711 5.60306 3.48965 5.92051C3.1722 6.23797 3.1722 6.75266 3.48965 7.07011L5.11544 8.6959C5.43289 9.01335 5.94758 9.01335 6.26504 8.6959L9.5166 5.44433Z"
|
|
16
|
+
fill="#00C2C2"
|
|
17
|
+
/>
|
|
18
|
+
</g>
|
|
19
|
+
<defs>
|
|
20
|
+
<clipPath id="clip0_14342_79747">
|
|
21
|
+
<rect width="13" height="13" fill="white" />
|
|
22
|
+
</clipPath>
|
|
23
|
+
</defs>
|
|
24
|
+
</svg>
|
|
25
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const EmojiIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "24"}
|
|
4
|
+
height={height || "24"}
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M19.0668 4.94813C23.0368 8.91813 22.9668 15.3981 18.8668 19.2881C15.0768 22.8781 8.92679 22.8781 5.12679 19.2881C1.01679 15.3981 0.946776 8.91813 4.92678 4.94813C8.82678 1.03813 15.1668 1.03813 19.0668 4.94813Z"
|
|
11
|
+
stroke="#ADB3B3"
|
|
12
|
+
stroke-width="1.5"
|
|
13
|
+
stroke-linecap="round"
|
|
14
|
+
stroke-linejoin="round"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
d="M15.834 16.0664C13.714 18.0664 10.2741 18.0664 8.16406 16.0664"
|
|
18
|
+
stroke="#ADB3B3"
|
|
19
|
+
stroke-width="1.5"
|
|
20
|
+
stroke-linecap="round"
|
|
21
|
+
stroke-linejoin="round"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M8.66638 8.98828H8.67536"
|
|
25
|
+
stroke="#ADB3B3"
|
|
26
|
+
stroke-width="2.5"
|
|
27
|
+
stroke-linecap="round"
|
|
28
|
+
stroke-linejoin="round"
|
|
29
|
+
/>
|
|
30
|
+
<path
|
|
31
|
+
d="M15.8383 8.98828H15.8472"
|
|
32
|
+
stroke="#ADB3B3"
|
|
33
|
+
stroke-width="2.5"
|
|
34
|
+
stroke-linecap="round"
|
|
35
|
+
stroke-linejoin="round"
|
|
36
|
+
/>
|
|
37
|
+
</svg>
|
|
38
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const GalleryIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "24"}
|
|
4
|
+
height={height || "24"}
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M9 22H15C20 22 22 20 22 15V9C22 4 20 2 15 2H9C4 2 2 4 2 9V15C2 20 4 22 9 22Z"
|
|
11
|
+
stroke="#4A4D4D"
|
|
12
|
+
stroke-width="1.5"
|
|
13
|
+
stroke-linecap="round"
|
|
14
|
+
stroke-linejoin="round"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
d="M9 10C10.1046 10 11 9.10457 11 8C11 6.89543 10.1046 6 9 6C7.89543 6 7 6.89543 7 8C7 9.10457 7.89543 10 9 10Z"
|
|
18
|
+
stroke="#4A4D4D"
|
|
19
|
+
stroke-width="1.5"
|
|
20
|
+
stroke-linecap="round"
|
|
21
|
+
stroke-linejoin="round"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M2.67188 18.9486L7.60187 15.6386C8.39187 15.1086 9.53187 15.1686 10.2419 15.7786L10.5719 16.0686C11.3519 16.7386 12.6119 16.7386 13.3919 16.0686L17.5519 12.4986C18.3319 11.8286 19.5919 11.8286 20.3719 12.4986L22.0019 13.8986"
|
|
25
|
+
stroke="#4A4D4D"
|
|
26
|
+
stroke-width="1.5"
|
|
27
|
+
stroke-linecap="round"
|
|
28
|
+
stroke-linejoin="round"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
|
31
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const MicrophoneIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "24"}
|
|
4
|
+
height={height || "24"}
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M12 19C15.31 19 18 16.31 18 13V8C18 4.69 15.31 2 12 2C8.69 2 6 4.69 6 8V13C6 16.31 8.69 19 12 19Z"
|
|
11
|
+
stroke="#4A4D4D"
|
|
12
|
+
stroke-width="1.5"
|
|
13
|
+
stroke-linecap="round"
|
|
14
|
+
stroke-linejoin="round"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
d="M3 11V13C3 17.97 7.03 22 12 22C16.97 22 21 17.97 21 13V11"
|
|
18
|
+
stroke="#4A4D4D"
|
|
19
|
+
stroke-width="1.5"
|
|
20
|
+
stroke-linecap="round"
|
|
21
|
+
stroke-linejoin="round"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M9.10938 7.47969C10.8894 6.82969 12.8294 6.82969 14.6094 7.47969"
|
|
25
|
+
stroke="#4A4D4D"
|
|
26
|
+
stroke-width="1.5"
|
|
27
|
+
stroke-linecap="round"
|
|
28
|
+
stroke-linejoin="round"
|
|
29
|
+
/>
|
|
30
|
+
<path
|
|
31
|
+
d="M10.0312 10.4819C11.2313 10.1519 12.5013 10.1519 13.7013 10.4819"
|
|
32
|
+
stroke="#4A4D4D"
|
|
33
|
+
stroke-width="1.5"
|
|
34
|
+
stroke-linecap="round"
|
|
35
|
+
stroke-linejoin="round"
|
|
36
|
+
/>
|
|
37
|
+
</svg>
|
|
38
|
+
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const MoreIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "24"}
|
|
4
|
+
height={height || "24"}
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M14 5C14 3.9 13.1 3 12 3C10.9 3 10 3.9 10 5C10 6.1 10.9 7 12 7C13.1 7 14 6.1 14 5Z"
|
|
11
|
+
fill="white"
|
|
12
|
+
/>
|
|
13
|
+
<path
|
|
14
|
+
d="M14 19C14 17.9 13.1 17 12 17C10.9 17 10 17.9 10 19C10 20.1 10.9 21 12 21C13.1 21 14 20.1 14 19Z"
|
|
15
|
+
fill="white"
|
|
16
|
+
/>
|
|
17
|
+
<path
|
|
18
|
+
d="M14 12C14 10.9 13.1 10 12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12Z"
|
|
19
|
+
fill="white"
|
|
20
|
+
/>
|
|
21
|
+
</svg>
|
|
22
|
+
);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export const NoMessage = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "65"}
|
|
4
|
+
height={height || "65"}
|
|
5
|
+
viewBox="0 0 65 65"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<g id="vuesax/linear/message">
|
|
10
|
+
<g id="vuesax/linear/message_2">
|
|
11
|
+
<g id="message">
|
|
12
|
+
<path
|
|
13
|
+
id="Vector"
|
|
14
|
+
d="M23.1423 50.7943H21.8056C11.1123 50.7943 5.76562 48.121 5.76562 34.7543V21.3877C5.76562 10.6943 11.1123 5.34766 21.8056 5.34766H43.1923C53.8856 5.34766 59.2323 10.6943 59.2323 21.3877V34.7543C59.2323 45.4477 53.8856 50.7943 43.1923 50.7943H41.8556C41.0269 50.7943 40.2249 51.1953 39.717 51.8637L35.707 57.2103C33.9426 59.5629 31.0554 59.5629 29.291 57.2103L25.281 51.8637C24.8532 51.2755 23.8641 50.7943 23.1423 50.7943Z"
|
|
15
|
+
stroke="#C6CCCC"
|
|
16
|
+
stroke-width="4.40659"
|
|
17
|
+
stroke-miterlimit="10"
|
|
18
|
+
stroke-linecap="round"
|
|
19
|
+
stroke-linejoin="round"
|
|
20
|
+
/>
|
|
21
|
+
<path
|
|
22
|
+
id="Vector_2"
|
|
23
|
+
d="M43.197 29.407H43.221"
|
|
24
|
+
stroke="#C6CCCC"
|
|
25
|
+
stroke-width="5.87546"
|
|
26
|
+
stroke-linecap="round"
|
|
27
|
+
stroke-linejoin="round"
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
id="Vector_3"
|
|
31
|
+
d="M32.5017 29.407H32.5257"
|
|
32
|
+
stroke="#C6CCCC"
|
|
33
|
+
stroke-width="5.87546"
|
|
34
|
+
stroke-linecap="round"
|
|
35
|
+
stroke-linejoin="round"
|
|
36
|
+
/>
|
|
37
|
+
<path
|
|
38
|
+
id="Vector_4"
|
|
39
|
+
d="M21.8064 29.407H21.8304"
|
|
40
|
+
stroke="#C6CCCC"
|
|
41
|
+
stroke-width="5.87546"
|
|
42
|
+
stroke-linecap="round"
|
|
43
|
+
stroke-linejoin="round"
|
|
44
|
+
/>
|
|
45
|
+
</g>
|
|
46
|
+
</g>
|
|
47
|
+
</g>
|
|
48
|
+
</svg>
|
|
49
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const SendIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "24"}
|
|
4
|
+
height={height || "24"}
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M9.50733 4.22867L18.0673 8.50867C21.9073 10.4287 21.9073 13.5687 18.0673 15.4887L9.50733 19.7687C3.74733 22.6487 1.39733 20.2887 4.27733 14.5387L5.14733 12.8087C5.36733 12.3687 5.36733 11.6387 5.14733 11.1987L4.27733 9.45867C1.39733 3.70867 3.75733 1.34867 9.50733 4.22867Z"
|
|
11
|
+
stroke="white"
|
|
12
|
+
stroke-width="1.5"
|
|
13
|
+
stroke-linecap="round"
|
|
14
|
+
stroke-linejoin="round"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
d="M5.4375 12H10.8375"
|
|
18
|
+
stroke="white"
|
|
19
|
+
stroke-width="1.5"
|
|
20
|
+
stroke-linecap="round"
|
|
21
|
+
stroke-linejoin="round"
|
|
22
|
+
/>
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const SendFailIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "13"}
|
|
4
|
+
height={height || "13"}
|
|
5
|
+
viewBox="0 0 13 13"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<rect width="13" height="13" rx="6.5" fill="#F95454" />
|
|
10
|
+
<path
|
|
11
|
+
d="M9.56021 3.44088C8.77479 2.65547 7.69687 2.16797 6.49979 2.16797C4.10562 2.16797 2.17188 4.10713 2.17188 6.5013C2.17188 8.89547 4.10562 10.8346 6.49979 10.8346C8.52021 10.8346 10.2048 9.45338 10.6869 7.58463H9.56021C9.11604 8.84672 7.91354 9.7513 6.49979 9.7513C4.70687 9.7513 3.24979 8.29422 3.24979 6.5013C3.24979 4.70838 4.70687 3.2513 6.49979 3.2513C7.39896 3.2513 8.20062 3.62505 8.78562 4.21547L7.04146 5.95963H10.8331V2.16797L9.56021 3.44088Z"
|
|
12
|
+
fill="white"
|
|
13
|
+
/>
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const SendingStatusIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "13"}
|
|
4
|
+
height={height || "13"}
|
|
5
|
+
viewBox="0 0 13 13"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<rect width="13" height="13" rx="6.5" fill="#FEBF10" />
|
|
10
|
+
<g clip-path="url(#clip0_14342_79701)">
|
|
11
|
+
<path
|
|
12
|
+
d="M7.90625 1.46094H5.15625V2.3776H7.90625V1.46094ZM6.07292 7.41927H6.98958V4.66927H6.07292V7.41927ZM9.75333 4.3851L10.4042 3.73427C10.2071 3.50052 9.99167 3.28052 9.75792 3.08802L9.10708 3.73885C8.39667 3.17052 7.50292 2.83135 6.53125 2.83135C4.25333 2.83135 2.40625 4.67844 2.40625 6.95635C2.40625 9.23427 4.24875 11.0814 6.53125 11.0814C8.81375 11.0814 10.6562 9.23427 10.6562 6.95635C10.6562 5.98927 10.3171 5.09552 9.75333 4.3851ZM6.53125 10.1693C4.7575 10.1693 3.32292 8.73469 3.32292 6.96094C3.32292 5.18719 4.7575 3.7526 6.53125 3.7526C8.305 3.7526 9.73958 5.18719 9.73958 6.96094C9.73958 8.73469 8.305 10.1693 6.53125 10.1693Z"
|
|
13
|
+
fill="white"
|
|
14
|
+
/>
|
|
15
|
+
</g>
|
|
16
|
+
<defs>
|
|
17
|
+
<clipPath id="clip0_14342_79701">
|
|
18
|
+
<rect width="11" height="11" fill="white" transform="translate(1 1)" />
|
|
19
|
+
</clipPath>
|
|
20
|
+
</defs>
|
|
21
|
+
</svg>
|
|
22
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const WarningIcon = ({ width, height, fill }) => (
|
|
2
|
+
<svg
|
|
3
|
+
width={width || "31"}
|
|
4
|
+
height={height || "32"}
|
|
5
|
+
viewBox="0 0 31 32"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M27.4684 27.6238H3.52992C3.06845 27.6238 2.64205 27.3776 2.41132 26.978C2.1806 26.5783 2.1806 26.086 2.41133 25.6863L14.3799 5.01966C14.6108 4.62068 15.0369 4.375 15.4979 4.375C15.9588 4.375 16.3849 4.62068 16.6158 5.01966L28.5844 25.6863C28.815 26.0858 28.8151 26.5779 28.5847 26.9774C28.3543 27.377 27.9283 27.6234 27.4671 27.6238H27.4684ZM14.2081 21.1655V23.7488H15.4132H15.4972H15.5812H16.7889V21.1655H14.2081ZM14.2081 12.1238V18.5822H16.7915V12.1238H14.2081Z"
|
|
11
|
+
fill="#323232"
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createContext, useState } from "react";
|
|
2
|
+
const MessagesContext = createContext();
|
|
3
|
+
|
|
4
|
+
export const useMessagesContext = () => {
|
|
5
|
+
const [roomID, setRoomID] = useState("");
|
|
6
|
+
const [userID, setUserID] = useState("");
|
|
7
|
+
const [userChatList, setUserChatList] = useState([]);
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
roomID,
|
|
11
|
+
setRoomID,
|
|
12
|
+
userID,
|
|
13
|
+
setUserID,
|
|
14
|
+
userChatList,
|
|
15
|
+
setUserChatList,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default MessagesContext;
|