@ethora/chat-component-rn 26.7.4 → 26.7.5
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/CHANGELOG.md +0 -54
- package/README.md +8 -31
- package/lib/commonjs/assets/icons.js +2 -7
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +6 -20
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +14 -36
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +23 -7
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +13 -14
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +32 -62
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +98 -309
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +110 -320
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +213 -552
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js +0 -8
- package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +1 -2
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +104 -202
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +21 -7
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +244 -507
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +46 -74
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/commonjs/components/Modals/styledModalComponents.js +2 -9
- package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +7 -17
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +11 -80
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledComponents.js +3 -9
- package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +35 -6
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/updateMessagesTillLast.js +40 -12
- package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/commonjs/hooks/useChatRoomFocus.js +9 -3
- package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/commonjs/hooks/useLogout.js +5 -0
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +50 -23
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +1 -121
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/main.js +0 -6
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/user.api.js +0 -59
- package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
- package/lib/commonjs/networking/outboundQueue.js +18 -0
- package/lib/commonjs/networking/outboundQueue.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +10 -1
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +107 -7
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +1 -3
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +22 -3
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/assets/icons.js +1 -6
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +6 -20
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +14 -36
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +24 -8
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +13 -14
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +32 -62
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Menu/HeaderRoomListMenu.js +101 -311
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js +113 -311
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +217 -555
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/Modal/Modal.js +1 -9
- package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/ModalContent.js +1 -2
- package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js +106 -205
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +23 -9
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +248 -509
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +48 -76
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/module/components/Modals/styledModalComponents.js +2 -9
- package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +7 -17
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +12 -81
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledComponents.js +3 -9
- package/lib/module/components/styled/StyledComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/module/context/xmppProvider.js +35 -6
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/updateMessagesTillLast.js +41 -13
- package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/module/hooks/useChatRoomFocus.js +9 -3
- package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/module/hooks/useLogout.js +5 -0
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +51 -24
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/i18n/strings.js +1 -121
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/main.js +1 -1
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/user.api.js +0 -56
- package/lib/module/networking/api-requests/user.api.js.map +1 -1
- package/lib/module/networking/outboundQueue.js +17 -0
- package/lib/module/networking/outboundQueue.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +10 -1
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmppClient.js +107 -7
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +1 -3
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +20 -2
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +0 -16
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +0 -3
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +0 -9
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +0 -10
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +2 -4
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +1 -6
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +0 -16
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +0 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
- package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +1 -1
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/user.api.d.ts +0 -27
- package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
- package/lib/typescript/networking/outboundQueue.d.ts +16 -0
- package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +33 -1
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +18 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +15 -0
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +20 -20
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/package.json +1 -6
- package/src/assets/icons.tsx +9 -48
- package/src/components/Header/HeaderRoomList.tsx +5 -20
- package/src/components/MainComponents/ChatRoom.tsx +20 -38
- package/src/components/MainComponents/MessageList.tsx +24 -8
- package/src/components/MainComponents/ProfileImagePlaceholder.tsx +14 -21
- package/src/components/MainComponents/RoomList.tsx +34 -65
- package/src/components/Menu/HeaderRoomListMenu.tsx +71 -310
- package/src/components/Modals/AttachSheet/AttachSheet.tsx +97 -331
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +279 -598
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +2 -4
- package/src/components/Modals/Modal/Modal.tsx +0 -7
- package/src/components/Modals/NewChatModal/ModalContent.tsx +3 -6
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +117 -219
- package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +1 -12
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +4 -14
- package/src/components/Modals/UserProfileModal/EditUserModal.tsx +25 -9
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +307 -617
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +58 -75
- package/src/components/Modals/styledModalComponents.tsx +2 -9
- package/src/components/RoomComponents/ChatRoomItem.tsx +7 -14
- package/src/components/styled/SendInput.tsx +12 -83
- package/src/components/styled/StyledComponents.ts +3 -9
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +4 -11
- package/src/context/xmppProvider.tsx +41 -8
- package/src/helpers/updateMessagesTillLast.tsx +42 -17
- package/src/hooks/useChatRoomFocus.ts +11 -3
- package/src/hooks/useLogout.tsx +7 -0
- package/src/hooks/useSendMessage.tsx +60 -24
- package/src/i18n/strings.ts +1 -121
- package/src/main.ts +1 -1
- package/src/networking/api-requests/user.api.ts +0 -71
- package/src/networking/outboundQueue.ts +29 -0
- package/src/networking/stanzaHandlers.ts +9 -1
- package/src/networking/xmppClient.ts +118 -7
- package/src/roomStore/chatSettingsSlice.ts +1 -3
- package/src/roomStore/roomsSlice.ts +20 -2
- package/src/types/models/room.model.ts +15 -0
- package/src/types/types.ts +20 -22
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +0 -226
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +0 -556
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +0 -210
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
- package/lib/commonjs/helpers/getChatBackground.js +0 -23
- package/lib/commonjs/helpers/getChatBackground.js.map +0 -1
- package/lib/commonjs/helpers/mediaLibraryRuntime.js +0 -31
- package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +0 -1
- package/lib/commonjs/helpers/pickImageAsset.js +0 -68
- package/lib/commonjs/helpers/pickImageAsset.js.map +0 -1
- package/lib/commonjs/helpers/sheetGestures.js +0 -32
- package/lib/commonjs/helpers/sheetGestures.js.map +0 -1
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +0 -223
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +0 -548
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +0 -205
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
- package/lib/module/helpers/getChatBackground.js +0 -18
- package/lib/module/helpers/getChatBackground.js.map +0 -1
- package/lib/module/helpers/mediaLibraryRuntime.js +0 -25
- package/lib/module/helpers/mediaLibraryRuntime.js.map +0 -1
- package/lib/module/helpers/pickImageAsset.js +0 -63
- package/lib/module/helpers/pickImageAsset.js.map +0 -1
- package/lib/module/helpers/sheetGestures.js +0 -26
- package/lib/module/helpers/sheetGestures.js.map +0 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +0 -9
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +0 -1
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +0 -75
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +0 -1
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +0 -25
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +0 -1
- package/lib/typescript/helpers/getChatBackground.d.ts +0 -15
- package/lib/typescript/helpers/getChatBackground.d.ts.map +0 -1
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +0 -3
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +0 -1
- package/lib/typescript/helpers/pickImageAsset.d.ts +0 -27
- package/lib/typescript/helpers/pickImageAsset.d.ts.map +0 -1
- package/lib/typescript/helpers/sheetGestures.d.ts +0 -20
- package/lib/typescript/helpers/sheetGestures.d.ts.map +0 -1
- package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +0 -244
- package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +0 -615
- package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +0 -217
- package/src/helpers/getChatBackground.ts +0 -18
- package/src/helpers/mediaLibraryRuntime.ts +0 -25
- package/src/helpers/pickImageAsset.ts +0 -68
- package/src/helpers/sheetGestures.ts +0 -25
|
@@ -1,98 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
ActivityIndicator,
|
|
6
|
-
Animated,
|
|
7
|
-
Image,
|
|
8
|
-
Share,
|
|
9
|
-
StyleSheet,
|
|
10
|
-
Text,
|
|
11
|
-
TouchableOpacity,
|
|
12
|
-
View,
|
|
13
|
-
} from 'react-native';
|
|
14
|
-
import { ModalContainerFullScreen } from '../styledModalComponents';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
15
2
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import {
|
|
32
|
-
import
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
3
|
+
CenterContainer,
|
|
4
|
+
UserInfo,
|
|
5
|
+
UserName,
|
|
6
|
+
UserStatus,
|
|
7
|
+
ModalContainerFullScreen,
|
|
8
|
+
ActionButton,
|
|
9
|
+
Label,
|
|
10
|
+
BorderedContainer,
|
|
11
|
+
LabelData,
|
|
12
|
+
ModalBackground,
|
|
13
|
+
ModalContainer,
|
|
14
|
+
CloseButton,
|
|
15
|
+
ModalTitle,
|
|
16
|
+
GroupContainer,
|
|
17
|
+
} from '../styledModalComponents';
|
|
18
|
+
import { ChatIcon, DeleteIcon, DownloadIcon, EditIcon, IconDoc, LeaveIcon, MoreIcon } from '../../../assets/icons';
|
|
19
|
+
import ModalHeaderComponent from '../ModalHeaderComponent';
|
|
20
|
+
import { useSelector } from 'react-redux';
|
|
21
|
+
import { RootState } from '../../../roomStore';
|
|
22
|
+
import { ProfileImagePlaceholder } from '../../MainComponents/ProfileImagePlaceholder';
|
|
23
|
+
import Button from '../../styled/Button';
|
|
24
|
+
import DropdownMenu from '../../DropdownMenu/DropdownMenu';
|
|
36
25
|
import {
|
|
37
|
-
|
|
26
|
+
logout,
|
|
38
27
|
setActiveModal,
|
|
39
28
|
setLangSource,
|
|
40
29
|
setSelectedUser,
|
|
41
30
|
} from '../../../roomStore/chatSettingsSlice';
|
|
42
|
-
import { addRoomViaApi, setCurrentRoom } from '../../../roomStore/roomsSlice';
|
|
43
|
-
import
|
|
44
|
-
import {
|
|
31
|
+
import { addRoomViaApi, setCurrentRoom, setLogoutState } from '../../../roomStore/roomsSlice';
|
|
32
|
+
import EditUserModal from './EditUserModal';
|
|
33
|
+
import { walletToUsername } from '../../../helpers/walletUsername';
|
|
34
|
+
import { useXmppClient } from '../../../context/xmppProvider';
|
|
35
|
+
import Loader from '../../styled/Loader';
|
|
36
|
+
import { IRoom, Iso639_1Codes } from '../../../types/types';
|
|
37
|
+
import Select from '../../MainComponents/Select';
|
|
38
|
+
import { useAppDispatch, useAppSelector } from '../../../hooks/hooks';
|
|
39
|
+
import { ScrollView, Text, View } from 'react-native';
|
|
45
40
|
import { ApiRoom, postPrivateRoom } from '../../../networking/api-requests/rooms.api';
|
|
46
|
-
import {
|
|
47
|
-
getUserFiles,
|
|
48
|
-
isMediaFile,
|
|
49
|
-
UserFile,
|
|
50
|
-
} from '../../../networking/api-requests/user.api';
|
|
51
41
|
import { createRoomFromApi } from '../../../helpers/createRoomFromApi';
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
|
|
56
|
-
ProfileTopBar,
|
|
57
|
-
HeroAction,
|
|
58
|
-
useHeaderMetrics,
|
|
59
|
-
} from '../ProfileHeader/ProfileHeader';
|
|
60
|
-
import ProfileMenu, { ProfileMenuItem } from '../ProfileHeader/ProfileMenu';
|
|
61
|
-
import EditUserModal from './EditUserModal';
|
|
62
|
-
|
|
63
|
-
const PREFIX = 'user-profile';
|
|
64
|
-
|
|
65
|
-
type TabKey = 'language' | 'media' | 'documents';
|
|
66
|
-
|
|
67
|
-
/** Two uppercase letters for a person without a picture. */
|
|
68
|
-
export const userInitials = (name?: string | null): string => {
|
|
69
|
-
const words = (name || '').trim().split(/\s+/).filter(Boolean);
|
|
70
|
-
const letters = (words.length >= 2
|
|
71
|
-
? [words[0][0], words[1][0]]
|
|
72
|
-
: [words[0]?.[0], words[0]?.[1]]
|
|
73
|
-
).filter((c) => !!c && /[\p{L}\p{N}]/u.test(c));
|
|
74
|
-
return letters.join('').toUpperCase();
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Which tabs a profile shows. Only the signed-in user has tabs at all:
|
|
79
|
-
* `GET /v2/files/` returns the JWT owner's files, so there is nothing to
|
|
80
|
-
* put under Media/Documents for anybody else, and the language picker is
|
|
81
|
-
* a personal setting.
|
|
82
|
-
*/
|
|
83
|
-
export const profileTabs = (opts: {
|
|
84
|
-
isOwnProfile: boolean;
|
|
85
|
-
translatesEnabled: boolean;
|
|
86
|
-
hasMedia: boolean;
|
|
87
|
-
hasDocuments: boolean;
|
|
88
|
-
}): TabKey[] => {
|
|
89
|
-
if (!opts.isOwnProfile) {return [];}
|
|
90
|
-
const tabs: TabKey[] = [];
|
|
91
|
-
if (opts.translatesEnabled) {tabs.push('language');}
|
|
92
|
-
if (opts.hasMedia) {tabs.push('media');}
|
|
93
|
-
if (opts.hasDocuments) {tabs.push('documents');}
|
|
94
|
-
return tabs;
|
|
95
|
-
};
|
|
42
|
+
import { useToast } from '../../../context/ToastContext';
|
|
43
|
+
import { LANGUAGE_OPTIONS } from '../../../helpers/constants/LANGUAGE_OPTIONS';
|
|
44
|
+
import { deleteDocument, getDocuments } from '../../../networking/api-requests/user.api';
|
|
45
|
+
import { useChatSettingState } from '../../../hooks/useChatSettingState';
|
|
96
46
|
|
|
97
47
|
interface UserProfileModalProps {
|
|
98
48
|
handleCloseModal: any;
|
|
@@ -101,111 +51,89 @@ interface UserProfileModalProps {
|
|
|
101
51
|
const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
102
52
|
handleCloseModal,
|
|
103
53
|
}) => {
|
|
104
|
-
const t = useT();
|
|
105
54
|
const dispatch = useAppDispatch();
|
|
55
|
+
|
|
106
56
|
const { client } = useXmppClient();
|
|
107
57
|
const { showToast } = useToast();
|
|
58
|
+
|
|
108
59
|
const { config, user, selectedUser, langSource } = useChatSettingState();
|
|
109
|
-
const fileToken = useFileToken();
|
|
110
|
-
|
|
111
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
112
|
-
const [files, setFiles] = useState<UserFile[]>([]);
|
|
113
|
-
const [loadingFiles, setLoadingFiles] = useState(false);
|
|
114
|
-
const [activeTab, setActiveTab] = useState<TabKey | null>(null);
|
|
115
|
-
|
|
116
|
-
const scrollY = useRef(new Animated.Value(0)).current;
|
|
117
|
-
const scrollRef = useRef<any>(null);
|
|
118
|
-
const { collapseDistance } = useHeaderMetrics();
|
|
119
|
-
const [viewportHeight, setViewportHeight] = useState(0);
|
|
120
|
-
// `scrollY` is driven natively, so its value can't be read back with
|
|
121
|
-
// addListener; the Animated.event's JS `listener` still fires, which is
|
|
122
|
-
// enough to know which state the header is in.
|
|
123
|
-
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
124
|
-
|
|
125
|
-
const isOwnProfile = !selectedUser;
|
|
126
|
-
const profileUser: any = selectedUser ?? user;
|
|
127
|
-
|
|
128
|
-
const media = useMemo(() => files.filter(isMediaFile), [files]);
|
|
129
|
-
const documents = useMemo(
|
|
130
|
-
() => files.filter((file) => !isMediaFile(file)),
|
|
131
|
-
[files]
|
|
132
|
-
);
|
|
133
60
|
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
translatesEnabled: !!config?.translates?.enabled,
|
|
139
|
-
hasMedia: media.length > 0,
|
|
140
|
-
hasDocuments: documents.length > 0,
|
|
141
|
-
}),
|
|
142
|
-
[isOwnProfile, config?.translates?.enabled, media.length, documents.length]
|
|
143
|
-
);
|
|
61
|
+
const [isEditing, setIsEditing] = useState<boolean>(false);
|
|
62
|
+
const [documents, setDocuments] = useState<any[]>([]);
|
|
63
|
+
const [deleteDocumentId, setDeleteDocumentId] = useState<string>('');
|
|
64
|
+
const [showDelete, setShowDelete] = useState<boolean>(false);
|
|
144
65
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
66
|
+
const handleDeleteDocument = async () => {
|
|
67
|
+
try {
|
|
68
|
+
await deleteDocument(deleteDocumentId);
|
|
69
|
+
setDocuments(documents.filter((doc) => doc._id !== deleteDocumentId));
|
|
70
|
+
showToast({
|
|
71
|
+
id: Date.now().toString(),
|
|
72
|
+
title: 'Success',
|
|
73
|
+
message: 'Document deleted successfully',
|
|
74
|
+
type: 'success',
|
|
75
|
+
});
|
|
76
|
+
// handleGetDocs();
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error('Error deleting document', error);
|
|
79
|
+
showToast({
|
|
80
|
+
id: Date.now().toString(),
|
|
81
|
+
title: 'Error',
|
|
82
|
+
message: 'Failed to delete document',
|
|
83
|
+
type: 'error',
|
|
84
|
+
});
|
|
85
|
+
} finally {
|
|
86
|
+
setShowDelete(false);
|
|
150
87
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
setFiles([]);
|
|
162
|
-
return;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const handleGetDocs = async () => {
|
|
91
|
+
try {
|
|
92
|
+
const { data } = await getDocuments(user?.defaultWallet?.walletAddress);
|
|
93
|
+
const items = data.results.filter((el: {locations: unknown[]}) => el.locations[0]);
|
|
94
|
+
|
|
95
|
+
setDocuments(items);
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('Error getting docs', error);
|
|
163
98
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
})
|
|
170
|
-
.catch((error) => {
|
|
171
|
-
console.warn('Could not load user files:', error);
|
|
172
|
-
if (!cancelled) {setFiles([]);}
|
|
173
|
-
})
|
|
174
|
-
.finally(() => {
|
|
175
|
-
if (!cancelled) {setLoadingFiles(false);}
|
|
176
|
-
});
|
|
177
|
-
return () => {
|
|
178
|
-
cancelled = true;
|
|
179
|
-
};
|
|
180
|
-
}, [isOwnProfile, user?.token]);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
handleGetDocs();
|
|
103
|
+
}, []);
|
|
181
104
|
|
|
182
105
|
const handleBackClick = useCallback(() => {
|
|
183
106
|
dispatch(setSelectedUser(undefined));
|
|
184
107
|
handleCloseModal();
|
|
185
|
-
}, [
|
|
108
|
+
}, []);
|
|
186
109
|
|
|
187
|
-
// Same teardown the room-list menu runs (XMPP, redux, persisted slices,
|
|
188
|
-
// AsyncStorage), including the host's confirm copy and callbacks.
|
|
189
|
-
const performLogout = useLogout();
|
|
190
110
|
const handleLogout = useCallback(() => {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
111
|
+
dispatch(logout());
|
|
112
|
+
dispatch(setLogoutState());
|
|
113
|
+
}, []);
|
|
114
|
+
|
|
115
|
+
const menuOptions = useMemo(
|
|
116
|
+
() => [
|
|
117
|
+
{
|
|
118
|
+
label: 'Log Out',
|
|
119
|
+
icon: <LeaveIcon />,
|
|
120
|
+
onClick: () => {
|
|
121
|
+
handleLogout();
|
|
122
|
+
},
|
|
123
|
+
styles: { color: 'red' },
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
[]
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
const handleSelect = (selected: { name: string; id: Iso639_1Codes }) => {
|
|
130
|
+
dispatch(setLangSource(selected.id));
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const EditClick = useCallback(() => {
|
|
134
|
+
setIsEditing(true);
|
|
135
|
+
}, []);
|
|
136
|
+
|
|
209
137
|
|
|
210
138
|
const handleRoomCreation = async (
|
|
211
139
|
newChat: ApiRoom,
|
|
@@ -218,9 +146,15 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
|
218
146
|
usersArrayLength
|
|
219
147
|
);
|
|
220
148
|
|
|
221
|
-
if (!normalizedChat || !client)
|
|
149
|
+
if (!normalizedChat || !client) return;
|
|
150
|
+
|
|
151
|
+
dispatch(
|
|
152
|
+
addRoomViaApi({
|
|
153
|
+
room: normalizedChat,
|
|
154
|
+
xmpp: client,
|
|
155
|
+
})
|
|
156
|
+
);
|
|
222
157
|
|
|
223
|
-
dispatch(addRoomViaApi({ room: normalizedChat, xmpp: client }));
|
|
224
158
|
dispatch(setCurrentRoom({ roomJID: normalizedChat?.jid || '' }));
|
|
225
159
|
|
|
226
160
|
showToast({
|
|
@@ -243,19 +177,22 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
|
243
177
|
type: 'info',
|
|
244
178
|
duration: 3000,
|
|
245
179
|
});
|
|
180
|
+
let newRoomJid = '';
|
|
246
181
|
if (config?.newArch) {
|
|
247
182
|
const newRoom = await postPrivateRoom(
|
|
248
183
|
selectedUser?.userJID ?? (selectedUser?.id || '')
|
|
249
184
|
);
|
|
250
185
|
handleRoomCreation(newRoom, 2);
|
|
186
|
+
newRoomJid = newRoom.name;
|
|
251
187
|
} else {
|
|
252
188
|
const selectedUserUsername = walletToUsername(selectedUser?.id || '');
|
|
253
189
|
const myUsername = walletToUsername(user.defaultWallet.walletAddress);
|
|
254
190
|
|
|
255
|
-
const
|
|
191
|
+
const combinedWalletAddress = [myUsername, selectedUserUsername]
|
|
256
192
|
.sort()
|
|
257
|
-
.join('.')
|
|
258
|
-
|
|
193
|
+
.join('.');
|
|
194
|
+
|
|
195
|
+
const roomJid = combinedWalletAddress.toLowerCase();
|
|
259
196
|
|
|
260
197
|
const combinedUsersName = [
|
|
261
198
|
user.firstName,
|
|
@@ -264,12 +201,11 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
|
264
201
|
.sort()
|
|
265
202
|
.join(' and ');
|
|
266
203
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
)) || '';
|
|
204
|
+
newRoomJid = (await client?.createPrivateRoomStanza(
|
|
205
|
+
combinedUsersName,
|
|
206
|
+
`Private chat ${combinedUsersName}`,
|
|
207
|
+
roomJid
|
|
208
|
+
)) || '';
|
|
273
209
|
|
|
274
210
|
if (newRoomJid) {
|
|
275
211
|
await client?.inviteRoomRequestStanza(selectedUserUsername, newRoomJid);
|
|
@@ -278,448 +214,202 @@ const UserProfileModal: React.FC<UserProfileModalProps> = ({
|
|
|
278
214
|
}
|
|
279
215
|
|
|
280
216
|
dispatch(setActiveModal(undefined));
|
|
281
|
-
}, [selectedUser]);
|
|
282
|
-
|
|
283
|
-
const openFile = (file: UserFile) => {
|
|
284
|
-
dispatch(
|
|
285
|
-
setActiveFile({
|
|
286
|
-
fileName: file.name,
|
|
287
|
-
fileURL: file.url,
|
|
288
|
-
mimetype: file.mimetype,
|
|
289
|
-
})
|
|
290
|
-
);
|
|
291
|
-
dispatch(setActiveModal(MODAL_TYPES.FILE_PREVIEW));
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
const heroActions: HeroAction[] = useMemo(
|
|
295
|
-
() =>
|
|
296
|
-
isOwnProfile
|
|
297
|
-
? [
|
|
298
|
-
{
|
|
299
|
-
key: 'account',
|
|
300
|
-
label: t('action.account'),
|
|
301
|
-
icon: (color: string) => <ProfileIcon color={color} />,
|
|
302
|
-
onPress: () => dispatch(setActiveModal(MODAL_TYPES.SETTINGS)),
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
key: 'share',
|
|
306
|
-
label: t('action.share'),
|
|
307
|
-
icon: (color: string) => <ShareIcon color={color} />,
|
|
308
|
-
onPress: handleShare,
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
key: 'edit',
|
|
312
|
-
label: t('action.edit'),
|
|
313
|
-
icon: (color: string) => <EditIcon color={color} />,
|
|
314
|
-
onPress: () => setIsEditing(true),
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
key: 'logout',
|
|
318
|
-
label: t('action.logOut'),
|
|
319
|
-
icon: (color: string) => <LogoutIcon color={color} />,
|
|
320
|
-
onPress: handleLogout,
|
|
321
|
-
},
|
|
322
|
-
]
|
|
323
|
-
: [
|
|
324
|
-
...(config?.hideMemberSendMessageAction
|
|
325
|
-
? []
|
|
326
|
-
: [
|
|
327
|
-
{
|
|
328
|
-
key: 'message',
|
|
329
|
-
label: t('action.message'),
|
|
330
|
-
icon: (color: string) => <ChatIcon color={color} />,
|
|
331
|
-
onPress: handlePrivateMessage,
|
|
332
|
-
},
|
|
333
|
-
]),
|
|
334
|
-
{
|
|
335
|
-
key: 'share',
|
|
336
|
-
label: t('action.share'),
|
|
337
|
-
icon: (color: string) => <ShareIcon color={color} />,
|
|
338
|
-
onPress: handleShare,
|
|
339
|
-
},
|
|
340
|
-
],
|
|
341
|
-
[isOwnProfile, t, handleShare, handlePrivateMessage, handleLogout] // eslint-disable-line react-hooks/exhaustive-deps
|
|
342
|
-
);
|
|
217
|
+
}, [selectedUser]);
|
|
343
218
|
|
|
344
|
-
|
|
345
|
-
// exactly the same actions so nothing becomes unreachable.
|
|
346
|
-
const menuItems: ProfileMenuItem[] = useMemo(
|
|
347
|
-
() =>
|
|
348
|
-
isCollapsed
|
|
349
|
-
? heroActions.map((action) => ({
|
|
350
|
-
key: action.key,
|
|
351
|
-
label: action.label,
|
|
352
|
-
icon: action.icon('#141414'),
|
|
353
|
-
destructive: action.key === 'logout',
|
|
354
|
-
onPress: action.onPress,
|
|
355
|
-
}))
|
|
356
|
-
: [],
|
|
357
|
-
[isCollapsed, heroActions]
|
|
358
|
-
);
|
|
219
|
+
const modalUser: any = selectedUser ?? user;
|
|
359
220
|
|
|
360
|
-
|
|
361
|
-
return
|
|
362
|
-
<ModalContainerFullScreen>
|
|
363
|
-
<EditUserModal
|
|
364
|
-
setIsEditing={setIsEditing}
|
|
365
|
-
modalUser={profileUser}
|
|
366
|
-
config={config}
|
|
367
|
-
/>
|
|
368
|
-
</ModalContainerFullScreen>
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
const displayName =
|
|
373
|
-
profileUser?.name ||
|
|
374
|
-
`${profileUser?.firstName ?? ''} ${profileUser?.lastName ?? ''}`.trim() ||
|
|
375
|
-
t('modal.profile.title');
|
|
376
|
-
const heroImage =
|
|
377
|
-
appendFileToken(profileUser?.profileImage, fileToken) || null;
|
|
378
|
-
const heroColor = config?.colors?.avatar || getIconColor(config);
|
|
379
|
-
const description = profileUser?.description;
|
|
380
|
-
|
|
381
|
-
const renderTabBody = () => {
|
|
382
|
-
if (activeTab === 'language') {
|
|
383
|
-
return (
|
|
384
|
-
<View>
|
|
385
|
-
{LANGUAGE_OPTIONS.map((option) => {
|
|
386
|
-
const selected = langSource === option.id;
|
|
387
|
-
return (
|
|
388
|
-
<TouchableOpacity
|
|
389
|
-
key={option.id}
|
|
390
|
-
testID={`${PREFIX}-language-${option.id}`}
|
|
391
|
-
activeOpacity={0.7}
|
|
392
|
-
style={styles.languageRow}
|
|
393
|
-
onPress={() =>
|
|
394
|
-
dispatch(setLangSource(option.id as Iso639_1Codes))
|
|
395
|
-
}
|
|
396
|
-
>
|
|
397
|
-
<Text style={styles.languageLabel}>{option.name}</Text>
|
|
398
|
-
{selected && (
|
|
399
|
-
<Text style={[styles.check, { color: getIconColor(config) }]}>
|
|
400
|
-
✓
|
|
401
|
-
</Text>
|
|
402
|
-
)}
|
|
403
|
-
</TouchableOpacity>
|
|
404
|
-
);
|
|
405
|
-
})}
|
|
406
|
-
</View>
|
|
407
|
-
);
|
|
408
|
-
}
|
|
221
|
+
const findLanguage = () => {
|
|
222
|
+
if(!langSource) {return null;}
|
|
409
223
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
{media.map((file) => (
|
|
414
|
-
<TouchableOpacity
|
|
415
|
-
key={file.id}
|
|
416
|
-
testID={`${PREFIX}-media-${file.id}`}
|
|
417
|
-
activeOpacity={0.8}
|
|
418
|
-
style={styles.mediaTile}
|
|
419
|
-
onPress={() => openFile(file)}
|
|
420
|
-
>
|
|
421
|
-
<Image
|
|
422
|
-
source={{ uri: appendFileToken(file.url, fileToken) || file.url }}
|
|
423
|
-
style={styles.mediaImage}
|
|
424
|
-
resizeMode="cover"
|
|
425
|
-
/>
|
|
426
|
-
</TouchableOpacity>
|
|
427
|
-
))}
|
|
428
|
-
</View>
|
|
429
|
-
);
|
|
430
|
-
}
|
|
224
|
+
const language = LANGUAGE_OPTIONS.find((lang) => lang.id === langSource);
|
|
225
|
+
return language || null;
|
|
226
|
+
};
|
|
431
227
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
<TouchableOpacity
|
|
436
|
-
key={file.id}
|
|
437
|
-
testID={`${PREFIX}-document-${file.id}`}
|
|
438
|
-
activeOpacity={0.7}
|
|
439
|
-
style={styles.documentRow}
|
|
440
|
-
onPress={() => openFile(file)}
|
|
441
|
-
>
|
|
442
|
-
<IconDoc />
|
|
443
|
-
<View style={styles.documentText}>
|
|
444
|
-
<Text numberOfLines={1} style={styles.documentName}>
|
|
445
|
-
{file.name}
|
|
446
|
-
</Text>
|
|
447
|
-
{!!file.createdAt && (
|
|
448
|
-
<Text style={styles.documentDate}>
|
|
449
|
-
{new Date(file.createdAt).toLocaleDateString()}
|
|
450
|
-
</Text>
|
|
451
|
-
)}
|
|
452
|
-
</View>
|
|
453
|
-
</TouchableOpacity>
|
|
454
|
-
))}
|
|
455
|
-
</View>
|
|
456
|
-
);
|
|
228
|
+
const showDeleteModal = (docId: string) => {
|
|
229
|
+
setDeleteDocumentId(docId);
|
|
230
|
+
setShowDelete(true);
|
|
457
231
|
};
|
|
458
232
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
const y = e?.nativeEvent?.contentOffset?.y ?? 0;
|
|
479
|
-
setIsCollapsed(y >= collapseDistance - 8);
|
|
480
|
-
},
|
|
481
|
-
}
|
|
482
|
-
)}
|
|
483
|
-
>
|
|
484
|
-
<ProfileHero
|
|
485
|
-
testIDPrefix={PREFIX}
|
|
486
|
-
title={displayName}
|
|
487
|
-
imageUri={heroImage}
|
|
488
|
-
fallbackColor={heroColor}
|
|
489
|
-
initials={userInitials(displayName)}
|
|
490
|
-
scrollY={scrollY}
|
|
491
|
-
actions={heroActions}
|
|
492
|
-
titleStyle={chatTextStyle(config?.typography?.profile?.title)}
|
|
493
|
-
titleAccessory={
|
|
494
|
-
isOwnProfile ? (
|
|
495
|
-
<TouchableOpacity
|
|
496
|
-
testID={`${PREFIX}-logout`}
|
|
497
|
-
activeOpacity={0.7}
|
|
498
|
-
style={styles.leaveButton}
|
|
499
|
-
onPress={handleLogout}
|
|
500
|
-
>
|
|
501
|
-
<LeaveIcon color="#FFFFFF" width={18} height={18} />
|
|
502
|
-
<Text style={styles.leaveLabel}>{t('action.leave')}</Text>
|
|
503
|
-
</TouchableOpacity>
|
|
504
|
-
) : undefined
|
|
233
|
+
const DefaultBody = useMemo(
|
|
234
|
+
() => (
|
|
235
|
+
<>
|
|
236
|
+
<ModalHeaderComponent
|
|
237
|
+
handleCloseModal={handleBackClick}
|
|
238
|
+
headerTitle={'Profile'}
|
|
239
|
+
rightMenu={
|
|
240
|
+
!selectedUser && (
|
|
241
|
+
<>
|
|
242
|
+
<Button onPress={EditClick}>
|
|
243
|
+
<EditIcon color="#8C8C8C" />
|
|
244
|
+
</Button>
|
|
245
|
+
<DropdownMenu
|
|
246
|
+
options={menuOptions}
|
|
247
|
+
position="right"
|
|
248
|
+
menuIcon={<MoreIcon />}
|
|
249
|
+
/>
|
|
250
|
+
</>
|
|
251
|
+
)
|
|
505
252
|
}
|
|
506
253
|
/>
|
|
254
|
+
<CenterContainer>
|
|
255
|
+
<ProfileImagePlaceholder
|
|
256
|
+
icon={modalUser?.profileImage ?? null}
|
|
257
|
+
name={modalUser?.name ?? modalUser?.firstName}
|
|
258
|
+
size={120}
|
|
259
|
+
/>
|
|
260
|
+
<UserInfo>
|
|
261
|
+
<UserName>
|
|
262
|
+
{modalUser?.name
|
|
263
|
+
? `${modalUser?.name}`
|
|
264
|
+
: `${modalUser?.firstName} ${modalUser?.lastName}`}
|
|
265
|
+
</UserName>
|
|
266
|
+
{/* <UserStatus>Status</UserStatus> */}
|
|
267
|
+
</UserInfo>
|
|
268
|
+
{!selectedUser && config?.translates?.enabled && (
|
|
269
|
+
<BorderedContainer>
|
|
270
|
+
<Select
|
|
271
|
+
options={LANGUAGE_OPTIONS}
|
|
272
|
+
placeholder={'Select your language'}
|
|
273
|
+
onSelect={handleSelect}
|
|
274
|
+
accentColor={config?.colors?.primary}
|
|
275
|
+
selectedValue={findLanguage()}
|
|
276
|
+
/>
|
|
277
|
+
</BorderedContainer>
|
|
278
|
+
)}
|
|
279
|
+
<BorderedContainer>
|
|
280
|
+
<Label>About</Label>
|
|
281
|
+
<LabelData>
|
|
282
|
+
{modalUser?.description && modalUser?.description?.length > 4
|
|
283
|
+
? modalUser.description
|
|
284
|
+
: 'No description'}
|
|
285
|
+
</LabelData>
|
|
286
|
+
</BorderedContainer>
|
|
287
|
+
|
|
288
|
+
{selectedUser && !config?.disableMemberProfileActions && (
|
|
289
|
+
<>
|
|
290
|
+
{!config?.hideMemberSendMessageAction && (
|
|
291
|
+
<ActionButton
|
|
292
|
+
StartIcon={<ChatIcon />}
|
|
293
|
+
onPress={handlePrivateMessage}
|
|
294
|
+
variant="filled"
|
|
295
|
+
>
|
|
296
|
+
<Text style={{ color: '#ffffff' }}>Message</Text>
|
|
297
|
+
</ActionButton>
|
|
298
|
+
)}
|
|
299
|
+
{!config?.hideMemberCopyIdAction && (
|
|
300
|
+
<ActionButton
|
|
301
|
+
onPress={() => {}}
|
|
302
|
+
// onPress={() => handleCopyClick(selectedUser.id)}
|
|
303
|
+
variant="filled"
|
|
304
|
+
>
|
|
305
|
+
<Text style={{ color: '#ffffff' }}>Copy User Id</Text>
|
|
306
|
+
</ActionButton>
|
|
307
|
+
)}
|
|
308
|
+
</>
|
|
309
|
+
)}
|
|
507
310
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
getElementFont(config, 'profileSectionLabel'),
|
|
514
|
-
]}
|
|
311
|
+
<BorderedContainer>
|
|
312
|
+
<ScrollView
|
|
313
|
+
style={{ maxHeight: 400 }}
|
|
314
|
+
showsVerticalScrollIndicator={true}
|
|
315
|
+
nestedScrollEnabled={true}
|
|
515
316
|
>
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
<Text
|
|
548
|
-
style={[
|
|
549
|
-
styles.tabLabel,
|
|
550
|
-
active && { color: getIconColor(config) },
|
|
551
|
-
]}
|
|
552
|
-
>
|
|
553
|
-
{t(`modal.profile.${tab}`)}
|
|
554
|
-
</Text>
|
|
555
|
-
{count > 0 && (
|
|
556
|
-
<View
|
|
557
|
-
style={[
|
|
558
|
-
styles.tabBadge,
|
|
559
|
-
{ backgroundColor: getIconColor(config) },
|
|
560
|
-
]}
|
|
561
|
-
>
|
|
562
|
-
<Text style={styles.tabBadgeText}>{count}</Text>
|
|
563
|
-
</View>
|
|
564
|
-
)}
|
|
565
|
-
</TouchableOpacity>
|
|
566
|
-
);
|
|
567
|
-
})}
|
|
317
|
+
{documents.map((doc) => (
|
|
318
|
+
<View
|
|
319
|
+
key={doc._id}
|
|
320
|
+
style={{
|
|
321
|
+
flexDirection: 'row',
|
|
322
|
+
alignItems: 'center',
|
|
323
|
+
justifyContent: 'space-between',
|
|
324
|
+
gap: 24,
|
|
325
|
+
backgroundColor: '#F3F6FC',
|
|
326
|
+
marginBottom: 8,
|
|
327
|
+
paddingVertical: 8,
|
|
328
|
+
paddingHorizontal: 16,
|
|
329
|
+
borderRadius: 8,
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
<View style={{
|
|
333
|
+
flexDirection: 'row',
|
|
334
|
+
alignItems: 'center',
|
|
335
|
+
gap: 24,
|
|
336
|
+
}}>
|
|
337
|
+
<View><IconDoc/></View>
|
|
338
|
+
<View>
|
|
339
|
+
<Label style={{ paddingBottom: 4 }}>{doc.documentName}</Label>
|
|
340
|
+
<LabelData>
|
|
341
|
+
{new Date(doc.createdAt).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) + ' ' + new Date(doc.createdAt).toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' })}
|
|
342
|
+
</LabelData>
|
|
343
|
+
</View>
|
|
344
|
+
</View>
|
|
345
|
+
<Button onPress={() => showDeleteModal(doc._id)}>
|
|
346
|
+
<DeleteIcon/>
|
|
347
|
+
</Button>
|
|
568
348
|
</View>
|
|
569
|
-
|
|
570
|
-
</
|
|
571
|
-
|
|
349
|
+
))}
|
|
350
|
+
</ScrollView>
|
|
351
|
+
</BorderedContainer>
|
|
572
352
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
titleStyle={chatTextStyle(config?.typography?.profile?.screenTitle)}
|
|
588
|
-
menu={<ProfileMenu testIDPrefix={PREFIX} items={menuItems} />}
|
|
353
|
+
|
|
354
|
+
{/* <EmptySection /> */}
|
|
355
|
+
</CenterContainer>
|
|
356
|
+
</>
|
|
357
|
+
),
|
|
358
|
+
[modalUser, documents]
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
const EditingBody = useMemo(
|
|
362
|
+
() => (
|
|
363
|
+
<EditUserModal
|
|
364
|
+
setIsEditing={setIsEditing}
|
|
365
|
+
modalUser={modalUser}
|
|
366
|
+
config={config}
|
|
589
367
|
/>
|
|
590
|
-
|
|
368
|
+
),
|
|
369
|
+
[modalUser]
|
|
591
370
|
);
|
|
592
|
-
};
|
|
593
371
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
backgroundColor: 'rgba(0,0,0,0.35)',
|
|
637
|
-
},
|
|
638
|
-
leaveLabel: {
|
|
639
|
-
color: '#FFFFFF',
|
|
640
|
-
fontSize: 14,
|
|
641
|
-
fontWeight: '500',
|
|
642
|
-
},
|
|
643
|
-
tabsRow: {
|
|
644
|
-
flexDirection: 'row',
|
|
645
|
-
gap: 20,
|
|
646
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
647
|
-
borderBottomColor: '#EFEFF2',
|
|
648
|
-
marginBottom: 12,
|
|
649
|
-
},
|
|
650
|
-
tab: {
|
|
651
|
-
flexDirection: 'row',
|
|
652
|
-
alignItems: 'center',
|
|
653
|
-
gap: 6,
|
|
654
|
-
paddingBottom: 10,
|
|
655
|
-
borderBottomWidth: 2,
|
|
656
|
-
borderBottomColor: 'transparent',
|
|
657
|
-
},
|
|
658
|
-
tabLabel: {
|
|
659
|
-
fontSize: 15,
|
|
660
|
-
fontWeight: '500',
|
|
661
|
-
color: '#8C8C8C',
|
|
662
|
-
},
|
|
663
|
-
tabBadge: {
|
|
664
|
-
minWidth: 20,
|
|
665
|
-
paddingHorizontal: 5,
|
|
666
|
-
paddingVertical: 1,
|
|
667
|
-
borderRadius: 10,
|
|
668
|
-
alignItems: 'center',
|
|
669
|
-
},
|
|
670
|
-
tabBadgeText: {
|
|
671
|
-
color: '#FFFFFF',
|
|
672
|
-
fontSize: 11,
|
|
673
|
-
fontWeight: '600',
|
|
674
|
-
},
|
|
675
|
-
languageRow: {
|
|
676
|
-
flexDirection: 'row',
|
|
677
|
-
alignItems: 'center',
|
|
678
|
-
justifyContent: 'space-between',
|
|
679
|
-
paddingVertical: 12,
|
|
680
|
-
},
|
|
681
|
-
languageLabel: {
|
|
682
|
-
fontSize: 16,
|
|
683
|
-
color: '#141414',
|
|
684
|
-
},
|
|
685
|
-
check: {
|
|
686
|
-
fontSize: 16,
|
|
687
|
-
fontWeight: '700',
|
|
688
|
-
},
|
|
689
|
-
mediaGrid: {
|
|
690
|
-
flexDirection: 'row',
|
|
691
|
-
flexWrap: 'wrap',
|
|
692
|
-
gap: 6,
|
|
693
|
-
},
|
|
694
|
-
mediaTile: {
|
|
695
|
-
width: '31.8%',
|
|
696
|
-
aspectRatio: 1,
|
|
697
|
-
borderRadius: 10,
|
|
698
|
-
overflow: 'hidden',
|
|
699
|
-
backgroundColor: '#EFEFF2',
|
|
700
|
-
},
|
|
701
|
-
mediaImage: {
|
|
702
|
-
width: '100%',
|
|
703
|
-
height: '100%',
|
|
704
|
-
},
|
|
705
|
-
documentRow: {
|
|
706
|
-
flexDirection: 'row',
|
|
707
|
-
alignItems: 'center',
|
|
708
|
-
gap: 14,
|
|
709
|
-
paddingVertical: 12,
|
|
710
|
-
},
|
|
711
|
-
documentText: {
|
|
712
|
-
flex: 1,
|
|
713
|
-
},
|
|
714
|
-
documentName: {
|
|
715
|
-
fontSize: 16,
|
|
716
|
-
color: '#141414',
|
|
717
|
-
},
|
|
718
|
-
documentDate: {
|
|
719
|
-
fontSize: 13,
|
|
720
|
-
color: '#8C8C8C',
|
|
721
|
-
marginTop: 2,
|
|
722
|
-
},
|
|
723
|
-
});
|
|
372
|
+
return (
|
|
373
|
+
<>
|
|
374
|
+
<ModalContainerFullScreen>
|
|
375
|
+
{!isEditing ? DefaultBody : EditingBody}
|
|
376
|
+
</ModalContainerFullScreen>
|
|
377
|
+
|
|
378
|
+
{showDelete && (
|
|
379
|
+
<ModalBackground style={{ position: 'absolute', zIndex: 9999 }}>
|
|
380
|
+
<ModalContainer>
|
|
381
|
+
<CloseButton onPress={() => setShowDelete(false)}>
|
|
382
|
+
<Text style={{ fontSize: 24 }}>×</Text>
|
|
383
|
+
</CloseButton>
|
|
384
|
+
<ModalTitle>Delete this document?</ModalTitle>
|
|
385
|
+
|
|
386
|
+
<GroupContainer>
|
|
387
|
+
<Button
|
|
388
|
+
onPress={() => setShowDelete(false)}
|
|
389
|
+
text={'Cancel'}
|
|
390
|
+
style={{ width: '100%' }}
|
|
391
|
+
unstyled
|
|
392
|
+
variant="filled"
|
|
393
|
+
color="white"
|
|
394
|
+
/>
|
|
395
|
+
<Button
|
|
396
|
+
onPress={handleDeleteDocument}
|
|
397
|
+
text={'Delete'}
|
|
398
|
+
style={{
|
|
399
|
+
width: '100%',
|
|
400
|
+
borderWidth: 1,
|
|
401
|
+
borderColor: 'red',
|
|
402
|
+
}}
|
|
403
|
+
color="red"
|
|
404
|
+
unstyled
|
|
405
|
+
variant="outlined"
|
|
406
|
+
/>
|
|
407
|
+
</GroupContainer>
|
|
408
|
+
</ModalContainer>
|
|
409
|
+
</ModalBackground>
|
|
410
|
+
)}
|
|
411
|
+
</>
|
|
412
|
+
);
|
|
413
|
+
};
|
|
724
414
|
|
|
725
415
|
export default UserProfileModal;
|