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.
- package/README.md +74 -0
- package/babel.config.js +6 -0
- package/dist/index.js +684 -0
- package/package.json +59 -0
- package/public/Logo-192x192.png +0 -0
- package/public/Logo-512x512.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/fonts/BenjaminVictoria.ttf +0 -0
- package/public/icons/arrow_logo.svg +9 -0
- package/public/icons/assets/ic_placeholder_banner.svg +1 -0
- package/public/icons/attach-file.svg +9 -0
- package/public/icons/audio_pause.svg +1 -0
- package/public/icons/audio_play.svg +6 -0
- package/public/icons/back.svg +3 -0
- package/public/icons/bell.svg +1 -0
- package/public/icons/block.svg +1 -0
- package/public/icons/bottom-arrow.svg +1 -0
- package/public/icons/camera-switch.svg +12 -0
- package/public/icons/camera.svg +4 -0
- package/public/icons/cancel.svg +1 -0
- package/public/icons/chat empty placeholder.svg +58 -0
- package/public/icons/chat_audio_pause.png +0 -0
- package/public/icons/chat_audio_play.png +0 -0
- package/public/icons/close.svg +5 -0
- package/public/icons/crossCarousel.svg +3 -0
- package/public/icons/delete.svg +3 -0
- package/public/icons/disappear.svg +24 -0
- package/public/icons/document.png +0 -0
- package/public/icons/document.svg +1 -0
- package/public/icons/downloadCarousel.svg +6 -0
- package/public/icons/edit-pencil.svg +6 -0
- package/public/icons/emoji.svg +8 -0
- package/public/icons/emojiCarousel.svg +3 -0
- package/public/icons/filter.svg +1 -0
- package/public/icons/forwardCarousel.svg +3 -0
- package/public/icons/gallery.svg +1 -0
- package/public/icons/goToMessageCarousel.svg +3 -0
- package/public/icons/ic_uil_arrow-left.svg +1 -0
- package/public/icons/ic_uil_eye-slash.svg +1 -0
- package/public/icons/ic_uil_eye.svg +1 -0
- package/public/icons/leftArrowCarousel.svg +6 -0
- package/public/icons/light-mode.svg +14 -0
- package/public/icons/lock.svg +1 -0
- package/public/icons/login_background.png +0 -0
- package/public/icons/menu .svg +5 -0
- package/public/icons/menuCarousel.svg +5 -0
- package/public/icons/message.svg +3 -0
- package/public/icons/placeholder.svg +958 -0
- package/public/icons/poll.svg +1 -0
- package/public/icons/retake.png +0 -0
- package/public/icons/right-arrow.svg +3 -0
- package/public/icons/right.svg +3 -0
- package/public/icons/round-star.svg +1 -0
- package/public/icons/search.svg +3 -0
- package/public/icons/send.svg +10 -0
- package/public/icons/starCarousel.svg +3 -0
- package/public/icons/status.svg +1 -0
- package/public/icons/sticker.svg +1 -0
- package/public/icons/thumb-down.svg +1 -0
- package/public/icons/user.svg +1 -0
- package/public/icons/users.svg +1 -0
- package/public/icons/voice.png +0 -0
- package/public/index.html +38 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/offline.html +12 -0
- package/public/robots.txt +3 -0
- package/public/service-worker.js +81 -0
- package/src/App.js +15 -0
- package/src/App.test.js +8 -0
- package/src/Authpage.js +16 -0
- package/src/ChatContext.js +172 -0
- package/src/Data/index.js +110 -0
- package/src/assets/icons.js +49 -0
- package/src/assets/images/WhatsApp.html +258 -0
- package/src/assets/images/WhatsApp_files/301446776_522918349234681_1974693392291574064_n.jpg +0 -0
- package/src/assets/images/WhatsApp_files/app-bf223f825866ee433b07.css +242 -0
- package/src/assets/images/WhatsApp_files/app.77ee8aa7a4c593101105.js +77 -0
- package/src/assets/images/WhatsApp_files/lazy_loaded_high_priority_components.85a06e74a0a4ade1640b.css +16 -0
- package/src/assets/images/WhatsApp_files/lazy_loaded_low_priority_components.8621270bc215a9298a97.css +47 -0
- package/src/assets/images/WhatsApp_files/libsignal-protocol-ee5b8ba.min.js +21 -0
- package/src/assets/images/WhatsApp_files/main.48b845d68e066fb27a75.css +161 -0
- package/src/assets/images/WhatsApp_files/runtime.e6018f3c1e255e8f4dc7.js +2 -0
- package/src/assets/images/WhatsApp_files/stylex-d50abd61e6cf7eab2afd855adccf14e5.css +2841 -0
- package/src/assets/images/WhatsApp_files/vendor1_app.58a51d93a250f83ab555.js +79 -0
- package/src/assets/images/bg.jpeg +0 -0
- package/src/assets/images/drkbg.jpg +0 -0
- package/src/assets/images/notFound.jpeg +0 -0
- package/src/assets/images/watsapp.jpg +0 -0
- package/src/assets/images/watsappbg.png +0 -0
- package/src/assets/images/wb.jpg +0 -0
- package/src/assets/images/whatsapp.jpeg +0 -0
- package/src/components/ChatBox/AudioBubble.js +162 -0
- package/src/components/ChatBox/ChatBubble.js +232 -0
- package/src/components/ChatBox/DocumentBubble.js +87 -0
- package/src/components/ChatBox/MessagesBox.js +533 -0
- package/src/components/CustomModal.js +60 -0
- package/src/components/Icon.js +10 -0
- package/src/components/ImageComponent.js +24 -0
- package/src/components/MediaDocs.js +155 -0
- package/src/components/MediaDocumentContainer.js +55 -0
- package/src/components/MessageInfoDropdown.js +124 -0
- package/src/components/Modal/AllowMicPermissionModal.js +63 -0
- package/src/components/Modal/BlockUnblockChatModal.js +78 -0
- package/src/components/Modal/CameraPermissionBlockedModal.js +61 -0
- package/src/components/Modal/CameraPermissionRequestModal.js +60 -0
- package/src/components/Modal/ClearChatModal.js +78 -0
- package/src/components/Modal/DeleteChatModal.js +79 -0
- package/src/components/Modal/MicPermissionDisableModal.js +63 -0
- package/src/components/Modal/Modal.js +103 -0
- package/src/components/Modal/ModalDialog.js +103 -0
- package/src/components/Modal/ProfilePictureUploadPreview.js +160 -0
- package/src/components/OutsideAlerter/OutsideAlerter.js +38 -0
- package/src/components/ProfilePicture/ProfilePicture.js +127 -0
- package/src/components/Registration/Login.js +265 -0
- package/src/components/Registration/SignUp.js +322 -0
- package/src/components/SnackBar.js +42 -0
- package/src/components/common/Modal/useDetectOutsideClick.js +23 -0
- package/src/components/common/styled/PageWrapper.js +25 -0
- package/src/components/formcontrol/CustomButton.js +38 -0
- package/src/components/formcontrol/InputText.js +60 -0
- package/src/global-styles.js +42 -0
- package/src/hooks/useDeviceType.js +28 -0
- package/src/hooks/useThrottle.js +29 -0
- package/src/index.css +225 -0
- package/src/index.js +23 -0
- package/src/lib/constant.js +21 -0
- package/src/lib/functionality.js +13 -0
- package/src/lib/helpers.js +320 -0
- package/src/lib/mockData/index.js +76 -0
- package/src/lib/session/index.js +31 -0
- package/src/lib/validation.js +4 -0
- package/src/logo.svg +1 -0
- package/src/pages/WhatsappMainBox/index.js +574 -0
- package/src/reportWebVitals.js +13 -0
- package/src/services/deliveryStatus.js +27 -0
- package/src/setupTests.js +5 -0
- package/src/utils/chatSdk.js +14 -0
- package/src/utils/global.js +57 -0
- package/src/utils/media.js +79 -0
- package/src/view/component/BlockedContactSlide.js +134 -0
- package/src/view/component/Carousle/UpperMenuBar.js +106 -0
- package/src/view/component/Carousle/index.js +204 -0
- package/src/view/component/Chatbox.js/AudioRecorder.js +311 -0
- package/src/view/component/Chatbox.js/ChatBubbleReply.js +27 -0
- package/src/view/component/Chatbox.js/TakePhoto.js +363 -0
- package/src/view/component/Chatbox.js/index.js +856 -0
- package/src/view/component/Chatbox.js/styles.css +231 -0
- package/src/view/component/Contact/index.js +56 -0
- package/src/view/component/Contact/styles.css +208 -0
- package/src/view/component/ContactInfo/index.js +543 -0
- package/src/view/component/ContactInfo/styles.css +289 -0
- package/src/view/component/Context/index.js +3 -0
- package/src/view/component/DialogBox.js +15 -0
- package/src/view/component/ImageCropper/ImageCropper.js +128 -0
- package/src/view/component/Loader/Loader.js +52 -0
- package/src/view/component/Loader/UserPagingLoader.js +62 -0
- package/src/view/component/MainChatBox/index.js +819 -0
- package/src/view/component/MainChatBox/styles.css +124 -0
- package/src/view/component/Menu/index.js +261 -0
- package/src/view/component/Menu/styles.css +68 -0
- package/src/view/component/Profile/ProfileInfoContainer.js +112 -0
- package/src/view/component/Profile/ProfileUpdate.js +178 -0
- package/src/view/component/Profile/TakeProfilePhoto.js +391 -0
- package/src/view/component/Profile/index.js +550 -0
- package/src/view/component/Profile/styles.css +370 -0
- package/src/view/component/ReplyChatMessage/ReplyChatMessage.js +48 -0
- package/src/view/component/SeachBar/index.js +106 -0
- package/src/view/component/SeachBar/styles.css +53 -0
- package/src/view/component/Siderbar/index.js +512 -0
- package/src/view/component/Siderbar/styles.css +138 -0
- package/src/view/component/Toaster/Toaster.js +117 -0
- package/src/view/component/UserDetailsCard/UserDetailCard.js +337 -0
- package/src/view/component/deleteMessageMoal.js +80 -0
- package/src/view/component/emoji/index.js +22 -0
- package/src/view/component/emoji/sstyles.css +0 -0
- package/src/view/component/forwardData/index.js +327 -0
- package/src/view/component/forwardData/styles.css +112 -0
- package/src/view/component/forwardPopup/index.js +55 -0
- package/src/view/component/forwardPopup/styles.css +144 -0
- package/src/view/component/mediaList/index.js +92 -0
- package/src/view/component/menuDialog/index.js +71 -0
- package/src/view/component/menuDialog/styles.css +24 -0
- package/src/view/component/pagination/pagination.js +52 -0
- package/src/view/component/pagination/paginationForMsg.js +43 -0
- package/src/view/component/sidebarChat/index.js +321 -0
- package/src/view/component/sidebarChat/styles.css +109 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { css } from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const mobilesmall = (inner) => css`
|
|
4
|
+
@media (max-width: 20rem) {
|
|
5
|
+
${inner};
|
|
6
|
+
}
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
export const mobilemedium = (inner) => css`
|
|
10
|
+
@media (max-width: 30rem) {
|
|
11
|
+
${inner};
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export const gridLayoutXS = (inner) => css`
|
|
16
|
+
@media (max-width: 767px) {
|
|
17
|
+
${inner};
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const mobile = (inner) => css`
|
|
22
|
+
@media (max-width: 48rem) {
|
|
23
|
+
${inner};
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export const tablet = (inner) => css`
|
|
28
|
+
@media (max-width: 64rem) {
|
|
29
|
+
${inner};
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export const laptopLarge = (inner) => css`
|
|
34
|
+
@media (min-width: 1092px) {
|
|
35
|
+
${inner};
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export const tabletOnly = (inner) => css`
|
|
40
|
+
@media (min-width: 48rem) and (max-width: 64rem) {
|
|
41
|
+
${inner};
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export const desktopsmall = (inner) => css`
|
|
46
|
+
@media (max-width: 89rem) {
|
|
47
|
+
${inner};
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
export const gridLayoutMD = (inner) => css`
|
|
52
|
+
@media (max-width: 1199px) {
|
|
53
|
+
${inner};
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
export const gridLayoutSM = (inner) => css`
|
|
58
|
+
@media (max-width: 1023px) {
|
|
59
|
+
${inner};
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
export const gridLayoutSMPlus = (inner) => css`
|
|
64
|
+
@media (min-width: 1024px) {
|
|
65
|
+
${inner};
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export const wrapperLimit = (inner) => css`
|
|
70
|
+
@media (min-width: 1816px) {
|
|
71
|
+
${inner};
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
export const ipadSM = (inner) => css`
|
|
76
|
+
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) {
|
|
77
|
+
${inner};
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import CustomModal from "../../components/CustomModal";
|
|
5
|
+
import ImageComponent from "../../components/ImageComponent";
|
|
6
|
+
import ModalDialog from "../../components/Modal/ModalDialog";
|
|
7
|
+
import { USER_UNBLOCKED } from "../../lib/constant";
|
|
8
|
+
import { getUserConversationDetails, postUnblockUser } from "../../lib/helpers";
|
|
9
|
+
import client from "../../utils/chatSdk";
|
|
10
|
+
import { CLOSE_ICON } from "../../utils/global";
|
|
11
|
+
|
|
12
|
+
const BlockContactList = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
height: 4.4rem;
|
|
16
|
+
position: relative;
|
|
17
|
+
width: 100%;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
&:hover {
|
|
20
|
+
background-color: var(--chat_hover);
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const BlockedUser = styled.div`
|
|
25
|
+
padding-right: 30px;
|
|
26
|
+
height: 72px;
|
|
27
|
+
border-bottom: 1px solid var(--border_color);
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-basis: auto;
|
|
30
|
+
// flex-direction: column;
|
|
31
|
+
flex-grow: 1;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
align-items: center;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
color: var(--black);
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const BlockedContactImage = styled.div`
|
|
39
|
+
padding: 0px 15px 0px 13px;
|
|
40
|
+
|
|
41
|
+
.user-image {
|
|
42
|
+
height: 49px;
|
|
43
|
+
width: 49px;
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const UnBlockedData = styled.div`
|
|
49
|
+
display: flex;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 50%;
|
|
53
|
+
height: 100%;
|
|
54
|
+
width: 100%;
|
|
55
|
+
color:var(--black);
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
function BlockedContactSlide(props) {
|
|
60
|
+
const { theme,conversationId,setUserConversationDetail, setToastStatus} = props;
|
|
61
|
+
const [blockedList, setBlockedList] = useState([]);
|
|
62
|
+
const [unBlockUser , setUnBlockUser] = useState({unblock:false, data:{}});
|
|
63
|
+
|
|
64
|
+
const blockApi = ()=>{
|
|
65
|
+
client.user.getUserBlock().then((res) => {
|
|
66
|
+
setBlockedList(res?.users);
|
|
67
|
+
}).catch((error)=>{
|
|
68
|
+
console.log("error", error);
|
|
69
|
+
setBlockedList([]);
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
const UnBlockHandler = (data)=>{
|
|
73
|
+
setUnBlockUser({unblock:true, data:data});
|
|
74
|
+
}
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
blockApi();
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
79
|
+
const handleOnCloseModal = ()=>{
|
|
80
|
+
setUnBlockUser({...unBlockUser,unblock:false, data:{}});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const handleUnblockUser = async ()=>{
|
|
84
|
+
const res = await postUnblockUser(unBlockUser?.data?.userId );
|
|
85
|
+
setToastStatus({open: true, variant:"success", message: res.msg});
|
|
86
|
+
if(res.msg===USER_UNBLOCKED){
|
|
87
|
+
setUnBlockUser({...unBlockUser,unblock:false, data:{}});
|
|
88
|
+
blockApi();
|
|
89
|
+
const response = await getUserConversationDetails(conversationId);
|
|
90
|
+
setUserConversationDetail(response);
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
<div style={{ marginTop: "109px" }}>
|
|
98
|
+
{blockedList && blockedList.length >0 ? (
|
|
99
|
+
blockedList?.map((data,index) => {
|
|
100
|
+
return (
|
|
101
|
+
<BlockContactList key={index}>
|
|
102
|
+
<BlockedContactImage>
|
|
103
|
+
<ImageComponent
|
|
104
|
+
src={data?.userProfileImageUrl}
|
|
105
|
+
className="user-image"
|
|
106
|
+
alt={data?.userName}
|
|
107
|
+
/>
|
|
108
|
+
</BlockedContactImage>
|
|
109
|
+
|
|
110
|
+
<BlockedUser>
|
|
111
|
+
{data?.userName}
|
|
112
|
+
<ImageComponent
|
|
113
|
+
src={CLOSE_ICON}
|
|
114
|
+
alt={data?.userName}
|
|
115
|
+
style={{ height: "12px", width: "12px" }}
|
|
116
|
+
className={theme ? "darkicons" : "lighticons"} onClick={()=>UnBlockHandler(data)}
|
|
117
|
+
/>
|
|
118
|
+
</BlockedUser>
|
|
119
|
+
</BlockContactList>
|
|
120
|
+
);
|
|
121
|
+
})
|
|
122
|
+
) : (
|
|
123
|
+
<UnBlockedData className="">No Blocked Contacts Found</UnBlockedData>
|
|
124
|
+
)}
|
|
125
|
+
|
|
126
|
+
</div>
|
|
127
|
+
<CustomModal open={unBlockUser?.unblock}>
|
|
128
|
+
<ModalDialog userData={unBlockUser?.data} handleOnCloseModal={handleOnCloseModal} handleUnblockUser={handleUnblockUser} />
|
|
129
|
+
</CustomModal>
|
|
130
|
+
</>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export default BlockedContactSlide;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CROSS_CAROUSEL, DOWNLOAD_CAROUSEL, EMOJI_FACE_CAROUSEL, FORWARD_CAROUSEL, GO_TO_MESSAGE_CAROUSEL, MENU_CAROUSEL, STAR_CAROUSEL } from "../../../utils/global";
|
|
3
|
+
import ImageComponent from "../../../components/ImageComponent";
|
|
4
|
+
import { getTimeWithMeridian } from "../../../lib/helpers";
|
|
5
|
+
import { saveAs } from 'file-saver';
|
|
6
|
+
|
|
7
|
+
const imagesData = [
|
|
8
|
+
// {
|
|
9
|
+
// index: 0,
|
|
10
|
+
// name: 'GO_TO_MESSAGE_CAROUSEL',
|
|
11
|
+
// src: GO_TO_MESSAGE_CAROUSEL
|
|
12
|
+
// },
|
|
13
|
+
// {
|
|
14
|
+
// index: 1,
|
|
15
|
+
// name: 'STAR_CAROUSEL',
|
|
16
|
+
// src: STAR_CAROUSEL
|
|
17
|
+
// },
|
|
18
|
+
// {
|
|
19
|
+
// index: 2,
|
|
20
|
+
// name: 'EMOJI_FACE_CAROUSEL',
|
|
21
|
+
// src: EMOJI_FACE_CAROUSEL
|
|
22
|
+
// },
|
|
23
|
+
// {
|
|
24
|
+
// index: 3,
|
|
25
|
+
// name: 'FORWARD_CAROUSEL',
|
|
26
|
+
// src: FORWARD_CAROUSEL
|
|
27
|
+
// },
|
|
28
|
+
{
|
|
29
|
+
index: 4,
|
|
30
|
+
name: 'DOWNLOAD_CAROUSEL',
|
|
31
|
+
src: DOWNLOAD_CAROUSEL
|
|
32
|
+
},
|
|
33
|
+
// {
|
|
34
|
+
// index: 5,
|
|
35
|
+
// name: 'MENU_CAROUSEL',
|
|
36
|
+
// src: MENU_CAROUSEL
|
|
37
|
+
// },
|
|
38
|
+
{
|
|
39
|
+
index: 6,
|
|
40
|
+
name: 'CROSS_CAROUSEL',
|
|
41
|
+
src: CROSS_CAROUSEL
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
const UpperMenuBar = (props) => {
|
|
46
|
+
const { scrolledPositionRef, chatMedia } = props;
|
|
47
|
+
const index = scrolledPositionRef.current;
|
|
48
|
+
const dataToShow = chatMedia[index];
|
|
49
|
+
const UpperMenuBarClicked = (data) => {
|
|
50
|
+
switch (data.index) {
|
|
51
|
+
case 4:
|
|
52
|
+
// {
|
|
53
|
+
// const mediaDownload = dataToShow?.attachments?.[0]; // Replace with your media URL
|
|
54
|
+
// // window.location.href = fileUrl;
|
|
55
|
+
// const content = mediaDownload.mediaUrl; // Replace with your media content
|
|
56
|
+
// const file = new FileReader(content);
|
|
57
|
+
// const blob = new Blob([content], { type: 'text/plain' });
|
|
58
|
+
// const fileUrl = URL.createObjectURL(blob);
|
|
59
|
+
|
|
60
|
+
// const link = document.createElement('a');
|
|
61
|
+
// link.href = fileUrl;
|
|
62
|
+
// link.download = mediaDownload.name; // Replace with your desired file name
|
|
63
|
+
// document.body.appendChild(link);
|
|
64
|
+
// link.click();
|
|
65
|
+
// document.body.removeChild(link);
|
|
66
|
+
|
|
67
|
+
// URL.revokeObjectURL(fileUrl);
|
|
68
|
+
// }
|
|
69
|
+
saveAs(chatMedia[index]?.attachments?.[0]?.mediaUrl, chatMedia[index]?.body);
|
|
70
|
+
break;
|
|
71
|
+
case 6:
|
|
72
|
+
document.getElementsByTagName('dialog')[0].close();
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
console.log(data.index);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return <div className="d-flex justify-content-between">
|
|
80
|
+
<div className="d-flex">
|
|
81
|
+
<ImageComponent src={dataToShow?.senderProfileImageUrl} height={40} width={40} style={{ borderRadius: '50%' }} />
|
|
82
|
+
<div className='chat_headerInfo'>
|
|
83
|
+
<p>
|
|
84
|
+
{dataToShow?.senderName}
|
|
85
|
+
</p>
|
|
86
|
+
<p>
|
|
87
|
+
{getTimeWithMeridian(new Date(dataToShow?.sentAt))}
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<div className="pt-2">
|
|
92
|
+
{
|
|
93
|
+
imagesData.map((image, index) => (
|
|
94
|
+
<span className="m-3 pointer" onClick={() => UpperMenuBarClicked(image)}>
|
|
95
|
+
<ImageComponent
|
|
96
|
+
src={image.src}
|
|
97
|
+
alt={image.name}
|
|
98
|
+
/>
|
|
99
|
+
</span>
|
|
100
|
+
))
|
|
101
|
+
}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default UpperMenuBar;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { LEFT_ARROW_CAROUSEL } from '../../../utils/global';
|
|
3
|
+
|
|
4
|
+
const SliderCarousal = (props) => {
|
|
5
|
+
const {
|
|
6
|
+
assets, // mandatory
|
|
7
|
+
selectedMediaIndex,
|
|
8
|
+
scrolledPositionRef
|
|
9
|
+
} = props;
|
|
10
|
+
|
|
11
|
+
const ImageContainerRef = React.useRef(null);
|
|
12
|
+
const thumbnailSlider = React.useRef(null);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const ImageContainer = ImageContainerRef.current;
|
|
16
|
+
if (ImageContainer) ImageContainer.style.transform = `translateX(-${(selectedMediaIndex) * 100}%)`;
|
|
17
|
+
scrolledPositionRef.current = selectedMediaIndex;
|
|
18
|
+
handleSelectedThumbnail(scrolledPositionRef.current);
|
|
19
|
+
}, [selectedMediaIndex]);
|
|
20
|
+
|
|
21
|
+
const handleOnClickThumbnail = (index) => {
|
|
22
|
+
const ImageContainer = ImageContainerRef.current;
|
|
23
|
+
if (ImageContainer) ImageContainer.style.transform = `translateX(-${(index) * 100}%)`;
|
|
24
|
+
scrolledPositionRef.current = index;
|
|
25
|
+
handleSelectedThumbnail(scrolledPositionRef.current);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const prevSlide = () => {
|
|
29
|
+
const ImageContainer = ImageContainerRef.current;
|
|
30
|
+
if (!assets.length) return;
|
|
31
|
+
if (!scrolledPositionRef.current) {
|
|
32
|
+
ImageContainer.style.transform = `translateX(-${(assets.length - 1) * 100}%)`;
|
|
33
|
+
scrolledPositionRef.current = assets.length - 1;
|
|
34
|
+
handleSelectedThumbnail(assets.length - 1);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (ImageContainer) ImageContainer.style.transform = `translateX(-${(scrolledPositionRef.current - 1) * 100}%)`;
|
|
38
|
+
scrolledPositionRef.current -= 1;
|
|
39
|
+
handleSelectedThumbnail(scrolledPositionRef.current);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const nextSlide = () => {
|
|
43
|
+
const ImageContainer = ImageContainerRef.current;
|
|
44
|
+
if (!assets.length) return;
|
|
45
|
+
if ((scrolledPositionRef.current + 1) >= assets?.length) {
|
|
46
|
+
ImageContainer.style.transform = `translateX(0%)`;
|
|
47
|
+
scrolledPositionRef.current = 0;
|
|
48
|
+
handleSelectedThumbnail(0);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (ImageContainer) ImageContainer.style.transform = `translateX(-${(scrolledPositionRef.current + 1) * 100}%)`;
|
|
52
|
+
scrolledPositionRef.current += 1;
|
|
53
|
+
handleSelectedThumbnail(scrolledPositionRef.current);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const handleSelectedThumbnail = (selectedIndex) => {
|
|
57
|
+
const thumbnails = document.querySelectorAll('div.thumbnail');
|
|
58
|
+
|
|
59
|
+
Array.from(thumbnails).forEach((ele, idx) => {
|
|
60
|
+
thumbnails[idx]?.classList.remove('activeThumbnail');
|
|
61
|
+
})
|
|
62
|
+
thumbnails[selectedIndex]?.classList.add('activeThumbnail');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<>
|
|
67
|
+
<div className='outerContainer position-relative col-12 p-0'>
|
|
68
|
+
<div>
|
|
69
|
+
<button className={`left_navigation_arrow absolute ${scrolledPositionRef.current === 0 && 'disable_UI'}`} onClick={() => prevSlide()}> <img src={LEFT_ARROW_CAROUSEL} /> </button>
|
|
70
|
+
<button className={`right_navigation_arrow absolute ${scrolledPositionRef.current === assets.length - 1 && 'disable_UI'}`} onClick={() => nextSlide()}> <img src={LEFT_ARROW_CAROUSEL} /> </button>
|
|
71
|
+
</div>
|
|
72
|
+
<div className='mainSlider position-relative d-flex w-100 mb-5' ref={ImageContainerRef} >
|
|
73
|
+
{assets?.map((imgData, idx) => (
|
|
74
|
+
<div className='currImg position-relative h-auto' key={idx}>
|
|
75
|
+
{
|
|
76
|
+
imgData?.extension === 'mp4'
|
|
77
|
+
? <video controls style={{ objectFit: 'contain', width: '100%', height: '100%' }}>
|
|
78
|
+
<source src={imgData.mediaUrl} type="video/mp4" />
|
|
79
|
+
</video>
|
|
80
|
+
: <img src={imgData.mediaUrl} style={{ objectFit: 'contain', width: '100%', height: '100%' }} />
|
|
81
|
+
}
|
|
82
|
+
</div>
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
<div className='thumbnailSlider' ref={thumbnailSlider}>
|
|
86
|
+
{assets?.map((data, idx) => (
|
|
87
|
+
<div onClick={() => handleOnClickThumbnail(idx)} key={data.id} className={`${idx === 0 ? "activeThumbnail" : ""} thumbnail position-relative`}>
|
|
88
|
+
{
|
|
89
|
+
data?.extension === 'mp4'
|
|
90
|
+
? <video controls style={{ objectFit: 'contain', width: '100%', height: '100%' }}>
|
|
91
|
+
<source src={data.mediaUrl} type="video/mp4" />
|
|
92
|
+
</video>
|
|
93
|
+
: <img alt={data?.title} src={data.mediaUrl} width={100} height={70} style={{ objectFit: 'contain' }} />
|
|
94
|
+
}
|
|
95
|
+
</div>
|
|
96
|
+
))}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
<style jsx>
|
|
100
|
+
{`
|
|
101
|
+
.outerContainer {
|
|
102
|
+
margin: auto;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
transition: visibility .3s,opacity .3s cubic-bezier(.1,.82,.25,1);
|
|
107
|
+
width: 100%;
|
|
108
|
+
overflow-x: hidden;
|
|
109
|
+
}
|
|
110
|
+
.mainSlider {
|
|
111
|
+
transition: all 450ms ease-in-out 0ms;
|
|
112
|
+
}
|
|
113
|
+
.currImg {
|
|
114
|
+
min-width: 100%;
|
|
115
|
+
height: 100%;
|
|
116
|
+
min-height: 485px;
|
|
117
|
+
max-height: 485px;
|
|
118
|
+
object-fit: cover;
|
|
119
|
+
object-position: center;
|
|
120
|
+
border-radius: 12px;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
}
|
|
124
|
+
:global(.currImg img) {
|
|
125
|
+
background: transparent;
|
|
126
|
+
}
|
|
127
|
+
.thumbnailSlider {
|
|
128
|
+
display: flex;
|
|
129
|
+
width: 100%;
|
|
130
|
+
cursor: pointer;
|
|
131
|
+
transition: all 450ms ease-in-out 0ms;
|
|
132
|
+
overflow-x: auto;
|
|
133
|
+
}
|
|
134
|
+
.thumbnail {
|
|
135
|
+
box-sizing: border-box;
|
|
136
|
+
margin-right: 6px;
|
|
137
|
+
max-height: 70px;
|
|
138
|
+
min-height: 70px;
|
|
139
|
+
min-width: 100px;
|
|
140
|
+
max-width: 100px;
|
|
141
|
+
border-radius: 6px;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
}
|
|
144
|
+
.activeThumbnail {
|
|
145
|
+
border: 2px solid #fff;
|
|
146
|
+
border-radius: 6px;
|
|
147
|
+
padding: 2px;
|
|
148
|
+
}
|
|
149
|
+
::-webkit-scrollbar {
|
|
150
|
+
height: 0px;
|
|
151
|
+
}
|
|
152
|
+
.left_navigation_arrow, .right_navigation_arrow {
|
|
153
|
+
z-index: 1;
|
|
154
|
+
background: transparent;
|
|
155
|
+
border-radius: 50%;
|
|
156
|
+
top: 45%;
|
|
157
|
+
transform: translateY(-50%);
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
outline: none;
|
|
160
|
+
border: none;
|
|
161
|
+
}
|
|
162
|
+
.left_navigation_arrow:active img {
|
|
163
|
+
filter: contrast(10%);
|
|
164
|
+
}
|
|
165
|
+
.right_navigation_arrow:active img{
|
|
166
|
+
filter: contrast(10%);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.left_navigation_arrow {
|
|
170
|
+
left: 15px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.right_navigation_arrow {
|
|
174
|
+
transform: rotate(180deg);
|
|
175
|
+
right: 15px;
|
|
176
|
+
}
|
|
177
|
+
@media(max-width: 576px) {
|
|
178
|
+
.currImg {
|
|
179
|
+
min-height: 260px;
|
|
180
|
+
max-height: 260px;
|
|
181
|
+
}
|
|
182
|
+
.thumbnail {
|
|
183
|
+
max-height: 62.8px;
|
|
184
|
+
min-height: 62.8px;
|
|
185
|
+
min-width: 62.8px;
|
|
186
|
+
max-width: 62.8px;
|
|
187
|
+
}
|
|
188
|
+
.left_navigation_arrow > img, .right_navigation_arrow > img {
|
|
189
|
+
width: 40px;
|
|
190
|
+
}
|
|
191
|
+
.left_navigation_arrow {
|
|
192
|
+
top: 35%;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.right_navigation_arrow {
|
|
196
|
+
top: 29%;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
`}
|
|
200
|
+
</style>
|
|
201
|
+
</>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
export default SliderCarousal;
|