@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.
Files changed (288) hide show
  1. package/CHANGELOG.md +0 -54
  2. package/README.md +8 -31
  3. package/lib/commonjs/assets/icons.js +2 -7
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/Header/HeaderRoomList.js +6 -20
  6. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/ChatRoom.js +14 -36
  8. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/MessageList.js +23 -7
  10. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  12. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/RoomList.js +32 -62
  14. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  15. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +98 -309
  16. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  17. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +110 -320
  18. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  19. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +213 -552
  20. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  21. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
  22. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  23. package/lib/commonjs/components/Modals/Modal/Modal.js +0 -8
  24. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  25. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +1 -2
  26. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  27. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +104 -202
  28. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  29. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  30. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  31. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  32. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  33. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +21 -7
  34. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  35. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +244 -507
  36. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  37. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +46 -74
  38. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  39. package/lib/commonjs/components/Modals/styledModalComponents.js +2 -9
  40. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  41. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +7 -17
  42. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  43. package/lib/commonjs/components/styled/SendInput.js +11 -80
  44. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  45. package/lib/commonjs/components/styled/StyledComponents.js +3 -9
  46. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  47. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  48. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  49. package/lib/commonjs/context/xmppProvider.js +35 -6
  50. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  51. package/lib/commonjs/helpers/updateMessagesTillLast.js +40 -12
  52. package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
  53. package/lib/commonjs/hooks/useChatRoomFocus.js +9 -3
  54. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  55. package/lib/commonjs/hooks/useLogout.js +5 -0
  56. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  57. package/lib/commonjs/hooks/useSendMessage.js +50 -23
  58. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  59. package/lib/commonjs/i18n/strings.js +1 -121
  60. package/lib/commonjs/i18n/strings.js.map +1 -1
  61. package/lib/commonjs/main.js +0 -6
  62. package/lib/commonjs/main.js.map +1 -1
  63. package/lib/commonjs/networking/api-requests/user.api.js +0 -59
  64. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  65. package/lib/commonjs/networking/outboundQueue.js +18 -0
  66. package/lib/commonjs/networking/outboundQueue.js.map +1 -1
  67. package/lib/commonjs/networking/stanzaHandlers.js +10 -1
  68. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  69. package/lib/commonjs/networking/xmppClient.js +107 -7
  70. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  71. package/lib/commonjs/roomStore/chatSettingsSlice.js +1 -3
  72. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  73. package/lib/commonjs/roomStore/roomsSlice.js +22 -3
  74. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  75. package/lib/module/assets/icons.js +1 -6
  76. package/lib/module/assets/icons.js.map +1 -1
  77. package/lib/module/components/Header/HeaderRoomList.js +6 -20
  78. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  79. package/lib/module/components/MainComponents/ChatRoom.js +14 -36
  80. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  81. package/lib/module/components/MainComponents/MessageList.js +24 -8
  82. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  83. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  84. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  85. package/lib/module/components/MainComponents/RoomList.js +32 -62
  86. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  87. package/lib/module/components/Menu/HeaderRoomListMenu.js +101 -311
  88. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  89. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +113 -311
  90. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  91. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +217 -555
  92. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  93. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
  94. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  95. package/lib/module/components/Modals/Modal/Modal.js +1 -9
  96. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  97. package/lib/module/components/Modals/NewChatModal/ModalContent.js +1 -2
  98. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  99. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +106 -205
  100. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  101. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  102. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  103. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  104. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  105. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +23 -9
  106. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  107. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +248 -509
  108. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  109. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +48 -76
  110. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  111. package/lib/module/components/Modals/styledModalComponents.js +2 -9
  112. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  113. package/lib/module/components/RoomComponents/ChatRoomItem.js +7 -17
  114. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  115. package/lib/module/components/styled/SendInput.js +12 -81
  116. package/lib/module/components/styled/SendInput.js.map +1 -1
  117. package/lib/module/components/styled/StyledComponents.js +3 -9
  118. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  119. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  120. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  121. package/lib/module/context/xmppProvider.js +35 -6
  122. package/lib/module/context/xmppProvider.js.map +1 -1
  123. package/lib/module/helpers/updateMessagesTillLast.js +41 -13
  124. package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
  125. package/lib/module/hooks/useChatRoomFocus.js +9 -3
  126. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  127. package/lib/module/hooks/useLogout.js +5 -0
  128. package/lib/module/hooks/useLogout.js.map +1 -1
  129. package/lib/module/hooks/useSendMessage.js +51 -24
  130. package/lib/module/hooks/useSendMessage.js.map +1 -1
  131. package/lib/module/i18n/strings.js +1 -121
  132. package/lib/module/i18n/strings.js.map +1 -1
  133. package/lib/module/main.js +1 -1
  134. package/lib/module/main.js.map +1 -1
  135. package/lib/module/networking/api-requests/user.api.js +0 -56
  136. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  137. package/lib/module/networking/outboundQueue.js +17 -0
  138. package/lib/module/networking/outboundQueue.js.map +1 -1
  139. package/lib/module/networking/stanzaHandlers.js +10 -1
  140. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  141. package/lib/module/networking/xmppClient.js +107 -7
  142. package/lib/module/networking/xmppClient.js.map +1 -1
  143. package/lib/module/roomStore/chatSettingsSlice.js +1 -3
  144. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  145. package/lib/module/roomStore/roomsSlice.js +20 -2
  146. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  147. package/lib/typescript/assets/icons.d.ts +0 -16
  148. package/lib/typescript/assets/icons.d.ts.map +1 -1
  149. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  150. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  151. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  152. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  153. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  154. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +0 -3
  155. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  156. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +0 -9
  157. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  158. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +0 -10
  159. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  160. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  161. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  162. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +2 -4
  163. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  164. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  165. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  166. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  167. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +1 -6
  168. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  169. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  170. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +0 -16
  171. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  172. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +0 -1
  173. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  174. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  175. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  176. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  177. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  178. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  179. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  180. package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
  181. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  182. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  183. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  184. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  185. package/lib/typescript/main.d.ts +1 -1
  186. package/lib/typescript/main.d.ts.map +1 -1
  187. package/lib/typescript/networking/api-requests/user.api.d.ts +0 -27
  188. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  189. package/lib/typescript/networking/outboundQueue.d.ts +16 -0
  190. package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
  191. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  192. package/lib/typescript/networking/xmppClient.d.ts +33 -1
  193. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  194. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  195. package/lib/typescript/roomStore/roomsSlice.d.ts +18 -1
  196. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  197. package/lib/typescript/types/models/room.model.d.ts +15 -0
  198. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  199. package/lib/typescript/types/types.d.ts +20 -20
  200. package/lib/typescript/types/types.d.ts.map +1 -1
  201. package/package.json +1 -6
  202. package/src/assets/icons.tsx +9 -48
  203. package/src/components/Header/HeaderRoomList.tsx +5 -20
  204. package/src/components/MainComponents/ChatRoom.tsx +20 -38
  205. package/src/components/MainComponents/MessageList.tsx +24 -8
  206. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +14 -21
  207. package/src/components/MainComponents/RoomList.tsx +34 -65
  208. package/src/components/Menu/HeaderRoomListMenu.tsx +71 -310
  209. package/src/components/Modals/AttachSheet/AttachSheet.tsx +97 -331
  210. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +279 -598
  211. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +2 -4
  212. package/src/components/Modals/Modal/Modal.tsx +0 -7
  213. package/src/components/Modals/NewChatModal/ModalContent.tsx +3 -6
  214. package/src/components/Modals/NewChatModal/NewChatModal.tsx +117 -219
  215. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +1 -12
  216. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +4 -14
  217. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +25 -9
  218. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +307 -617
  219. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +58 -75
  220. package/src/components/Modals/styledModalComponents.tsx +2 -9
  221. package/src/components/RoomComponents/ChatRoomItem.tsx +7 -14
  222. package/src/components/styled/SendInput.tsx +12 -83
  223. package/src/components/styled/StyledComponents.ts +3 -9
  224. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +4 -11
  225. package/src/context/xmppProvider.tsx +41 -8
  226. package/src/helpers/updateMessagesTillLast.tsx +42 -17
  227. package/src/hooks/useChatRoomFocus.ts +11 -3
  228. package/src/hooks/useLogout.tsx +7 -0
  229. package/src/hooks/useSendMessage.tsx +60 -24
  230. package/src/i18n/strings.ts +1 -121
  231. package/src/main.ts +1 -1
  232. package/src/networking/api-requests/user.api.ts +0 -71
  233. package/src/networking/outboundQueue.ts +29 -0
  234. package/src/networking/stanzaHandlers.ts +9 -1
  235. package/src/networking/xmppClient.ts +118 -7
  236. package/src/roomStore/chatSettingsSlice.ts +1 -3
  237. package/src/roomStore/roomsSlice.ts +20 -2
  238. package/src/types/models/room.model.ts +15 -0
  239. package/src/types/types.ts +20 -22
  240. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +0 -226
  241. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  242. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +0 -556
  243. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  244. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +0 -210
  245. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  246. package/lib/commonjs/helpers/getChatBackground.js +0 -23
  247. package/lib/commonjs/helpers/getChatBackground.js.map +0 -1
  248. package/lib/commonjs/helpers/mediaLibraryRuntime.js +0 -31
  249. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +0 -1
  250. package/lib/commonjs/helpers/pickImageAsset.js +0 -68
  251. package/lib/commonjs/helpers/pickImageAsset.js.map +0 -1
  252. package/lib/commonjs/helpers/sheetGestures.js +0 -32
  253. package/lib/commonjs/helpers/sheetGestures.js.map +0 -1
  254. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +0 -223
  255. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  256. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +0 -548
  257. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  258. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +0 -205
  259. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  260. package/lib/module/helpers/getChatBackground.js +0 -18
  261. package/lib/module/helpers/getChatBackground.js.map +0 -1
  262. package/lib/module/helpers/mediaLibraryRuntime.js +0 -25
  263. package/lib/module/helpers/mediaLibraryRuntime.js.map +0 -1
  264. package/lib/module/helpers/pickImageAsset.js +0 -63
  265. package/lib/module/helpers/pickImageAsset.js.map +0 -1
  266. package/lib/module/helpers/sheetGestures.js +0 -26
  267. package/lib/module/helpers/sheetGestures.js.map +0 -1
  268. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +0 -9
  269. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +0 -1
  270. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +0 -75
  271. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +0 -1
  272. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +0 -25
  273. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +0 -1
  274. package/lib/typescript/helpers/getChatBackground.d.ts +0 -15
  275. package/lib/typescript/helpers/getChatBackground.d.ts.map +0 -1
  276. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +0 -3
  277. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +0 -1
  278. package/lib/typescript/helpers/pickImageAsset.d.ts +0 -27
  279. package/lib/typescript/helpers/pickImageAsset.d.ts.map +0 -1
  280. package/lib/typescript/helpers/sheetGestures.d.ts +0 -20
  281. package/lib/typescript/helpers/sheetGestures.d.ts.map +0 -1
  282. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +0 -244
  283. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +0 -615
  284. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +0 -217
  285. package/src/helpers/getChatBackground.ts +0 -18
  286. package/src/helpers/mediaLibraryRuntime.ts +0 -25
  287. package/src/helpers/pickImageAsset.ts +0 -68
  288. package/src/helpers/sheetGestures.ts +0 -25
@@ -1,98 +1,19 @@
1
- import React, { FC, useEffect, useMemo, useRef, useState } from 'react';
1
+ import React, { FC, useMemo } from 'react';
2
2
  import {
3
- Alert,
4
3
  Animated,
5
4
  Text,
6
5
  TouchableOpacity,
7
6
  TouchableWithoutFeedback,
8
7
  StyleSheet,
9
8
  Dimensions,
10
- Modal,
11
- PanResponder,
12
9
  View,
13
10
  } from 'react-native';
14
- import {
15
- AddNewIcon,
16
- LogoutIcon,
17
- ProfileIcon,
18
- SettingIcon,
19
- } from '../../assets/icons';
11
+ import { AddNewIcon, ProfileIcon, SettingIcon } from '../../assets/icons';
20
12
  import { useDispatch } from 'react-redux';
21
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
22
13
  import { setActiveModal } from '../../roomStore/chatSettingsSlice';
23
14
  import { MODAL_TYPES } from '../../helpers/constants/MODAL_TYPES';
24
- import { useChatSettingState } from '../../hooks/useChatSettingState';
25
- import { useLogout } from '../../hooks/useLogout';
26
- import {
27
- shouldClaimVerticalDrag,
28
- shouldDismissOnDrag,
29
- } from '../../helpers/sheetGestures';
30
- import type { IConfig } from '../../types/types';
31
-
32
- type LogoutConfig = NonNullable<IConfig['logout']>;
33
-
34
- const DEFAULT_LOGOUT_LABEL = 'Sign out';
35
-
36
- const confirmLogout = (
37
- confirm: LogoutConfig['confirm'],
38
- label: string
39
- ): Promise<boolean> => {
40
- if (confirm === false) {
41
- return Promise.resolve(true);
42
- }
43
- const copy = typeof confirm === 'object' && confirm ? confirm : {};
44
- return new Promise<boolean>((resolve) => {
45
- Alert.alert(
46
- copy.title ?? label,
47
- copy.message ?? 'Are you sure you want to sign out?',
48
- [
49
- {
50
- text: copy.cancelText ?? 'Cancel',
51
- style: 'cancel',
52
- onPress: () => resolve(false),
53
- },
54
- {
55
- text: copy.confirmText ?? label,
56
- style: 'destructive',
57
- onPress: () => resolve(true),
58
- },
59
- ],
60
- { cancelable: true, onDismiss: () => resolve(false) }
61
- );
62
- });
63
- };
64
-
65
- export const runLogoutFlow = async (
66
- logoutConfig: LogoutConfig,
67
- performLogout: () => Promise<void>
68
- ): Promise<void> => {
69
- const label = logoutConfig.label ?? DEFAULT_LOGOUT_LABEL;
70
- const confirmed = await confirmLogout(logoutConfig.confirm ?? true, label);
71
- if (!confirmed) {
72
- return;
73
- }
74
- if (logoutConfig.onBeforeLogout) {
75
- try {
76
- const proceed = await logoutConfig.onBeforeLogout();
77
- if (proceed === false) {
78
- return;
79
- }
80
- } catch (e) {
81
- console.warn('HeaderRoomListMenu: onBeforeLogout threw, logout cancelled', e);
82
- return;
83
- }
84
- }
85
- await performLogout(); // never rejects (see useLogout)
86
- if (logoutConfig.onAfterLogout) {
87
- try {
88
- await logoutConfig.onAfterLogout();
89
- } catch (e) {
90
- console.warn('HeaderRoomListMenu: onAfterLogout threw', e);
91
- }
92
- }
93
- };
94
15
 
95
- const { height: windowHeight } = Dimensions.get('window');
16
+ const { width } = Dimensions.get('window');
96
17
 
97
18
  interface HeaderRoomListMenuProps {
98
19
  isDrawerOpen: boolean;
@@ -108,119 +29,17 @@ export const HeaderRoomListMenu: FC<HeaderRoomListMenuProps> = ({
108
29
  closeDrawer,
109
30
  }) => {
110
31
  const dispatch = useDispatch();
111
- const { config } = useChatSettingState();
112
- const performLogout = useLogout();
113
- const logoutConfig = config?.logout?.enabled ? config.logout : undefined;
114
- const primaryColor = config?.colors?.primary ?? '#0052CD';
115
-
116
- const insets = useSafeAreaInsets();
117
- // Measured, so the sheet is exactly as tall as its rows and starts
118
- // fully off-screen no matter how many options the host enables.
119
- const [sheetHeight, setSheetHeight] = useState(windowHeight * 0.4);
120
- // Finger offset, layered on top of the open/close animation the parent
121
- // drives. Reset once the sheet is unmounted, so a swipe-dismissed sheet
122
- // never snaps back into view on its way out.
123
- const dragY = useRef(new Animated.Value(0)).current;
124
- const sheetHeightRef = useRef(sheetHeight);
125
- sheetHeightRef.current = sheetHeight;
126
32
 
127
- // closeDrawer is a fresh function each render; the responder is built
128
- // once, so it reads the current one through a ref rather than the one it
129
- // closed over on mount.
130
- const closeDrawerRef = useRef(closeDrawer);
131
- closeDrawerRef.current = closeDrawer;
132
-
133
- useEffect(() => {
134
- if (!isDrawerOpen) {
135
- dragY.setValue(0);
136
- return;
137
- }
138
- // Hand `dragY` to the native driver up front. The open/close value is
139
- // already native (the parent animates it that way), and a transform
140
- // that mixes a native node with a JS-only one drops the JS updates on
141
- // the floor — which is exactly a drag that moves nothing.
142
- Animated.timing(dragY, {
143
- toValue: 0,
144
- duration: 0,
145
- useNativeDriver: true,
146
- }).start();
147
- }, [isDrawerOpen, dragY]);
148
-
149
- const openTranslateY = drawerAnimation.interpolate({
33
+ const drawerTranslateX = drawerAnimation.interpolate({
150
34
  inputRange: [0, 1],
151
- outputRange: [sheetHeight, 0],
35
+ outputRange: [width, 0],
152
36
  });
153
37
 
154
- const dismissByDrag = () => {
155
- Animated.timing(dragY, {
156
- toValue: sheetHeightRef.current,
157
- duration: 180,
158
- useNativeDriver: true,
159
- }).start();
160
- closeDrawerRef.current();
161
- };
162
-
163
- const makeDragResponder = (claimOnStart: boolean) =>
164
- PanResponder.create({
165
- // The grab area claims on touch-DOWN: nothing to negotiate against,
166
- // so a pull on the handle always drags.
167
- onStartShouldSetPanResponder: () => claimOnStart,
168
- // CAPTURE matters on the body: a drag that starts on a row makes
169
- // that row's Touchable the responder on touch-down, and a plain
170
- // `onMoveShouldSetPanResponder` is never consulted afterwards.
171
- // Capturing on the first clearly-vertical movement takes the gesture
172
- // back, while a tap (dy ≈ 0) still reaches the row.
173
- onMoveShouldSetPanResponderCapture: (_evt, g) =>
174
- claimOnStart || shouldClaimVerticalDrag(g.dy, g.dx),
175
- onMoveShouldSetPanResponder: (_evt, g) =>
176
- claimOnStart || shouldClaimVerticalDrag(g.dy, g.dx),
177
- onPanResponderTerminationRequest: () => false,
178
- onPanResponderMove: (_evt, g) => {
179
- dragY.setValue(Math.max(0, g.dy));
180
- },
181
- onPanResponderRelease: (_evt, g) => {
182
- if (shouldDismissOnDrag(g.dy, g.vy)) {
183
- dismissByDrag();
184
- return;
185
- }
186
- Animated.spring(dragY, {
187
- toValue: 0,
188
- tension: 90,
189
- friction: 14,
190
- useNativeDriver: true,
191
- }).start();
192
- },
193
- onPanResponderTerminate: () => {
194
- Animated.spring(dragY, {
195
- toValue: 0,
196
- tension: 90,
197
- friction: 14,
198
- useNativeDriver: true,
199
- }).start();
200
- },
201
- });
202
-
203
- // Built once — `useRef(expr)` would re-run PanResponder.create every
204
- // render and throw the result away.
205
- const bodyPanRef = useRef<ReturnType<typeof makeDragResponder> | null>(null);
206
- const handlePanRef = useRef<ReturnType<typeof makeDragResponder> | null>(null);
207
- if (!bodyPanRef.current) {bodyPanRef.current = makeDragResponder(false);}
208
- if (!handlePanRef.current) {handlePanRef.current = makeDragResponder(true);}
209
- const pan = bodyPanRef.current;
210
- const handlePan = handlePanRef.current;
211
-
212
- const menuOptions = useMemo(() => {
213
- const options: {
214
- label: string;
215
- icon: React.ReactElement;
216
- onClick: () => void;
217
- styles?: { color: string };
218
- /** When true the row closes the drawer itself before acting. */
219
- closesDrawer?: boolean;
220
- }[] = [
38
+ const menuOptions = useMemo(
39
+ () => [
221
40
  {
222
41
  label: 'New Chat',
223
- icon: <AddNewIcon color={primaryColor} />,
42
+ icon: <AddNewIcon color="#8C8C8C" />,
224
43
  onClick: () => {
225
44
  dispatch(setActiveModal(MODAL_TYPES.NEW_CHAT));
226
45
  console.log('New chat clicked');
@@ -229,7 +48,7 @@ export const HeaderRoomListMenu: FC<HeaderRoomListMenuProps> = ({
229
48
  },
230
49
  {
231
50
  label: 'Profile',
232
- icon: <ProfileIcon color={primaryColor} />,
51
+ icon: <ProfileIcon color="#8C8C8C" />,
233
52
  onClick: () => {
234
53
  dispatch(setActiveModal(MODAL_TYPES.PROFILE));
235
54
  console.log('Profile clicked');
@@ -237,103 +56,59 @@ export const HeaderRoomListMenu: FC<HeaderRoomListMenuProps> = ({
237
56
  },
238
57
  {
239
58
  label: 'Settings',
240
- icon: <SettingIcon color={primaryColor} />,
59
+ icon: <SettingIcon color="#8C8C8C" />,
241
60
  onClick: () => {
242
61
  dispatch(setActiveModal(MODAL_TYPES.SETTINGS));
243
62
  console.log('Settings clicked');
244
63
  },
245
64
  },
246
- ];
247
- if (logoutConfig) {
248
- options.push({
249
- label: logoutConfig.label ?? DEFAULT_LOGOUT_LABEL,
250
- icon: <LogoutIcon color={primaryColor} />,
251
- styles: { color: primaryColor },
252
- closesDrawer: true,
253
- onClick: () => {
254
- closeDrawer();
255
- runLogoutFlow(logoutConfig, performLogout).catch(() => {});
256
- },
257
- });
258
- }
259
- return options;
260
- }, [dispatch, logoutConfig, performLogout, primaryColor, closeDrawer]);
65
+ // {
66
+ // label: "Logout",
67
+ // onClick: handleLogout,
68
+ // },
69
+ ],
70
+ []
71
+ );
261
72
 
262
73
  return (
263
- // Presented through a real <Modal>: as an in-tree overlay the sheet was
264
- // bounded by the room list's own container, so it stopped short of the
265
- // screen's bottom edge (that pale strip under it) and the dim never
266
- // reached the host's chrome.
267
- <Modal
268
- transparent
269
- visible={isDrawerOpen}
270
- animationType="none"
271
- statusBarTranslucent
272
- onRequestClose={closeDrawer}
273
- >
274
- <TouchableWithoutFeedback onPress={closeDrawer}>
275
- <Animated.View
276
- style={[styles.overlay, { opacity: overlayAnimation }]}
277
- />
278
- </TouchableWithoutFeedback>
279
- {/* A bottom sheet rather than the old full-height right-hand drawer:
280
- * three rows never needed the whole screen, and coming up from the
281
- * bottom keeps them within thumb reach. Inset by 2pt all round so a
282
- * sliver of the dimmed screen shows around it. */}
74
+ <>
283
75
  <Animated.View
284
- testID="header-menu-sheet"
285
- onLayout={(e) => {
286
- const measured = e.nativeEvent.layout.height;
287
- if (measured > 0) {setSheetHeight(measured);}
288
- }}
289
76
  style={[
290
- styles.sheet,
291
- {
292
- paddingBottom: insets.bottom + 20,
293
- // Two entries rather than Animated.add: the parent's value is
294
- // driven natively, and stacking the transforms keeps each node
295
- // on its own driver instead of mixing them in one expression.
296
- transform: [{ translateY: openTranslateY }, { translateY: dragY }],
297
- },
77
+ styles.drawer,
78
+ { transform: [{ translateX: drawerTranslateX }] },
298
79
  ]}
299
- {...pan.panHandlers}
300
80
  >
301
- {/* Full-width grab area, not just the 40pt pill: it claims the
302
- * gesture the moment it is touched. */}
303
- <View
304
- testID="header-menu-grabber"
305
- style={styles.grabArea}
306
- {...handlePan.panHandlers}
307
- >
308
- <View style={styles.grabber} />
309
- </View>
310
- <View style={styles.card}>
311
- {menuOptions.map((option, index) => (
312
- <View key={index} style={styles.menuItemWrapper}>
313
- <TouchableOpacity
314
- style={styles.menuItem}
315
- testID={`header-menu-${option.label}`}
316
- activeOpacity={0.6}
317
- onPress={() => {
318
- option.onClick();
319
- if (!option.closesDrawer) {
320
- closeDrawer();
321
- }
81
+ {menuOptions.map((option, index) => (
82
+ <View key={index} style={styles.menuItemWrapper}>
83
+ <TouchableOpacity
84
+ style={styles.menuItem}
85
+ onPress={() => {
86
+ option.onClick();
87
+ closeDrawer();
88
+ }}
89
+ >
90
+ <View
91
+ style={{
92
+ width: 22,
93
+ alignItems: 'center',
322
94
  }}
323
95
  >
324
- <View style={styles.iconSlot}>{option.icon}</View>
325
- <Text style={[styles.label, option?.styles]}>
326
- {option.label}
327
- </Text>
328
- </TouchableOpacity>
329
- {index < menuOptions.length - 1 && (
330
- <View style={styles.divider} />
331
- )}
332
- </View>
333
- ))}
334
- </View>
96
+ {option.icon}
97
+ </View>
98
+ <Text style={[styles.label, option?.styles]}>{option.label}</Text>
99
+ </TouchableOpacity>
100
+ {index < menuOptions.length - 1 && <View style={styles.divider} />}
101
+ </View>
102
+ ))}
335
103
  </Animated.View>
336
- </Modal>
104
+ {isDrawerOpen && (
105
+ <TouchableWithoutFeedback onPress={closeDrawer}>
106
+ <Animated.View
107
+ style={[styles.overlay, { opacity: overlayAnimation }]}
108
+ />
109
+ </TouchableWithoutFeedback>
110
+ )}
111
+ </>
337
112
  );
338
113
  };
339
114
 
@@ -345,54 +120,40 @@ const styles = StyleSheet.create({
345
120
  menuItem: {
346
121
  flexDirection: 'row',
347
122
  alignItems: 'center',
348
- paddingVertical: 18,
349
- paddingHorizontal: 16,
350
- },
351
- iconSlot: {
352
- width: 26,
353
- alignItems: 'center',
123
+ padding: 16,
354
124
  },
355
125
  label: {
356
126
  fontSize: 16,
357
- fontWeight: '500',
358
- color: '#141414',
359
- marginLeft: 12,
127
+ marginLeft: 10,
360
128
  },
361
129
  divider: {
362
- height: StyleSheet.hairlineWidth,
363
- marginLeft: 54,
364
- backgroundColor: '#E4E4E9',
130
+ height: 1,
131
+ width: '100%',
132
+ backgroundColor: '#0052cd0d',
365
133
  },
366
- sheet: {
134
+ drawer: {
367
135
  position: 'absolute',
368
- // Inset rather than flush: the dimmed screen stays visible as a thin
369
- // line around the sheet.
370
- left: 3,
371
- right: 3,
372
- bottom: 3,
373
- paddingTop: 8,
374
- backgroundColor: '#FFFFFF',
375
- borderRadius: 20,
136
+ top: 0,
137
+ bottom: 0,
138
+ right: 0,
139
+ width: width * 0.7,
140
+ backgroundColor: '#fff',
141
+ padding: 20,
376
142
  shadowColor: '#000',
377
- shadowOpacity: 0.12,
378
- shadowOffset: { width: 0, height: -3 },
379
- shadowRadius: 12,
380
- elevation: 12,
143
+ shadowOpacity: 0.3,
144
+ shadowOffset: { width: -2, height: 0 },
145
+ shadowRadius: 5,
146
+ elevation: 5,
381
147
  zIndex: 999,
382
148
  },
383
- grabArea: {
384
- alignItems: 'center',
385
- paddingTop: 6,
386
- paddingBottom: 12,
387
- },
388
- grabber: {
389
- width: 40,
390
- height: 4,
391
- borderRadius: 2,
392
- backgroundColor: '#C9CBD1',
149
+ drawerTitle: {
150
+ fontSize: 20,
151
+ fontWeight: 'bold',
152
+ marginBottom: 20,
393
153
  },
394
- card: {
395
- overflow: 'hidden',
154
+ drawerItem: {
155
+ fontSize: 18,
156
+ marginBottom: 10,
396
157
  },
397
158
  overlay: {
398
159
  position: 'absolute',