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 React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { mobile } from '../../utils/media';
|
|
4
|
+
|
|
5
|
+
const ModalContainer = styled.div`
|
|
6
|
+
background-color: var(--modal_color);
|
|
7
|
+
color: var(--black);
|
|
8
|
+
position: absolute;
|
|
9
|
+
width: 32rem;
|
|
10
|
+
top: 50%;
|
|
11
|
+
left: 50%;
|
|
12
|
+
box-shadow: 0 4px 8px 0 rgb(0 0 0 / 20%), 0 6px 20px 0 rgb(0 0 0 / 19%);
|
|
13
|
+
-webkit-transform: translate(-50%,-50%);
|
|
14
|
+
-ms-transform: translate(-50%,-50%);
|
|
15
|
+
transform: translate(-50%,-50%);
|
|
16
|
+
padding: 20px 24px 6px 22px;
|
|
17
|
+
${mobile(css`
|
|
18
|
+
max-width: 320px;
|
|
19
|
+
`)}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const ModalTitle = styled.h5`
|
|
23
|
+
margin-top: 20px;
|
|
24
|
+
${mobile(css`
|
|
25
|
+
font-size: 18px;
|
|
26
|
+
`)}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const ModalDescription = styled.p`
|
|
30
|
+
font-size: 18px;
|
|
31
|
+
${mobile(css`
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
`)}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const ButtonAction = styled.div`
|
|
38
|
+
display:flex;
|
|
39
|
+
justify-content: flex-end;
|
|
40
|
+
margin:3rem 0 20px;
|
|
41
|
+
|
|
42
|
+
${mobile(css`
|
|
43
|
+
margin:1.5rem 0 20px;
|
|
44
|
+
`)}
|
|
45
|
+
|
|
46
|
+
.cancleBtn{
|
|
47
|
+
background:var(--white);
|
|
48
|
+
color:var(--button-primary-background);
|
|
49
|
+
border:1px solid var(--border_color);}
|
|
50
|
+
|
|
51
|
+
.logoutBtn{
|
|
52
|
+
background-color:var(--button-primary-background);
|
|
53
|
+
color:var(--white);
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
const Button = styled.button`
|
|
58
|
+
margin-left:15px;
|
|
59
|
+
border-radius:20px;
|
|
60
|
+
border:none;
|
|
61
|
+
padding:5px 20px 5px 20px;
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
const DeleteChatModal = (props) => {
|
|
65
|
+
const { cancelButtonClick, confirmButtonClick} = props;
|
|
66
|
+
return (
|
|
67
|
+
<ModalContainer>
|
|
68
|
+
<ModalTitle>{'Delete this chat?'}</ModalTitle>
|
|
69
|
+
<ModalDescription>{ 'Messages will only be removed from this device and your devices on the newer versions of Isometrik.'}</ModalDescription>
|
|
70
|
+
<ButtonAction className="logoutActionbtn">
|
|
71
|
+
<Button className="cancleBtn" onClick={cancelButtonClick} >Cancel</Button>
|
|
72
|
+
<Button className="logoutBtn" onClick={confirmButtonClick} >{"Delete chat"}</Button>
|
|
73
|
+
</ButtonAction>
|
|
74
|
+
</ModalContainer>
|
|
75
|
+
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default DeleteChatModal;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { mobile } from '../../utils/media';
|
|
4
|
+
|
|
5
|
+
const ModalContainer = styled.div`
|
|
6
|
+
background-color: var(--modal_color);
|
|
7
|
+
color: var(--black);
|
|
8
|
+
position: absolute;
|
|
9
|
+
width: 32rem;
|
|
10
|
+
top: 50%;
|
|
11
|
+
left: 50%;
|
|
12
|
+
box-shadow: 0 4px 8px 0 rgb(0 0 0 / 20%), 0 6px 20px 0 rgb(0 0 0 / 19%);
|
|
13
|
+
-webkit-transform: translate(-50%,-50%);
|
|
14
|
+
-ms-transform: translate(-50%,-50%);
|
|
15
|
+
transform: translate(-50%,-50%);
|
|
16
|
+
padding: 2rem 1.5rem;
|
|
17
|
+
z-index: 999;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
${mobile(css`
|
|
21
|
+
max-width: 320px;
|
|
22
|
+
`)}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const ModalTitle = styled.h5`
|
|
26
|
+
margin-top: 20px;
|
|
27
|
+
text-transform:capitalize;
|
|
28
|
+
${mobile(css`
|
|
29
|
+
font-size: 18px;
|
|
30
|
+
`)}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const ModalDescription = styled.p`
|
|
34
|
+
font-size: 15px;
|
|
35
|
+
margin-top: 1rem;
|
|
36
|
+
${mobile(css`
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
`)}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const ConfirmButton = styled.button`
|
|
42
|
+
margin-left:auto;
|
|
43
|
+
margin-top: 3rem;
|
|
44
|
+
border-radius:20px;
|
|
45
|
+
border:none;
|
|
46
|
+
padding:5px 20px;
|
|
47
|
+
background-color:var(--button-primary-background);
|
|
48
|
+
color:var(--white);
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
const MicPermissionDisableModal = (props) => {
|
|
52
|
+
const { onClose } = props;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<ModalContainer>
|
|
56
|
+
<ModalTitle>{'Allow microphone'}</ModalTitle>
|
|
57
|
+
<ModalDescription>{`To record Voice Messages, Isometrik needs access to your microphone. Click Mic icon in the URL bar and choose "Always allow chat.isometrik.io to access your microphone."`}</ModalDescription>
|
|
58
|
+
<ConfirmButton onClick={onClose}>{'OK, got it!'}</ConfirmButton>
|
|
59
|
+
</ModalContainer>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default MicPermissionDisableModal;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import OutsideAlerter from '../OutsideAlerter/OutsideAlerter';
|
|
4
|
+
import { mobile } from '../../utils/media';
|
|
5
|
+
const ModalWrapper = styled.div`
|
|
6
|
+
height: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
top: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
background-color: var(--modal-backdrop);
|
|
11
|
+
position: absolute;
|
|
12
|
+
border: none;
|
|
13
|
+
z-index: 999;
|
|
14
|
+
visibility: hidden;
|
|
15
|
+
cursor: default;
|
|
16
|
+
${(props) =>
|
|
17
|
+
props.isActive &&
|
|
18
|
+
css`
|
|
19
|
+
opacity: 1;
|
|
20
|
+
visibility: visible;
|
|
21
|
+
transform: translateY(0);
|
|
22
|
+
`}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const ModalContainer = styled.div`
|
|
26
|
+
background-color: var(--modal_color);
|
|
27
|
+
color: var(--black);
|
|
28
|
+
position: absolute;
|
|
29
|
+
width: 32rem;
|
|
30
|
+
top: 50%;
|
|
31
|
+
left: 50%;
|
|
32
|
+
box-shadow: 0 4px 8px 0 rgb(0 0 0 / 20%), 0 6px 20px 0 rgb(0 0 0 / 19%);
|
|
33
|
+
-webkit-transform: translate(-50%,-50%);
|
|
34
|
+
-ms-transform: translate(-50%,-50%);
|
|
35
|
+
transform: translate(-50%,-50%);
|
|
36
|
+
padding: 20px 24px 6px 22px;
|
|
37
|
+
${mobile(css`
|
|
38
|
+
max-width: 320px;
|
|
39
|
+
`)}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const ModalTitle = styled.h5`
|
|
43
|
+
margin-top: 20px;
|
|
44
|
+
${mobile(css`
|
|
45
|
+
font-size: 18px;
|
|
46
|
+
`)}
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
const ModalDescription = styled.p`
|
|
50
|
+
font-size: 18px;
|
|
51
|
+
${mobile(css`
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
`)}
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
const ButtonAction = styled.div`
|
|
58
|
+
display:flex;
|
|
59
|
+
justify-content: flex-end;
|
|
60
|
+
margin:3rem 0 20px;
|
|
61
|
+
|
|
62
|
+
${mobile(css`
|
|
63
|
+
margin:1.5rem 0 20px;
|
|
64
|
+
`)}
|
|
65
|
+
|
|
66
|
+
.cancleBtn{
|
|
67
|
+
background:var(--white);
|
|
68
|
+
color:var(--button-primary-background);
|
|
69
|
+
border:1px solid var(--border_color);}
|
|
70
|
+
|
|
71
|
+
.logoutBtn{
|
|
72
|
+
background-color:var(--button-primary-background);
|
|
73
|
+
color:var(--white);
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
const Button = styled.button`
|
|
78
|
+
margin-left:15px;
|
|
79
|
+
border-radius:20px;
|
|
80
|
+
border:none;
|
|
81
|
+
padding:5px 20px 5px 20px;
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
const Modal = (props) => {
|
|
85
|
+
const { title, description, buttonText, isActive, cancelButtonClick, confirmButtonClick} = props;
|
|
86
|
+
return (
|
|
87
|
+
<ModalWrapper isActive={isActive}>
|
|
88
|
+
<OutsideAlerter onClose={cancelButtonClick}>
|
|
89
|
+
<ModalContainer>
|
|
90
|
+
<ModalTitle>{title || 'Clear Chat'}</ModalTitle>
|
|
91
|
+
<ModalDescription>{description || 'Are you sure you want to clear this chat!'}</ModalDescription>
|
|
92
|
+
<ButtonAction className="logoutActionbtn">
|
|
93
|
+
<Button className="cancleBtn" onClick={cancelButtonClick} >Cancel</Button>
|
|
94
|
+
<Button className="logoutBtn" onClick={confirmButtonClick} >{buttonText}</Button>
|
|
95
|
+
</ButtonAction>
|
|
96
|
+
</ModalContainer>
|
|
97
|
+
</OutsideAlerter>
|
|
98
|
+
</ModalWrapper>
|
|
99
|
+
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default Modal;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { mobile } from '../../utils/media';
|
|
4
|
+
|
|
5
|
+
const ModalContainer = styled.div`
|
|
6
|
+
background-color: var(--modal_color);
|
|
7
|
+
color: var(--black);
|
|
8
|
+
position: absolute;
|
|
9
|
+
width: 32rem;
|
|
10
|
+
top: 50%;
|
|
11
|
+
left: 50%;
|
|
12
|
+
box-shadow: 0 4px 8px 0 rgb(0 0 0 / 20%), 0 6px 20px 0 rgb(0 0 0 / 19%);
|
|
13
|
+
-webkit-transform: translate(-50%,-50%);
|
|
14
|
+
-ms-transform: translate(-50%,-50%);
|
|
15
|
+
transform: translate(-50%,-50%);
|
|
16
|
+
padding: 20px 24px 6px 22px;
|
|
17
|
+
${mobile(css`
|
|
18
|
+
max-width: 320px;
|
|
19
|
+
`)}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const ModalTitle = styled.h5`
|
|
23
|
+
margin-top: 20px;
|
|
24
|
+
text-transform:capitalize;
|
|
25
|
+
${mobile(css`
|
|
26
|
+
font-size: 18px;
|
|
27
|
+
`)}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const ModalDescription = styled.p`
|
|
31
|
+
font-size: 18px;
|
|
32
|
+
${mobile(css`
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
`)}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const ButtonAction = styled.div`
|
|
39
|
+
display:flex;
|
|
40
|
+
justify-content: flex-end;
|
|
41
|
+
margin:3rem 0 20px;
|
|
42
|
+
${(props) =>
|
|
43
|
+
props.DeleteModal &&
|
|
44
|
+
css`
|
|
45
|
+
flex-direction:column !important;
|
|
46
|
+
`}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
${mobile(css`
|
|
50
|
+
margin:1.5rem 0 20px;
|
|
51
|
+
`)}
|
|
52
|
+
|
|
53
|
+
.cancleBtn{
|
|
54
|
+
background:var(--white);
|
|
55
|
+
color:var(--button-primary-background);
|
|
56
|
+
border:1px solid var(--border_color);
|
|
57
|
+
${(props) =>
|
|
58
|
+
props.DeleteModal &&
|
|
59
|
+
css`
|
|
60
|
+
width: fit-content !important;
|
|
61
|
+
margin: 0.5rem 0 !important;
|
|
62
|
+
margin-left: auto !important;
|
|
63
|
+
background:var(--white) !important;
|
|
64
|
+
color:var(--button-primary-background) !important;
|
|
65
|
+
border:1px solid var(--border_color)} !important;
|
|
66
|
+
`}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.logoutBtn{
|
|
71
|
+
background-color:var(--button-primary-background);
|
|
72
|
+
color:var(--white);
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
const Button = styled.button`
|
|
77
|
+
margin-left:15px;
|
|
78
|
+
border-radius:20px;
|
|
79
|
+
border:none;
|
|
80
|
+
padding:5px 20px 5px 20px;
|
|
81
|
+
`;
|
|
82
|
+
function ModalDialog({userData,handleOnCloseModal,handleUnblockUser, DeleteModal,deleteMesageHandler, isSelfMessage}) {
|
|
83
|
+
return (
|
|
84
|
+
<ModalContainer>
|
|
85
|
+
<ModalTitle> {DeleteModal ? "delete Message ? " :`unblock ${userData?.userName} ?`} </ModalTitle>
|
|
86
|
+
<ModalDescription> {DeleteModal ? "" : `Are you sure you want to unblock ${userData?.userName}`} </ModalDescription>
|
|
87
|
+
<ButtonAction className="logoutActionbtn" DeleteModal={DeleteModal} >
|
|
88
|
+
{
|
|
89
|
+
!DeleteModal &&
|
|
90
|
+
<Button className="cancleBtn" onClick={handleUnblockUser}> {"unblock"}</Button>
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
{
|
|
94
|
+
DeleteModal && isSelfMessage && <Button DeleteModal={DeleteModal} className="cancleBtn" onClick={handleUnblockUser}>{'Delete for everyone'}</Button>
|
|
95
|
+
}
|
|
96
|
+
{DeleteModal && <Button className={DeleteModal ? "cancleBtn" :""} onClick={deleteMesageHandler} > {DeleteModal && "Delete for me"}</Button> }
|
|
97
|
+
<Button className={DeleteModal ? "cancleBtn" :"logoutBtn"} onClick={handleOnCloseModal} > Cancel</Button>
|
|
98
|
+
</ButtonAction>
|
|
99
|
+
</ModalContainer>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default ModalDialog
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { mobile } from '../../utils/media';
|
|
4
|
+
import ImageComponent from '../ImageComponent';
|
|
5
|
+
import { CAMERA_RETAKE, CLOSE_ICON, CORRECT_ICON } from '../../utils/global';
|
|
6
|
+
import ImageCropper from '../../view/component/ImageCropper/ImageCropper';
|
|
7
|
+
import { checkFileSize, checkLetterUppercase, dataURLtoFile, getMediaUrl, uploadPicturePresignedURl } from '../../lib/helpers';
|
|
8
|
+
|
|
9
|
+
const ProfilePictureUploadPreviewWrapper = styled.div`
|
|
10
|
+
background-color: var(--modal_color);
|
|
11
|
+
color: var(--black);
|
|
12
|
+
position: absolute;
|
|
13
|
+
max-width: 500px;
|
|
14
|
+
max-height: 500px;
|
|
15
|
+
top: 50%;
|
|
16
|
+
left: 50%;
|
|
17
|
+
-webkit-transform: translate(-50%,-50%);
|
|
18
|
+
-ms-transform: translate(-50%,-50%);
|
|
19
|
+
transform: translate(-50%,-50%);
|
|
20
|
+
padding: ${props => props.isPadding ? '0 2rem' : 'unset'};
|
|
21
|
+
padding-bottom: 3rem;
|
|
22
|
+
visibility: hidden;
|
|
23
|
+
${(props) =>
|
|
24
|
+
props.isActive &&
|
|
25
|
+
css`
|
|
26
|
+
visibility: visible;
|
|
27
|
+
opacity: 1;
|
|
28
|
+
`}
|
|
29
|
+
${mobile(css`
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 80%;
|
|
32
|
+
`)}
|
|
33
|
+
|
|
34
|
+
.cross_icon{
|
|
35
|
+
width: 24px;
|
|
36
|
+
height: 24px;
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const ProfilePictureUploadHeader = styled.div`
|
|
41
|
+
width: 100%;
|
|
42
|
+
display: flex;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
padding: 1rem 2rem;
|
|
45
|
+
${mobile(css`
|
|
46
|
+
padding: 1rem;
|
|
47
|
+
`)}
|
|
48
|
+
.header_wrapper{
|
|
49
|
+
display: flex;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
const ProfilePictureUploadHeaderText = styled.p`
|
|
54
|
+
margin-bottom: 0;
|
|
55
|
+
color: var(--black);
|
|
56
|
+
margin-left: 1rem;
|
|
57
|
+
padding-top:${props => props.isPaddingTop ? '2rem' : 'unset'};
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
const ClickedImageWrapper = styled.div`
|
|
61
|
+
position: relative;
|
|
62
|
+
${mobile(css`
|
|
63
|
+
height: 100%;
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
`)}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
const CorrectIconWrapper = styled.div`
|
|
70
|
+
width: 60px;
|
|
71
|
+
height: 60px;
|
|
72
|
+
border-radius: 50%;
|
|
73
|
+
background-color: var(--profile-name);
|
|
74
|
+
display: flex;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
align-items: center;
|
|
77
|
+
position: absolute;
|
|
78
|
+
right: 50px;
|
|
79
|
+
bottom: -30px;
|
|
80
|
+
|
|
81
|
+
img{
|
|
82
|
+
width: 30px;
|
|
83
|
+
height: 30px;
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
const ProfilePictureUploadPreview = (props) => {
|
|
88
|
+
const { isActive, imageUrl, updateProfileImageRequest, setToastStatus, updateUserDetails, onClose, uploadFileRef } = props;
|
|
89
|
+
const [croppedImg, setCroppedImg] = useState("");
|
|
90
|
+
|
|
91
|
+
const submitHandler = async () => {
|
|
92
|
+
try {
|
|
93
|
+
const file = dataURLtoFile(croppedImg, 'myimage.png');
|
|
94
|
+
const { valid, error } = checkFileSize(file);
|
|
95
|
+
const isValidUsername = checkLetterUppercase(updateUserDetails?.userName);
|
|
96
|
+
if (valid && isValidUsername) {
|
|
97
|
+
const response = await uploadPicturePresignedURl(file.type);
|
|
98
|
+
if (response?.presignedUrl) {
|
|
99
|
+
onClose();
|
|
100
|
+
const uploadImage = await getMediaUrl(response?.presignedUrl, file, file.type);
|
|
101
|
+
updateProfileImageRequest(response?.mediaUrl);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
if (isValidUsername) {
|
|
105
|
+
setToastStatus({ open: true, message: error, variant: 'error' });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
console.error('error', error);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const retakeActionClick = () => {
|
|
114
|
+
uploadFileRef.current.value = null;
|
|
115
|
+
uploadFileRef.current.click();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<ProfilePictureUploadPreviewWrapper isActive={isActive}>
|
|
120
|
+
<ProfilePictureUploadHeader>
|
|
121
|
+
<div className='header_wrapper'>
|
|
122
|
+
<ImageComponent
|
|
123
|
+
id="takePhotoModal"
|
|
124
|
+
onClick={onClose}
|
|
125
|
+
src={CLOSE_ICON}
|
|
126
|
+
className={`${props?.theme ? "darkicons" : "lighticons"} cross_icon`}
|
|
127
|
+
/>
|
|
128
|
+
<ProfilePictureUploadHeaderText>{'Drag the image to adjust'}</ProfilePictureUploadHeaderText>
|
|
129
|
+
</div>
|
|
130
|
+
{
|
|
131
|
+
imageUrl?.length > 0 &&
|
|
132
|
+
<div onClick={() => retakeActionClick()} className='header_wrapper pointer'>
|
|
133
|
+
<ImageComponent
|
|
134
|
+
src={CAMERA_RETAKE}
|
|
135
|
+
className={`${props?.theme ? "darkicons" : "lighticons"} cross_icon`}
|
|
136
|
+
/>
|
|
137
|
+
<ProfilePictureUploadHeaderText>{'Upload'}</ProfilePictureUploadHeaderText>
|
|
138
|
+
</div>
|
|
139
|
+
}
|
|
140
|
+
</ProfilePictureUploadHeader>
|
|
141
|
+
<>
|
|
142
|
+
{
|
|
143
|
+
imageUrl?.length > 0 &&
|
|
144
|
+
<>
|
|
145
|
+
<ClickedImageWrapper >
|
|
146
|
+
<ImageCropper setCroppedImg={setCroppedImg} imageUrl={imageUrl} />
|
|
147
|
+
<CorrectIconWrapper>
|
|
148
|
+
<ImageComponent onClick={submitHandler} className={`darkicons`} src={CORRECT_ICON} alt={"correct_icon"} />
|
|
149
|
+
</CorrectIconWrapper>
|
|
150
|
+
</ClickedImageWrapper>
|
|
151
|
+
|
|
152
|
+
</>
|
|
153
|
+
}
|
|
154
|
+
</>
|
|
155
|
+
|
|
156
|
+
</ProfilePictureUploadPreviewWrapper>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export default ProfilePictureUploadPreview;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
function useOutsideAlerter(ref, props) {
|
|
5
|
+
/**
|
|
6
|
+
* Alert if clicked on outside of element
|
|
7
|
+
*/
|
|
8
|
+
function handleClickOutside(event) {
|
|
9
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
10
|
+
props.onClose();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
// Bind the event listener
|
|
16
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
17
|
+
return () => {
|
|
18
|
+
// Unbind the event listener on clean up
|
|
19
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
20
|
+
};
|
|
21
|
+
},[]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Component that alerts if you click outside of it
|
|
26
|
+
*/
|
|
27
|
+
function OutsideAlerter(props) {
|
|
28
|
+
const wrapperRef = useRef(null);
|
|
29
|
+
useOutsideAlerter(wrapperRef, props);
|
|
30
|
+
|
|
31
|
+
return <div ref={wrapperRef}>{props.children}</div>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
OutsideAlerter.propTypes = {
|
|
35
|
+
children: PropTypes.element.isRequired,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default OutsideAlerter;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import ImageComponent from '../ImageComponent';
|
|
4
|
+
import { BACKICON, CLOSE_ICON } from '../../utils/global';
|
|
5
|
+
import OutsideAlerter from '../OutsideAlerter/OutsideAlerter';
|
|
6
|
+
import { mobile } from '../../utils/media';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const ProfilePictureViewContainer = styled.div`
|
|
10
|
+
width: 100vw;
|
|
11
|
+
height: 100vh;
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 0;
|
|
14
|
+
background: var(--primary-white);
|
|
15
|
+
padding: 1rem 3rem;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
z-index: 999;
|
|
19
|
+
${mobile(css`
|
|
20
|
+
padding: 1rem 0;
|
|
21
|
+
`)}
|
|
22
|
+
.user_profile_picture_major{
|
|
23
|
+
width: 512px;
|
|
24
|
+
height: 512px;
|
|
25
|
+
margin: auto;
|
|
26
|
+
object-fit: cover;
|
|
27
|
+
${mobile(css`
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
max-height: 400px;
|
|
31
|
+
aspect-ratio: 1/1;
|
|
32
|
+
`)}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
const ProfilePictureHeaderView = styled.div`
|
|
37
|
+
display: flex;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
align-items: center;
|
|
40
|
+
|
|
41
|
+
${mobile(css`
|
|
42
|
+
padding-left: 2rem;
|
|
43
|
+
`)}
|
|
44
|
+
|
|
45
|
+
.cross_icon{
|
|
46
|
+
height: 24px;
|
|
47
|
+
width: 24px;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
${mobile(css`
|
|
50
|
+
display: none;
|
|
51
|
+
`)}
|
|
52
|
+
}
|
|
53
|
+
.dark__theme{
|
|
54
|
+
filter: invert(1);
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const ProfilePictureNameContainer = styled.div`
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
|
|
62
|
+
.user_profile_picture{
|
|
63
|
+
width: 40px;
|
|
64
|
+
height: 40px;
|
|
65
|
+
border-radius: 50%;
|
|
66
|
+
object-fit: cover;
|
|
67
|
+
${mobile(css`
|
|
68
|
+
display: none;
|
|
69
|
+
`)}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.back_icon{
|
|
73
|
+
display: none;
|
|
74
|
+
${mobile(css`
|
|
75
|
+
height: 16px;
|
|
76
|
+
width: 20px;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
display: block;
|
|
79
|
+
margin-right: 1rem;
|
|
80
|
+
`)}
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
const UserProfileName = styled.p`
|
|
85
|
+
margin-bottom: 0;
|
|
86
|
+
color: var(--black);
|
|
87
|
+
margin-left: 1rem;
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
const ProfileImageWrapper = styled.div`
|
|
91
|
+
max-width: 512px;
|
|
92
|
+
max-height: 512px;
|
|
93
|
+
margin: auto;
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
const ProfilePicture = (props) => {
|
|
97
|
+
const { userName, userImageSrc, closeHandler, theme } = props;
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<ProfilePictureViewContainer>
|
|
101
|
+
<ProfilePictureHeaderView theme={theme}>
|
|
102
|
+
<ProfilePictureNameContainer>
|
|
103
|
+
<ImageComponent
|
|
104
|
+
src={BACKICON}
|
|
105
|
+
className={`${theme ? 'dark__theme' : ''} back_icon`}
|
|
106
|
+
onClick={closeHandler}
|
|
107
|
+
/>
|
|
108
|
+
<ImageComponent className="user_profile_picture" src={userImageSrc} alt={'user_profile_picture'} />
|
|
109
|
+
<UserProfileName>{userName}</UserProfileName>
|
|
110
|
+
</ProfilePictureNameContainer>
|
|
111
|
+
<ImageComponent
|
|
112
|
+
onClick={closeHandler}
|
|
113
|
+
src={CLOSE_ICON}
|
|
114
|
+
className={`${theme ? 'dark__theme' : ''} cross_icon`}
|
|
115
|
+
/>
|
|
116
|
+
</ProfilePictureHeaderView>
|
|
117
|
+
<ProfileImageWrapper>
|
|
118
|
+
<OutsideAlerter onClose={closeHandler}>
|
|
119
|
+
<ImageComponent className={'user_profile_picture_major'} src={userImageSrc} alt={'user_profile_picture'} />
|
|
120
|
+
</OutsideAlerter>
|
|
121
|
+
</ProfileImageWrapper>
|
|
122
|
+
|
|
123
|
+
</ProfilePictureViewContainer>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default ProfilePicture;
|