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
@@ -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;