@ethora/chat-component-rn 26.4.1
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/LICENSE +661 -0
- package/README.md +148 -0
- package/empty-shim.js +15 -0
- package/index.js +13 -0
- package/metro.js +72 -0
- package/package.json +99 -0
- package/src/api.config.ts +34 -0
- package/src/assets/BG.png +0 -0
- package/src/assets/BG.tsx +56 -0
- package/src/assets/File.svg +4 -0
- package/src/assets/ForzaCare.png +0 -0
- package/src/assets/ForzaCare.tsx +27 -0
- package/src/assets/icons.tsx +685 -0
- package/src/assets/images.tsx +41 -0
- package/src/assets/test.xml +243 -0
- package/src/components/AuthForms/Login.tsx +295 -0
- package/src/components/AuthForms/LoginAnonym.tsx +68 -0
- package/src/components/AuthForms/Register.tsx +8 -0
- package/src/components/ContextMenu/ContextMenuComponents.tsx +87 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +244 -0
- package/src/components/ExampleComponents/CustomMessage.tsx +92 -0
- package/src/components/ExampleComponents/CustomTypingIndicatorExamples.tsx +239 -0
- package/src/components/Header/HeaderRoomList.tsx +104 -0
- package/src/components/InputComponents/AudioInput.tsx +24 -0
- package/src/components/InputComponents/AudioRecorder.tsx +100 -0
- package/src/components/InputComponents/MediaInput.tsx +114 -0
- package/src/components/InputComponents/RecordingIndicator.tsx +77 -0
- package/src/components/InputComponents/Search.tsx +135 -0
- package/src/components/InputComponents/TextInput.tsx +66 -0
- package/src/components/MainComponents/ChatHeader.tsx +163 -0
- package/src/components/MainComponents/ChatRoom.tsx +392 -0
- package/src/components/MainComponents/ChatWrapper.tsx +318 -0
- package/src/components/MainComponents/ChooseChatMessage.tsx +44 -0
- package/src/components/MainComponents/ConnectionBanner.tsx +33 -0
- package/src/components/MainComponents/EditWrapper.tsx +72 -0
- package/src/components/MainComponents/LoginWrapper.tsx +134 -0
- package/src/components/MainComponents/MediaMessage.tsx +55 -0
- package/src/components/MainComponents/MessageContainer.tsx +122 -0
- package/src/components/MainComponents/MessageList.tsx +429 -0
- package/src/components/MainComponents/NoMessagesPlaceholder.tsx +49 -0
- package/src/components/MainComponents/ProfileImagePlaceholder.tsx +143 -0
- package/src/components/MainComponents/RNStyled.tsx +34 -0
- package/src/components/MainComponents/ReduxWrapper.tsx +40 -0
- package/src/components/MainComponents/RoomList.tsx +246 -0
- package/src/components/MainComponents/Select.tsx +165 -0
- package/src/components/MainComponents/Switch.tsx +73 -0
- package/src/components/MainComponents/SystemMessage.tsx +42 -0
- package/src/components/Menu/HeaderRoomListMenu.tsx +169 -0
- package/src/components/MenuRoom/MenuRoom.tsx +46 -0
- package/src/components/MessageBubble/Avatar.tsx +84 -0
- package/src/components/MessageBubble/BottomReplyContainer.tsx +117 -0
- package/src/components/MessageBubble/CustomDivider.tsx +10 -0
- package/src/components/MessageBubble/DeletedMessage.tsx +36 -0
- package/src/components/MessageBubble/Message.tsx +400 -0
- package/src/components/MessageBubble/MessageInteractions.tsx +247 -0
- package/src/components/MessageBubble/MessageReaction.tsx +149 -0
- package/src/components/MessageBubble/MessageReply.tsx +50 -0
- package/src/components/MessageBubble/MessageTranslations.tsx +30 -0
- package/src/components/Modals/AddMembersModal/AddMembersModal.tsx +142 -0
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +471 -0
- package/src/components/Modals/ChatProfileModal/DeleteChatModal.tsx +91 -0
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +298 -0
- package/src/components/Modals/Modal/Modal.tsx +52 -0
- package/src/components/Modals/ModalHeaderComponent.tsx +41 -0
- package/src/components/Modals/ModalSelectMedia/ModalSelectMedia.tsx +285 -0
- package/src/components/Modals/ModalWrapper/ModalWrapper.tsx +103 -0
- package/src/components/Modals/NewChatModal/ModalContent.tsx +151 -0
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +391 -0
- package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +136 -0
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +134 -0
- package/src/components/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.tsx +63 -0
- package/src/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.tsx +115 -0
- package/src/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.tsx +121 -0
- package/src/components/Modals/SettingsModals/ManageDataModal/StyledComponents.ts +0 -0
- package/src/components/Modals/SettingsModals/ProfileShares/ProfileShares.tsx +65 -0
- package/src/components/Modals/SettingsModals/Referrals/Referrals.tsx +90 -0
- package/src/components/Modals/SettingsModals/SharedStyledComponents.ts +74 -0
- package/src/components/Modals/SettingsModals/Visibility/RadioInput.tsx +59 -0
- package/src/components/Modals/SettingsModals/Visibility/StyledComponents.ts +32 -0
- package/src/components/Modals/SettingsModals/Visibility/VisibilityModal.tsx +146 -0
- package/src/components/Modals/UserProfileModal/EditUserModal.tsx +163 -0
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +410 -0
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +85 -0
- package/src/components/Modals/styledModalComponents.tsx +181 -0
- package/src/components/OperationalModal/OperationalModal.tsx +78 -0
- package/src/components/RoomComponents/ChatRoomItem.tsx +219 -0
- package/src/components/RoomComponents/LastMessageItem.tsx +47 -0
- package/src/components/RoomComponents/styled/LastAudioMessage.tsx +62 -0
- package/src/components/RoomComponents/styled/LastMessageEmoji.tsx +26 -0
- package/src/components/RoomComponents/styled/LastMessageFile.tsx +54 -0
- package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +54 -0
- package/src/components/RoomComponents/styled/LastMessageVideo.tsx +70 -0
- package/src/components/RoomComponents/styled/LastTextMessage.tsx +65 -0
- package/src/components/RoomComponents/styled/StyledRoomComponents.ts +53 -0
- package/src/components/SortDropDown/index.tsx +76 -0
- package/src/components/Thread/ThreadHeader.tsx +41 -0
- package/src/components/Thread/ThreadWrapper.tsx +270 -0
- package/src/components/Toast/Toast.tsx +128 -0
- package/src/components/Toast/index.ts +13 -0
- package/src/components/UsersList/StyledComponents.ts +30 -0
- package/src/components/UsersList/UsersList.tsx +112 -0
- package/src/components/styled/ActionButton.tsx +40 -0
- package/src/components/styled/AudioMessage.tsx +82 -0
- package/src/components/styled/Button.tsx +107 -0
- package/src/components/styled/ChatWrapperBox.tsx +9 -0
- package/src/components/styled/DateLabel.tsx +77 -0
- package/src/components/styled/Loader.tsx +65 -0
- package/src/components/styled/MediaFilePreview.tsx +42 -0
- package/src/components/styled/MediaModal.tsx +54 -0
- package/src/components/styled/MessageImage.tsx +54 -0
- package/src/components/styled/NewMessageLabel.tsx +50 -0
- package/src/components/styled/RoomListComponents/index.tsx +164 -0
- package/src/components/styled/SendInput.tsx +297 -0
- package/src/components/styled/StyledComponents.ts +320 -0
- package/src/components/styled/StyledInput.tsx +101 -0
- package/src/components/styled/StyledInputComponents/AudioComponents.tsx +1 -0
- package/src/components/styled/StyledInputComponents/Composing.tsx +97 -0
- package/src/components/styled/StyledInputComponents/CustomTypingIndicator.tsx +261 -0
- package/src/components/styled/StyledInputComponents/MediaComponents.tsx +90 -0
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +131 -0
- package/src/components/styled/StyledInputComponents/VideoComponents.tsx +49 -0
- package/src/components/styled/TreadLabel.tsx +50 -0
- package/src/components/styled/UnsupportedType.tsx +95 -0
- package/src/components/styled/VideoMessage.tsx +68 -0
- package/src/context/MessageNotificationContext.tsx +335 -0
- package/src/context/PushNotificationProvider.tsx +78 -0
- package/src/context/ToastContext.tsx +63 -0
- package/src/context/toastProvider.tsx +0 -0
- package/src/context/xmppProvider.tsx +364 -0
- package/src/helpers/block_scroll.ts +95 -0
- package/src/helpers/chatAutoEnterer.ts +46 -0
- package/src/helpers/checkUniqueUsers.tsx +31 -0
- package/src/helpers/constants/CHAT_TYPES.ts +6 -0
- package/src/helpers/constants/LANGUAGE_OPTIONS.ts +14 -0
- package/src/helpers/constants/LOCAL_STORAGE.ts +3 -0
- package/src/helpers/constants/MESSAGE_INTERACTIONS.ts +29 -0
- package/src/helpers/constants/MODAL_TYPES.ts +57 -0
- package/src/helpers/constants/PLATFORM_CONSTANTS.ts +3 -0
- package/src/helpers/createMainMessageForThread.ts +23 -0
- package/src/helpers/createMessageFromXml.ts +118 -0
- package/src/helpers/createRoomFromApi.tsx +27 -0
- package/src/helpers/createUserNameFromSetUser.ts +15 -0
- package/src/helpers/dateComparison.ts +12 -0
- package/src/helpers/debounce.ts +10 -0
- package/src/helpers/ensureScopedChatCache.ts +61 -0
- package/src/helpers/extractUniqueMembersFromRooms.ts +45 -0
- package/src/helpers/formatNumberWithCommas.ts +3 -0
- package/src/helpers/getBooleanFromString.ts +7 -0
- package/src/helpers/getDataFromXml.ts +80 -0
- package/src/helpers/getNumberFromString.ts +5 -0
- package/src/helpers/getRoomsWithRetry.ts +45 -0
- package/src/helpers/getTintedColor.ts +28 -0
- package/src/helpers/getUnnamedUsers.ts +39 -0
- package/src/helpers/handleCopyClick.ts +3 -0
- package/src/helpers/handleXmppError.ts +14 -0
- package/src/helpers/hashcolor.ts +34 -0
- package/src/helpers/historyPreloadScheduler.ts +264 -0
- package/src/helpers/initRoomsPresence.ts +32 -0
- package/src/helpers/initXmppRooms.tsx +71 -0
- package/src/helpers/insertMessageWithDelimiter.ts +96 -0
- package/src/helpers/isChatIdPresentInArray.ts +54 -0
- package/src/helpers/localStorageUser.ts +9 -0
- package/src/helpers/markdownParser.tsx +295 -0
- package/src/helpers/nanoToMs.ts +3 -0
- package/src/helpers/parseMessageBody.tsx +516 -0
- package/src/helpers/parseUrls.tsx +42 -0
- package/src/helpers/resolveInitBeforeLoadUser.ts +240 -0
- package/src/helpers/storeConsole.ts +26 -0
- package/src/helpers/transformTranslatations.ts +16 -0
- package/src/helpers/updateMessagesTillLast.tsx +104 -0
- package/src/helpers/updatedChatLastTimestamps.ts +29 -0
- package/src/helpers/validator.ts +20 -0
- package/src/helpers/walletUsername.ts +12 -0
- package/src/hooks/hooks.ts +6 -0
- package/src/hooks/useChatSettingState.tsx +38 -0
- package/src/hooks/useChatWrapperInit.ts +266 -0
- package/src/hooks/useComposing.tsx +59 -0
- package/src/hooks/useCustomTypingIndicator.tsx +193 -0
- package/src/hooks/useEventHandlers.tsx +81 -0
- package/src/hooks/useGetNewArchRoom.tsx +57 -0
- package/src/hooks/useHeapSender.tsx +88 -0
- package/src/hooks/useLocalStorage.tsx +53 -0
- package/src/hooks/useLogout.tsx +31 -0
- package/src/hooks/useMessageHeapState.tsx +11 -0
- package/src/hooks/useMessageLoaderQueue.tsx +90 -0
- package/src/hooks/useMessageQueue.ts +146 -0
- package/src/hooks/usePendingNotification.ts +49 -0
- package/src/hooks/usePrevious.tsx +15 -0
- package/src/hooks/usePushNotifications.ts +106 -0
- package/src/hooks/useQRCodeChatHandler.ts +58 -0
- package/src/hooks/useRoomInitialization.tsx +160 -0
- package/src/hooks/useRoomState.tsx +47 -0
- package/src/hooks/useRoomUrl.tsx +41 -0
- package/src/hooks/useSendMessage.tsx +306 -0
- package/src/hooks/useUnreadMessagesCounter.ts +55 -0
- package/src/hooks/useXmppInitialization.ts +148 -0
- package/src/main.ts +45 -0
- package/src/networking/api-requests/auth.api.ts +140 -0
- package/src/networking/api-requests/push.api.ts +55 -0
- package/src/networking/api-requests/roomMembers.api.ts +20 -0
- package/src/networking/api-requests/rooms.api.ts +142 -0
- package/src/networking/api-requests/user.api.ts +65 -0
- package/src/networking/apiClient.ts +149 -0
- package/src/networking/helpers/refreshChecker.ts +13 -0
- package/src/networking/stanzaHandlers.ts +418 -0
- package/src/networking/xmpp/actionSetTimestampToPrivateStore.xmpp.ts +37 -0
- package/src/networking/xmpp/allRoomPresences.xmpp.ts +10 -0
- package/src/networking/xmpp/createPrivateRoom.xmpp.ts +26 -0
- package/src/networking/xmpp/createRoom.xmpp.ts +35 -0
- package/src/networking/xmpp/createRoomPresence.xmpp.ts +74 -0
- package/src/networking/xmpp/createTimeoutPromise.xmpp.ts +15 -0
- package/src/networking/xmpp/deleteMessage.xmpp.ts +19 -0
- package/src/networking/xmpp/editMessage.xmpp.ts +46 -0
- package/src/networking/xmpp/getChatsPrivateStoreRequest.xmpp.ts +57 -0
- package/src/networking/xmpp/getHistory.xmpp.ts +140 -0
- package/src/networking/xmpp/getLastMessageArchive.xmpp.ts +24 -0
- package/src/networking/xmpp/getRoomInfo.xmpp.ts +15 -0
- package/src/networking/xmpp/getRoomMembers.xmpp.ts +13 -0
- package/src/networking/xmpp/getRooms.xmpp.ts +43 -0
- package/src/networking/xmpp/getRoomsPaged.xmpp.ts +59 -0
- package/src/networking/xmpp/handlePong.xmpp.ts +7 -0
- package/src/networking/xmpp/handleStanzas.xmpp.ts +55 -0
- package/src/networking/xmpp/inviteRoomRequest.xmpp.ts +25 -0
- package/src/networking/xmpp/leaveTheRoom.xmpp.ts +15 -0
- package/src/networking/xmpp/listenerManager.ts +116 -0
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +57 -0
- package/src/networking/xmpp/roomConfig.xmpp.ts +71 -0
- package/src/networking/xmpp/sendMediaMessage.xmpp.ts +97 -0
- package/src/networking/xmpp/sendMessageReaction.xmpp.ts +41 -0
- package/src/networking/xmpp/sendPing.xmpp.ts +21 -0
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +99 -0
- package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +44 -0
- package/src/networking/xmpp/sendTypingRequest.xmpp.ts +26 -0
- package/src/networking/xmpp/setChatsPrivateStoreRequest.xmpp.ts +48 -0
- package/src/networking/xmpp/setMeAsOwner.xmpp.ts +52 -0
- package/src/networking/xmpp/setRoomImage.xmpp.ts +26 -0
- package/src/networking/xmpp/setVCard.xmpp.ts +19 -0
- package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +75 -0
- package/src/networking/xmppClient.ts +603 -0
- package/src/roomStore/Middleware/logoutMiddleware.tsx +24 -0
- package/src/roomStore/Middleware/newMessageMidlleware.tsx +87 -0
- package/src/roomStore/Middleware/reactionsMiddleware.tsx +77 -0
- package/src/roomStore/Middleware/testMiddleware.tsx +20 -0
- package/src/roomStore/Middleware/unreadMidlleware.tsx +58 -0
- package/src/roomStore/chatSettingsSlice.ts +178 -0
- package/src/roomStore/index.ts +68 -0
- package/src/roomStore/persistence.ts +152 -0
- package/src/roomStore/roomHeapSlice.ts +37 -0
- package/src/roomStore/roomsSlice.ts +353 -0
- package/src/services/pushNotifications.ts +170 -0
- package/src/services/pushSubscriptionService.ts +145 -0
- package/src/types/messages.ts +61 -0
- package/src/types/models/action.model.ts +30 -0
- package/src/types/models/config.model.ts +16 -0
- package/src/types/models/customComponents.model.ts +53 -0
- package/src/types/models/language.model.ts +11 -0
- package/src/types/models/media.model.ts +5 -0
- package/src/types/models/message.model.ts +69 -0
- package/src/types/models/modal.model.ts +9 -0
- package/src/types/models/room.model.ts +120 -0
- package/src/types/models/user.model.ts +90 -0
- package/src/types/models/xmpp.model.ts +155 -0
- package/src/types/types.ts +505 -0
- package/src/utils/PriorityQueue.ts +47 -0
- package/src/utils/actionHelpers.ts +40 -0
- package/src/utils/actionLogger.ts +64 -0
- package/src/utils/clientRegistry.ts +80 -0
- package/src/utils/devLogger.ts +197 -0
- package/src/utils/messageNotificationManager.ts +108 -0
- package/src/utils/resendMessage.ts +87 -0
- package/src/utils/toastEmitter.ts +27 -0
- package/src/utils/xmppMemoryMonitor.ts +63 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ModalContainerFullScreen,
|
|
5
|
+
Viewider,
|
|
6
|
+
Label,
|
|
7
|
+
LabelData,
|
|
8
|
+
BorderedContainer,
|
|
9
|
+
CenterContainer,
|
|
10
|
+
} from '../../styledModalComponents';
|
|
11
|
+
import ModalHeaderComponent from '../../ModalHeaderComponent';
|
|
12
|
+
import Button from '../../../styled/Button';
|
|
13
|
+
import { ReferalsIcon, SendCoinIcon } from '../../../../assets/icons';
|
|
14
|
+
import {
|
|
15
|
+
RowWrapper,
|
|
16
|
+
SharedSettingsColumnContainer,
|
|
17
|
+
SharedSettingsStyledLabel,
|
|
18
|
+
} from '../SharedStyledComponents';
|
|
19
|
+
import InputWithLabel from '../../../styled/StyledInput';
|
|
20
|
+
import { StyledInput } from '../../../styled/StyledInputComponents/StyledInputComponents';
|
|
21
|
+
import { useSelector } from 'react-redux';
|
|
22
|
+
import { RootState } from '../../../../roomStore';
|
|
23
|
+
import { View, Text } from 'react-native';
|
|
24
|
+
import Animated from 'react-native-reanimated';
|
|
25
|
+
|
|
26
|
+
interface ReferralsModalProps {
|
|
27
|
+
handleCloseModal: any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const ReferralsModal: React.FC<ReferralsModalProps> = ({
|
|
31
|
+
handleCloseModal,
|
|
32
|
+
}) => {
|
|
33
|
+
const { config } = useSelector((state: RootState) => state.chatSettingStore);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<ModalContainerFullScreen>
|
|
37
|
+
<ModalHeaderComponent
|
|
38
|
+
handleCloseModal={handleCloseModal}
|
|
39
|
+
headerTitle={'Referrals'}
|
|
40
|
+
/>
|
|
41
|
+
<CenterContainer>
|
|
42
|
+
<ReferalsIcon />
|
|
43
|
+
<Animated.View>
|
|
44
|
+
<SharedSettingsStyledLabel>Gift friends 25</SharedSettingsStyledLabel>
|
|
45
|
+
<SendCoinIcon style={{ width: 24, height: 24 }} />
|
|
46
|
+
<SharedSettingsStyledLabel>and receive 25</SharedSettingsStyledLabel>
|
|
47
|
+
<SendCoinIcon style={{ width: 24, height: 24 }} />
|
|
48
|
+
<Text>.</Text>
|
|
49
|
+
<SharedSettingsStyledLabel>
|
|
50
|
+
Send friends invite with your personal invitation code.
|
|
51
|
+
</SharedSettingsStyledLabel>
|
|
52
|
+
</Animated.View>
|
|
53
|
+
<SharedSettingsColumnContainer style={{ width: '100%' }}>
|
|
54
|
+
<SharedSettingsStyledLabel>
|
|
55
|
+
Your invitation code
|
|
56
|
+
</SharedSettingsStyledLabel>
|
|
57
|
+
<StyledInput
|
|
58
|
+
color={config?.colors?.primary || ''}
|
|
59
|
+
placeholder="Your invitation code"
|
|
60
|
+
// label={'About'}
|
|
61
|
+
// value={message}
|
|
62
|
+
// onChange={handleInputChange}
|
|
63
|
+
// onKeyDown={handleKeyDown}
|
|
64
|
+
// onFocus={handleFocus}
|
|
65
|
+
// onBlur={handleBlur}
|
|
66
|
+
// disabled={isLoading}
|
|
67
|
+
/>
|
|
68
|
+
</SharedSettingsColumnContainer>
|
|
69
|
+
<SharedSettingsColumnContainer style={{ width: '100%' }}>
|
|
70
|
+
<SharedSettingsStyledLabel>
|
|
71
|
+
Or enter your referral code to earn coins
|
|
72
|
+
</SharedSettingsStyledLabel>
|
|
73
|
+
<StyledInput
|
|
74
|
+
color={config?.colors?.primary}
|
|
75
|
+
placeholder="Your referral code"
|
|
76
|
+
// label={'About'}
|
|
77
|
+
// value={message}
|
|
78
|
+
// onChange={handleInputChange}
|
|
79
|
+
// onKeyDown={handleKeyDown}
|
|
80
|
+
// onFocus={handleFocus}
|
|
81
|
+
// onBlur={handleBlur}
|
|
82
|
+
// disabled={isLoading}
|
|
83
|
+
/>
|
|
84
|
+
</SharedSettingsColumnContainer>
|
|
85
|
+
</CenterContainer>
|
|
86
|
+
</ModalContainerFullScreen>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default ReferralsModal;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import styled from 'styled-components/native';
|
|
2
|
+
import {CenterContainer, Label} from '../styledModalComponents';
|
|
3
|
+
import Button from '../../styled/Button';
|
|
4
|
+
|
|
5
|
+
export const SharedSettingsCenterContainer = styled(CenterContainer)`
|
|
6
|
+
display: flex;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
align-items: flex-start;
|
|
9
|
+
gap: 32px;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export const SharedSettingsColumnContainer = styled.View`
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 16px;
|
|
16
|
+
width: 100%;
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export const SharedSettingsSectionContainer = styled.View`
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export const SharedSettingsStyledLabel = styled(Label)`
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
text-align: start;
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export const RowWrapper = styled.View`
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
gap: 4px;
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export const SharedSettingsLabelData = styled(Label)`
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
text-align: start;
|
|
42
|
+
color: #8c8c8c;
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export const SharedSettingsStyledButton = styled(Button)<{
|
|
46
|
+
borderColor: string;
|
|
47
|
+
}>`
|
|
48
|
+
min-height: 40px;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
gap: 2px;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
text-align: center;
|
|
55
|
+
width: 100%;
|
|
56
|
+
padding: 8px;
|
|
57
|
+
border: 1px solid ${({borderColor}) => borderColor};
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
export const SharedSettingsInfoPanel = styled.View<{bgColor: string | undefined}>`
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: flex-start;
|
|
63
|
+
background-color: ${({bgColor}) => bgColor};
|
|
64
|
+
padding: 16px;
|
|
65
|
+
border-radius: 8px;
|
|
66
|
+
gap: 8px;
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export const SharedSettingsInfoText = styled.Text`
|
|
70
|
+
font-size: 12px;
|
|
71
|
+
color: #141414;
|
|
72
|
+
display: flex;
|
|
73
|
+
text-align: start;
|
|
74
|
+
`;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface RadioInputProps {
|
|
5
|
+
option: { label: string; value?: boolean };
|
|
6
|
+
checked: boolean;
|
|
7
|
+
onChange: (value?: boolean) => void;
|
|
8
|
+
radioColor?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const RadioInput: React.FC<RadioInputProps> = ({
|
|
12
|
+
option,
|
|
13
|
+
checked,
|
|
14
|
+
onChange,
|
|
15
|
+
radioColor = '#0052CD',
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<View style={styles.container}>
|
|
19
|
+
<TouchableOpacity
|
|
20
|
+
key={option.label}
|
|
21
|
+
style={styles.radioContainer}
|
|
22
|
+
onPress={() => onChange(option.value)}
|
|
23
|
+
>
|
|
24
|
+
<View
|
|
25
|
+
style={[
|
|
26
|
+
styles.radioCircle,
|
|
27
|
+
{
|
|
28
|
+
borderColor: radioColor,
|
|
29
|
+
backgroundColor: checked ? radioColor : 'transparent',
|
|
30
|
+
},
|
|
31
|
+
]}
|
|
32
|
+
/>
|
|
33
|
+
<Text style={styles.radioLabel}>{option.label}</Text>
|
|
34
|
+
</TouchableOpacity>
|
|
35
|
+
</View>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
container: {
|
|
41
|
+
flexDirection: 'column',
|
|
42
|
+
},
|
|
43
|
+
radioContainer: {
|
|
44
|
+
flexDirection: 'row',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
marginBottom: 10,
|
|
47
|
+
},
|
|
48
|
+
radioCircle: {
|
|
49
|
+
width: 20,
|
|
50
|
+
height: 20,
|
|
51
|
+
borderRadius: 10,
|
|
52
|
+
borderWidth: 2,
|
|
53
|
+
marginRight: 10,
|
|
54
|
+
},
|
|
55
|
+
radioLabel: {
|
|
56
|
+
fontSize: 16,
|
|
57
|
+
color: '#333',
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import styled from 'styled-components/native';
|
|
2
|
+
|
|
3
|
+
export const Container = styled.View``;
|
|
4
|
+
|
|
5
|
+
export const Title = styled.View`
|
|
6
|
+
font-size: 16px;
|
|
7
|
+
font-weight: bold;
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export const Description = styled.View`
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
color: #6b7280;
|
|
13
|
+
margin-bottom: 32px;
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export const RadioGroup = styled.View`
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: 6px;
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export const RadioLabel = styled.View`
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: start;
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
gap: 8px;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
// export const RadioInput = styled.input<{radioColor?: string}>`
|
|
30
|
+
// accent-color: ${({radioColor}) => radioColor || '#0052CD'};
|
|
31
|
+
// margin: 0px;
|
|
32
|
+
// `;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { RadioGroup, RadioLabel } from './StyledComponents';
|
|
3
|
+
import ModalHeaderComponent from '../../ModalHeaderComponent';
|
|
4
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
5
|
+
import { RootState } from '../../../../roomStore';
|
|
6
|
+
import { setUser } from '../../../../roomStore/chatSettingsSlice';
|
|
7
|
+
import { Notification } from '../../../Toast';
|
|
8
|
+
import { updateMe } from '../../../../networking/api-requests/user.api';
|
|
9
|
+
import { User } from '../../../../types/types';
|
|
10
|
+
import { ModalContainerFullScreen } from '../../styledModalComponents';
|
|
11
|
+
import {
|
|
12
|
+
SharedSettingsCenterContainer,
|
|
13
|
+
SharedSettingsColumnContainer,
|
|
14
|
+
SharedSettingsLabelData,
|
|
15
|
+
SharedSettingsStyledLabel,
|
|
16
|
+
} from '../SharedStyledComponents';
|
|
17
|
+
import { RadioInput } from './RadioInput';
|
|
18
|
+
|
|
19
|
+
interface VisibilityModalProps {
|
|
20
|
+
handleCloseModal: any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const VisibilityModal: React.FC<VisibilityModalProps> = ({
|
|
24
|
+
handleCloseModal,
|
|
25
|
+
}) => {
|
|
26
|
+
const dispatch = useDispatch();
|
|
27
|
+
const { user, config } = useSelector(
|
|
28
|
+
(state: RootState) => state.chatSettingStore
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const doUpdateUser = (user: User) => dispatch(setUser(user));
|
|
32
|
+
const [isProfileOpen, setIsProfileOpen] = useState(user?.isProfileOpen);
|
|
33
|
+
const [isAssetsOpen, setIsAssetsOpen] = useState(user?.isAssetsOpen);
|
|
34
|
+
const [notification, setNotification] = useState<{
|
|
35
|
+
message: string;
|
|
36
|
+
type: 'success' | 'error';
|
|
37
|
+
} | null>(null);
|
|
38
|
+
|
|
39
|
+
const showNotification = (message: string, type: 'success' | 'error') => {
|
|
40
|
+
setNotification({ message, type });
|
|
41
|
+
setTimeout(() => setNotification(null), 3000);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (isProfileOpen !== user.isProfileOpen) {
|
|
46
|
+
updateMe({ isProfileOpen })
|
|
47
|
+
.then(({ data }) => {
|
|
48
|
+
doUpdateUser(data.user);
|
|
49
|
+
showNotification('Saved', 'success');
|
|
50
|
+
})
|
|
51
|
+
.catch(() => showNotification('Error', 'error'));
|
|
52
|
+
}
|
|
53
|
+
}, [isProfileOpen]);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (isAssetsOpen !== user?.isAssetsOpen) {
|
|
57
|
+
updateMe({ isAssetsOpen })
|
|
58
|
+
.then(({ data }) => {
|
|
59
|
+
doUpdateUser(data.user);
|
|
60
|
+
showNotification('Saved', 'success');
|
|
61
|
+
})
|
|
62
|
+
.catch(() => showNotification('Error', 'error'));
|
|
63
|
+
}
|
|
64
|
+
}, [isAssetsOpen]);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<ModalContainerFullScreen>
|
|
68
|
+
<ModalHeaderComponent
|
|
69
|
+
handleCloseModal={handleCloseModal}
|
|
70
|
+
headerTitle={'Visibility'}
|
|
71
|
+
/>
|
|
72
|
+
<SharedSettingsCenterContainer>
|
|
73
|
+
<SharedSettingsColumnContainer>
|
|
74
|
+
<SharedSettingsStyledLabel>
|
|
75
|
+
Profile Visiblility
|
|
76
|
+
</SharedSettingsStyledLabel>
|
|
77
|
+
<RadioGroup>
|
|
78
|
+
<RadioLabel>
|
|
79
|
+
<RadioInput
|
|
80
|
+
option={{ label: 'Open (default)', value: isProfileOpen }}
|
|
81
|
+
radioColor={config?.colors?.primary}
|
|
82
|
+
checked={isProfileOpen === true}
|
|
83
|
+
onChange={() => setIsProfileOpen(true)}
|
|
84
|
+
/>
|
|
85
|
+
</RadioLabel>
|
|
86
|
+
|
|
87
|
+
<SharedSettingsLabelData>
|
|
88
|
+
Your profile can be viewed by anyone who follows your profile link
|
|
89
|
+
or QR code.
|
|
90
|
+
</SharedSettingsLabelData>
|
|
91
|
+
<RadioLabel>
|
|
92
|
+
<RadioInput
|
|
93
|
+
option={{ label: 'Restricted', value: isProfileOpen }}
|
|
94
|
+
radioColor={config?.colors?.primary}
|
|
95
|
+
checked={isProfileOpen === false}
|
|
96
|
+
onChange={() => setIsProfileOpen(false)}
|
|
97
|
+
/>
|
|
98
|
+
</RadioLabel>
|
|
99
|
+
<SharedSettingsLabelData>
|
|
100
|
+
Only users with your permission or temporary secure link can see
|
|
101
|
+
your profile.
|
|
102
|
+
</SharedSettingsLabelData>
|
|
103
|
+
</RadioGroup>
|
|
104
|
+
</SharedSettingsColumnContainer>
|
|
105
|
+
<SharedSettingsColumnContainer>
|
|
106
|
+
<SharedSettingsStyledLabel>
|
|
107
|
+
Documents Visibility
|
|
108
|
+
</SharedSettingsStyledLabel>
|
|
109
|
+
<RadioGroup>
|
|
110
|
+
<RadioLabel>
|
|
111
|
+
<RadioInput
|
|
112
|
+
option={{ label: 'Full (default)', value: isAssetsOpen }}
|
|
113
|
+
radioColor={config?.colors?.primary}
|
|
114
|
+
checked={isAssetsOpen === true}
|
|
115
|
+
onChange={() => setIsAssetsOpen(true)}
|
|
116
|
+
/>
|
|
117
|
+
</RadioLabel>
|
|
118
|
+
<SharedSettingsLabelData>
|
|
119
|
+
Show all Documents to those who can see your profile.
|
|
120
|
+
</SharedSettingsLabelData>
|
|
121
|
+
<RadioLabel>
|
|
122
|
+
<RadioInput
|
|
123
|
+
option={{ label: 'InViewidual', value: isAssetsOpen }}
|
|
124
|
+
radioColor={config?.colors?.primary}
|
|
125
|
+
checked={isAssetsOpen === false}
|
|
126
|
+
onChange={() => setIsAssetsOpen(false)}
|
|
127
|
+
/>
|
|
128
|
+
</RadioLabel>
|
|
129
|
+
<SharedSettingsLabelData>
|
|
130
|
+
You need to share each document inViewidually before others can
|
|
131
|
+
see them.
|
|
132
|
+
</SharedSettingsLabelData>
|
|
133
|
+
</RadioGroup>
|
|
134
|
+
</SharedSettingsColumnContainer>
|
|
135
|
+
</SharedSettingsCenterContainer>
|
|
136
|
+
|
|
137
|
+
{notification && (
|
|
138
|
+
<Notification type={notification.type}>
|
|
139
|
+
{notification.message}
|
|
140
|
+
</Notification>
|
|
141
|
+
)}
|
|
142
|
+
</ModalContainerFullScreen>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export default VisibilityModal;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { ProfileImagePlaceholder } from '../../MainComponents/ProfileImagePlaceholder';
|
|
3
|
+
import Button from '../../styled/Button';
|
|
4
|
+
import InputWithLabel from '../../styled/StyledInput';
|
|
5
|
+
import ModalHeaderComponent from '../ModalHeaderComponent';
|
|
6
|
+
import { CenterContainer } from '../styledModalComponents';
|
|
7
|
+
import { updateProfile } from '../../../networking/api-requests/user.api';
|
|
8
|
+
import { useDispatch } from 'react-redux';
|
|
9
|
+
import { updateUser } from '../../../roomStore/chatSettingsSlice';
|
|
10
|
+
import { View } from 'react-native';
|
|
11
|
+
import { AddPhotoIcon } from '../../../assets/icons';
|
|
12
|
+
// import { actionUpdateUser } from '../actions';
|
|
13
|
+
|
|
14
|
+
const base64ToFile = (base64String: string, fileName: string) => {
|
|
15
|
+
const byteString = atob(base64String.split(',')[1]);
|
|
16
|
+
const arrayBuffer = new ArrayBuffer(byteString.length);
|
|
17
|
+
const uintArray = new Uint8Array(arrayBuffer);
|
|
18
|
+
for (let i = 0; i < byteString.length; i++) {
|
|
19
|
+
uintArray[i] = byteString.charCodeAt(i);
|
|
20
|
+
}
|
|
21
|
+
const blob = new Blob([uintArray], { type: 'image/jpeg' });
|
|
22
|
+
return new File([blob], fileName, {
|
|
23
|
+
type: 'image/jpeg',
|
|
24
|
+
lastModified: Date.now(),
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
interface EditUserModalProps {
|
|
29
|
+
setIsEditing: React.Dispatch<React.SetStateAction<boolean>>;
|
|
30
|
+
modalUser: any;
|
|
31
|
+
config: any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const EditUserModal: React.FC<EditUserModalProps> = ({
|
|
35
|
+
setIsEditing,
|
|
36
|
+
modalUser,
|
|
37
|
+
config,
|
|
38
|
+
}) => {
|
|
39
|
+
const dispatch = useDispatch();
|
|
40
|
+
|
|
41
|
+
const [firstName, setFirstName] = useState(modalUser?.firstName || '');
|
|
42
|
+
const [lastName, setLastName] = useState(modalUser?.lastName || '');
|
|
43
|
+
const [description, setDescription] = useState(modalUser?.description || '');
|
|
44
|
+
const [profileImage, setProfileImage] = useState<string | File>(
|
|
45
|
+
modalUser?.profileImage
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const onSave = async () => {
|
|
49
|
+
try {
|
|
50
|
+
let fd = new FormData();
|
|
51
|
+
|
|
52
|
+
if (
|
|
53
|
+
typeof profileImage === 'string' &&
|
|
54
|
+
profileImage.startsWith('data:image/')
|
|
55
|
+
) {
|
|
56
|
+
const file = base64ToFile(profileImage, 'profileImage.jpg');
|
|
57
|
+
fd.append('file', file);
|
|
58
|
+
} else if (profileImage instanceof File) {
|
|
59
|
+
fd.append('file', profileImage);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
fd.append('firstName', firstName);
|
|
63
|
+
fd.append('lastName', lastName);
|
|
64
|
+
fd.append('description', description);
|
|
65
|
+
|
|
66
|
+
const { user } = await updateProfile(fd);
|
|
67
|
+
|
|
68
|
+
dispatch(
|
|
69
|
+
updateUser({
|
|
70
|
+
updates: {
|
|
71
|
+
firstName,
|
|
72
|
+
lastName,
|
|
73
|
+
description,
|
|
74
|
+
profileImage: user?.profileImage,
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
setIsEditing(false);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.log('error', error);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const handleProfileImageChange = (image: File) => {
|
|
86
|
+
setProfileImage(image);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<ModalHeaderComponent
|
|
92
|
+
// leftMenu={
|
|
93
|
+
// <Button
|
|
94
|
+
// onPress={() => setIsEditing(false)}
|
|
95
|
+
// style={{
|
|
96
|
+
// paddingVertical: 13,
|
|
97
|
+
// paddingHorizontal: 8,
|
|
98
|
+
// width: "100%",
|
|
99
|
+
// }}
|
|
100
|
+
// color="#00"
|
|
101
|
+
// >
|
|
102
|
+
// Cancel
|
|
103
|
+
// </Button>
|
|
104
|
+
// }
|
|
105
|
+
handleCloseModal={() => setIsEditing(false)}
|
|
106
|
+
rightMenu={
|
|
107
|
+
<Button
|
|
108
|
+
onPress={onSave}
|
|
109
|
+
variant="outlined"
|
|
110
|
+
style={{ width: 128 }}
|
|
111
|
+
color="#0052CD"
|
|
112
|
+
text="Save"
|
|
113
|
+
/>
|
|
114
|
+
}
|
|
115
|
+
/>
|
|
116
|
+
<CenterContainer>
|
|
117
|
+
<ProfileImagePlaceholder
|
|
118
|
+
icon={profileImage}
|
|
119
|
+
name={`${firstName} ${lastName}`}
|
|
120
|
+
size={120}
|
|
121
|
+
upload={{
|
|
122
|
+
onUpload: handleProfileImageChange,
|
|
123
|
+
active: true,
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
</CenterContainer>
|
|
127
|
+
<View
|
|
128
|
+
style={{
|
|
129
|
+
display: 'flex',
|
|
130
|
+
flexDirection: 'column',
|
|
131
|
+
gap: 32,
|
|
132
|
+
width: '100%',
|
|
133
|
+
justifyContent: 'center',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
<InputWithLabel
|
|
138
|
+
color={config?.colors?.primary}
|
|
139
|
+
placeholder="First Name"
|
|
140
|
+
label="First Name"
|
|
141
|
+
value={firstName}
|
|
142
|
+
onChangeText={(text: string) => setFirstName(text)}
|
|
143
|
+
/>
|
|
144
|
+
<InputWithLabel
|
|
145
|
+
color={config?.colors?.primary}
|
|
146
|
+
placeholder="Last Name"
|
|
147
|
+
label="Last Name"
|
|
148
|
+
value={lastName}
|
|
149
|
+
onChangeText={(text: string) => setLastName(text)}
|
|
150
|
+
/>
|
|
151
|
+
<InputWithLabel
|
|
152
|
+
color={config?.colors?.primary}
|
|
153
|
+
placeholder="About"
|
|
154
|
+
label="About"
|
|
155
|
+
value={description}
|
|
156
|
+
onChangeText={(text: string) => setDescription(text)}
|
|
157
|
+
/>
|
|
158
|
+
</View>
|
|
159
|
+
</>
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export default EditUserModal;
|