@droppii-org/chat-mobile 0.2.4 → 0.2.7

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 (212) hide show
  1. package/lib/module/components/ThreadCard/AvatarSection.js +4 -4
  2. package/lib/module/components/ThreadCard/AvatarSection.js.map +1 -1
  3. package/lib/module/components/ThreadCard/NamePrefixIcon.js +13 -16
  4. package/lib/module/components/ThreadCard/NamePrefixIcon.js.map +1 -1
  5. package/lib/module/components/ThreadCard/ThreadCard.js +13 -33
  6. package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
  7. package/lib/module/config/feature-flags.js +38 -0
  8. package/lib/module/config/feature-flags.js.map +1 -0
  9. package/lib/module/context/ChatContext.js +7 -6
  10. package/lib/module/context/ChatContext.js.map +1 -1
  11. package/lib/module/hooks/message/useSendMessage.js +101 -0
  12. package/lib/module/hooks/message/useSendMessage.js.map +1 -0
  13. package/lib/module/hooks/query-keys.js +4 -0
  14. package/lib/module/hooks/query-keys.js.map +1 -1
  15. package/lib/module/hooks/useChatMessages.js +54 -91
  16. package/lib/module/hooks/useChatMessages.js.map +1 -1
  17. package/lib/module/hooks/useConversationList.js +29 -17
  18. package/lib/module/hooks/useConversationList.js.map +1 -1
  19. package/lib/module/hooks/useLinkPreview/useFetchUrlMetadata.js +17 -0
  20. package/lib/module/hooks/useLinkPreview/useFetchUrlMetadata.js.map +1 -0
  21. package/lib/module/hooks/useLinkPreview/useLinkPreview.js +35 -0
  22. package/lib/module/hooks/useLinkPreview/useLinkPreview.js.map +1 -0
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/screens/chat-detail/ChatComposer.js +20 -4
  25. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  26. package/lib/module/screens/chat-detail/ChatDetail.js +116 -22
  27. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  28. package/lib/module/screens/chat-detail/ChatDetailHeader.js +5 -8
  29. package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
  30. package/lib/module/screens/chat-detail/ChatLinkPreview.js +79 -0
  31. package/lib/module/screens/chat-detail/ChatLinkPreview.js.map +1 -0
  32. package/lib/module/screens/chat-detail/ChatList.js +2 -0
  33. package/lib/module/screens/chat-detail/ChatList.js.map +1 -1
  34. package/lib/module/screens/chat-detail/ChatListLegend.js +350 -0
  35. package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -0
  36. package/lib/module/screens/chat-detail/ChatQuickActions.js +12 -2
  37. package/lib/module/screens/chat-detail/ChatQuickActions.js.map +1 -1
  38. package/lib/module/screens/chat-detail/conversationHeader.utils.js +29 -0
  39. package/lib/module/screens/chat-detail/conversationHeader.utils.js.map +1 -0
  40. package/lib/module/screens/chat-detail/index.js +1 -0
  41. package/lib/module/screens/chat-detail/index.js.map +1 -1
  42. package/lib/module/screens/chat-detail/legend/LegendChatDay.js +57 -0
  43. package/lib/module/screens/chat-detail/legend/LegendChatDay.js.map +1 -0
  44. package/lib/module/screens/chat-detail/legend/LegendChatLoadEarlier.js +21 -0
  45. package/lib/module/screens/chat-detail/legend/LegendChatLoadEarlier.js.map +1 -0
  46. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +34 -0
  47. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -0
  48. package/lib/module/screens/chat-detail/legend/LegendChatScrollToBottom.js +58 -0
  49. package/lib/module/screens/chat-detail/legend/LegendChatScrollToBottom.js.map +1 -0
  50. package/lib/module/screens/chat-detail/legend/message-types.js +244 -0
  51. package/lib/module/screens/chat-detail/legend/message-types.js.map +1 -0
  52. package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js.map +1 -1
  53. package/lib/module/services/apis.js +1 -1
  54. package/lib/module/services/apis.js.map +1 -1
  55. package/lib/module/services/endpoints.js +8 -0
  56. package/lib/module/services/endpoints.js.map +1 -0
  57. package/lib/module/store/conversation.js +1 -1
  58. package/lib/module/store/conversation.js.map +1 -1
  59. package/lib/module/store/message.js +45 -0
  60. package/lib/module/store/message.js.map +1 -0
  61. package/lib/module/translation/resources/i18n.js +7 -1
  62. package/lib/module/translation/resources/i18n.js.map +1 -1
  63. package/lib/module/types/chat.js +2 -7
  64. package/lib/module/types/chat.js.map +1 -1
  65. package/lib/module/types/common.js +2 -0
  66. package/lib/module/types/common.js.map +1 -0
  67. package/lib/module/utils/conversation.js +34 -13
  68. package/lib/module/utils/conversation.js.map +1 -1
  69. package/lib/module/utils/legendListMessage.js +77 -0
  70. package/lib/module/utils/legendListMessage.js.map +1 -0
  71. package/lib/module/utils/message.js +5 -8
  72. package/lib/module/utils/message.js.map +1 -1
  73. package/lib/module/utils/url.js +7 -0
  74. package/lib/module/utils/url.js.map +1 -0
  75. package/lib/typescript/src/components/Avatar/Avatar.d.ts +1 -1
  76. package/lib/typescript/src/components/Avatar/Avatar.d.ts.map +1 -1
  77. package/lib/typescript/src/components/Avatar/AvatarBadge.d.ts +1 -1
  78. package/lib/typescript/src/components/Avatar/AvatarBadge.d.ts.map +1 -1
  79. package/lib/typescript/src/components/Avatar/DoubleAvatar.d.ts +1 -1
  80. package/lib/typescript/src/components/Avatar/DoubleAvatar.d.ts.map +1 -1
  81. package/lib/typescript/src/components/Avatar/SingleAvatar.d.ts +1 -1
  82. package/lib/typescript/src/components/Avatar/SingleAvatar.d.ts.map +1 -1
  83. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +2 -2
  84. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -1
  85. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts +3 -4
  86. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -1
  87. package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts +1 -1
  88. package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
  89. package/lib/typescript/src/components/ThreadCard/UnreadBadge.d.ts +1 -1
  90. package/lib/typescript/src/components/ThreadCard/UnreadBadge.d.ts.map +1 -1
  91. package/lib/typescript/src/config/feature-flags.d.ts +12 -0
  92. package/lib/typescript/src/config/feature-flags.d.ts.map +1 -0
  93. package/lib/typescript/src/context/ChatContext.d.ts +1 -1
  94. package/lib/typescript/src/context/ChatContext.d.ts.map +1 -1
  95. package/lib/typescript/src/hooks/message/useSendMessage.d.ts +12 -0
  96. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -0
  97. package/lib/typescript/src/hooks/query-keys.d.ts +4 -0
  98. package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -1
  99. package/lib/typescript/src/hooks/useChatMessages.d.ts +3 -1
  100. package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -1
  101. package/lib/typescript/src/hooks/useConversationList.d.ts +2 -1
  102. package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
  103. package/lib/typescript/src/hooks/useLinkPreview/useFetchUrlMetadata.d.ts +3 -0
  104. package/lib/typescript/src/hooks/useLinkPreview/useFetchUrlMetadata.d.ts.map +1 -0
  105. package/lib/typescript/src/hooks/useLinkPreview/useLinkPreview.d.ts +7 -0
  106. package/lib/typescript/src/hooks/useLinkPreview/useLinkPreview.d.ts.map +1 -0
  107. package/lib/typescript/src/index.d.ts +1 -1
  108. package/lib/typescript/src/index.d.ts.map +1 -1
  109. package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts +1 -1
  110. package/lib/typescript/src/screens/chat-detail/ChatAttachmentPanel.d.ts.map +1 -1
  111. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +1 -1
  112. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  113. package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts +1 -1
  114. package/lib/typescript/src/screens/chat-detail/ChatDay.d.ts.map +1 -1
  115. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
  116. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  117. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
  118. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
  119. package/lib/typescript/src/screens/chat-detail/ChatLinkPreview.d.ts +9 -0
  120. package/lib/typescript/src/screens/chat-detail/ChatLinkPreview.d.ts.map +1 -0
  121. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts +1 -1
  122. package/lib/typescript/src/screens/chat-detail/ChatList.d.ts.map +1 -1
  123. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +3 -0
  124. package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -0
  125. package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts +1 -1
  126. package/lib/typescript/src/screens/chat-detail/ChatLoadEarlier.d.ts.map +1 -1
  127. package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts +1 -1
  128. package/lib/typescript/src/screens/chat-detail/ChatQuickActions.d.ts.map +1 -1
  129. package/lib/typescript/src/screens/chat-detail/ChatScrollToBottom.d.ts +1 -1
  130. package/lib/typescript/src/screens/chat-detail/ChatScrollToBottom.d.ts.map +1 -1
  131. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts +1 -1
  132. package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts.map +1 -1
  133. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts +6 -0
  134. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts.map +1 -0
  135. package/lib/typescript/src/screens/chat-detail/index.d.ts +2 -1
  136. package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
  137. package/lib/typescript/src/screens/chat-detail/legend/LegendChatDay.d.ts +6 -0
  138. package/lib/typescript/src/screens/chat-detail/legend/LegendChatDay.d.ts.map +1 -0
  139. package/lib/typescript/src/screens/chat-detail/legend/LegendChatLoadEarlier.d.ts +6 -0
  140. package/lib/typescript/src/screens/chat-detail/legend/LegendChatLoadEarlier.d.ts.map +1 -0
  141. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +13 -0
  142. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -0
  143. package/lib/typescript/src/screens/chat-detail/legend/LegendChatScrollToBottom.d.ts +6 -0
  144. package/lib/typescript/src/screens/chat-detail/legend/LegendChatScrollToBottom.d.ts.map +1 -0
  145. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts +13 -0
  146. package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts.map +1 -0
  147. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts +1 -1
  148. package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts.map +1 -1
  149. package/lib/typescript/src/screens/chat-detail/types.d.ts +33 -7
  150. package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
  151. package/lib/typescript/src/screens/inbox/Inbox.d.ts +1 -1
  152. package/lib/typescript/src/screens/inbox/Inbox.d.ts.map +1 -1
  153. package/lib/typescript/src/screens/inbox/MessagesTab.d.ts +1 -1
  154. package/lib/typescript/src/screens/inbox/MessagesTab.d.ts.map +1 -1
  155. package/lib/typescript/src/services/apis.d.ts +1 -0
  156. package/lib/typescript/src/services/apis.d.ts.map +1 -1
  157. package/lib/typescript/src/services/endpoints.d.ts +6 -0
  158. package/lib/typescript/src/services/endpoints.d.ts.map +1 -0
  159. package/lib/typescript/src/store/message.d.ts +3 -0
  160. package/lib/typescript/src/store/message.d.ts.map +1 -0
  161. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  162. package/lib/typescript/src/types/chat.d.ts +28 -27
  163. package/lib/typescript/src/types/chat.d.ts.map +1 -1
  164. package/lib/typescript/src/types/common.d.ts +7 -0
  165. package/lib/typescript/src/types/common.d.ts.map +1 -0
  166. package/lib/typescript/src/utils/conversation.d.ts +3 -2
  167. package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
  168. package/lib/typescript/src/utils/legendListMessage.d.ts +23 -0
  169. package/lib/typescript/src/utils/legendListMessage.d.ts.map +1 -0
  170. package/lib/typescript/src/utils/message.d.ts.map +1 -1
  171. package/lib/typescript/src/utils/url.d.ts +2 -0
  172. package/lib/typescript/src/utils/url.d.ts.map +1 -0
  173. package/package.json +5 -3
  174. package/src/components/ThreadCard/AvatarSection.tsx +5 -8
  175. package/src/components/ThreadCard/NamePrefixIcon.tsx +27 -38
  176. package/src/components/ThreadCard/ThreadCard.tsx +16 -30
  177. package/src/config/feature-flags.ts +49 -0
  178. package/src/context/ChatContext.tsx +12 -4
  179. package/src/hooks/message/useSendMessage.ts +136 -0
  180. package/src/hooks/query-keys.ts +5 -0
  181. package/src/hooks/useChatMessages.ts +90 -118
  182. package/src/hooks/useConversationList.ts +34 -16
  183. package/src/hooks/useLinkPreview/useFetchUrlMetadata.ts +18 -0
  184. package/src/hooks/useLinkPreview/useLinkPreview.ts +31 -0
  185. package/src/index.tsx +1 -0
  186. package/src/screens/chat-detail/ChatComposer.tsx +23 -2
  187. package/src/screens/chat-detail/ChatDetail.tsx +163 -30
  188. package/src/screens/chat-detail/ChatDetailHeader.tsx +4 -10
  189. package/src/screens/chat-detail/ChatLinkPreview.tsx +86 -0
  190. package/src/screens/chat-detail/ChatList.tsx +3 -0
  191. package/src/screens/chat-detail/ChatListLegend.tsx +403 -0
  192. package/src/screens/chat-detail/ChatQuickActions.tsx +19 -2
  193. package/src/screens/chat-detail/conversationHeader.utils.ts +49 -0
  194. package/src/screens/chat-detail/index.ts +7 -0
  195. package/src/screens/chat-detail/legend/LegendChatDay.tsx +70 -0
  196. package/src/screens/chat-detail/legend/LegendChatLoadEarlier.tsx +21 -0
  197. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +48 -0
  198. package/src/screens/chat-detail/legend/LegendChatScrollToBottom.tsx +56 -0
  199. package/src/screens/chat-detail/legend/message-types.tsx +304 -0
  200. package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +0 -1
  201. package/src/screens/chat-detail/types.ts +45 -7
  202. package/src/services/apis.ts +1 -1
  203. package/src/services/endpoints.ts +5 -0
  204. package/src/store/conversation.ts +1 -1
  205. package/src/store/message.ts +44 -0
  206. package/src/translation/resources/i18n.ts +6 -0
  207. package/src/types/chat.ts +31 -30
  208. package/src/types/common.ts +6 -0
  209. package/src/utils/conversation.ts +44 -17
  210. package/src/utils/legendListMessage.ts +97 -0
  211. package/src/utils/message.ts +10 -12
  212. package/src/utils/url.ts +5 -0
@@ -1,50 +1,143 @@
1
- import { memo, useState, useCallback } from 'react';
1
+ import { memo, useState, useCallback, useEffect, useMemo } from 'react';
2
2
  import { Platform, StyleSheet } from 'react-native';
3
+
3
4
  import { KeyboardAvoidingView } from 'react-native-keyboard-controller';
4
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
6
  import { KContainer } from '@droppii/libs';
7
+ import { useChatMessages } from '../../hooks/useChatMessages';
8
+ import { useConversation, useConversationStore } from '../../store';
6
9
  import ChatDetailHeader from './ChatDetailHeader';
7
10
  import { ChatList } from './ChatList';
11
+ import { ChatListLegend } from './ChatListLegend';
8
12
  import { ChatComposer } from './ChatComposer';
13
+ import {
14
+ DEFAULT_ATTACHMENT_ACTIONS,
15
+ DEFAULT_Chat_QUICK_ACTIONS,
16
+ } from './constants';
17
+ import {
18
+ getConversationAvatarUri,
19
+ getConversationSubtitle,
20
+ getConversationTitle,
21
+ shouldShowAddMember,
22
+ } from './conversationHeader.utils';
23
+ import { getFeatureFlag, onFlagsChange } from '../../config/feature-flags';
9
24
  import type { ChatDetailProps } from './types';
25
+ import { useSendMessage } from '../../hooks/message/useSendMessage';
26
+ import type { IUrlMetadata } from '../../types/common';
10
27
 
11
28
  const ChatDetail = memo(
12
29
  ({
30
+ conversationId,
31
+ enabled = true,
13
32
  title,
14
33
  subtitle,
15
34
  avatarUri,
16
35
  avatarFullName,
17
- chatType,
18
- chatCategory,
36
+ peerType,
19
37
  applicationType,
20
38
  showAddMember,
39
+ getSubtitle,
21
40
  onBack,
22
41
  onPressSearch,
23
42
  onPressAddMember,
24
43
  onPressMenu,
25
44
  onPressAvatar,
26
- messages = [],
27
- currentUserId,
28
45
  renderChat,
29
- onLoadEarlier,
30
- isLoading,
31
- isLoadingEarlier,
32
- hasMoreEarlier,
46
+ showQuickActions = true,
47
+ showAttachmentActions = true,
33
48
  quickActions,
49
+ getQuickActions,
34
50
  inputValue,
35
51
  inputPlaceholder,
36
52
  onChangeInput,
37
- onSend,
38
53
  onPressAttach,
39
54
  onPressEmoji,
40
55
  attachmentActions,
41
56
  onQuickActionPress,
42
57
  onAttachmentAction,
43
58
  renderQuickAction,
59
+ renderQuickActions,
44
60
  renderAttachmentAction,
45
61
  attachmentColumns,
46
62
  }: ChatDetailProps) => {
47
63
  const [internalInput, setInternalInput] = useState('');
64
+ const conversation = useConversation(conversationId);
65
+
66
+ const { sendMessage } = useSendMessage();
67
+
68
+ const {
69
+ messages,
70
+ currentUserId,
71
+ onLoadEarlier,
72
+ isLoading,
73
+ isLoadingEarlier,
74
+ hasMoreEarlier,
75
+ } = useChatMessages({
76
+ conversationId,
77
+ enabled,
78
+ });
79
+
80
+ useEffect(() => {
81
+ useConversationStore.getState().setCurrentConversation(conversationId);
82
+ }, [conversationId]);
83
+
84
+ const resolvedTitle = title ?? getConversationTitle(conversation);
85
+ const resolvedAvatarUri =
86
+ avatarUri ?? getConversationAvatarUri(conversation);
87
+ const resolvedAvatarFullName = avatarFullName ?? resolvedTitle;
88
+ const resolvedPeerType = peerType ?? conversation?.peerType;
89
+ const resolvedApplicationType =
90
+ applicationType ?? conversation?.applicationType;
91
+ const resolvedShowAddMember =
92
+ showAddMember ?? shouldShowAddMember(conversation);
93
+ const resolvedSubtitle = useMemo(() => {
94
+ if (subtitle !== undefined) {
95
+ return subtitle;
96
+ }
97
+
98
+ if (getSubtitle && conversation) {
99
+ return getSubtitle(conversation);
100
+ }
101
+
102
+ return getConversationSubtitle(conversation);
103
+ }, [conversation, getSubtitle, subtitle]);
104
+
105
+ const resolvedQuickActions = useMemo(() => {
106
+ if (!showQuickActions) {
107
+ return undefined;
108
+ }
109
+
110
+ if (quickActions) {
111
+ return quickActions;
112
+ }
113
+
114
+ if (getQuickActions && conversation) {
115
+ return getQuickActions(conversation);
116
+ }
117
+
118
+ return DEFAULT_Chat_QUICK_ACTIONS;
119
+ }, [conversation, getQuickActions, quickActions, showQuickActions]);
120
+
121
+ const resolvedAttachmentActions = useMemo(() => {
122
+ if (!showAttachmentActions) {
123
+ return undefined;
124
+ }
125
+
126
+ return attachmentActions ?? DEFAULT_ATTACHMENT_ACTIONS;
127
+ }, [attachmentActions, showAttachmentActions]);
128
+ const [variant, setVariant] = useState<'gifted' | 'legend'>(
129
+ () => getFeatureFlag('CHAT_LIST_VARIANT') as 'gifted' | 'legend'
130
+ );
131
+
132
+ useEffect(() => {
133
+ const unsubscribe = onFlagsChange(() => {
134
+ const newVariant = getFeatureFlag('CHAT_LIST_VARIANT') as
135
+ | 'gifted'
136
+ | 'legend';
137
+ setVariant(newVariant);
138
+ });
139
+ return unsubscribe;
140
+ }, []);
48
141
 
49
142
  const handleChangeInput = useCallback(
50
143
  (text: string) => {
@@ -58,19 +151,45 @@ const ChatDetail = memo(
58
151
  );
59
152
 
60
153
  const currentInput = inputValue ?? internalInput;
154
+
155
+ const handleSend = useCallback(
156
+ async (urlMetadata?: IUrlMetadata) => {
157
+ const text = currentInput.trim();
158
+ if (!text) {
159
+ return;
160
+ }
161
+
162
+ try {
163
+ await sendMessage({
164
+ files: [],
165
+ plainText: text,
166
+ urlMetadata,
167
+ });
168
+
169
+ if (onChangeInput) {
170
+ onChangeInput('');
171
+ } else {
172
+ setInternalInput('');
173
+ }
174
+ } catch (error) {
175
+ console.error('[send-message]', error);
176
+ }
177
+ },
178
+ [currentInput, onChangeInput, sendMessage]
179
+ );
180
+
61
181
  const insets = useSafeAreaInsets();
62
182
 
63
183
  return (
64
184
  <KContainer.Page flex edges={['bottom']}>
65
185
  <ChatDetailHeader
66
- title={title}
67
- subtitle={subtitle}
68
- avatarUri={avatarUri}
69
- avatarFullName={avatarFullName}
70
- chatType={chatType}
71
- chatCategory={chatCategory}
72
- applicationType={applicationType}
73
- showAddMember={showAddMember}
186
+ title={resolvedTitle}
187
+ subtitle={resolvedSubtitle}
188
+ avatarUri={resolvedAvatarUri}
189
+ avatarFullName={resolvedAvatarFullName}
190
+ peerType={resolvedPeerType}
191
+ applicationType={resolvedApplicationType}
192
+ showAddMember={resolvedShowAddMember}
74
193
  onBack={onBack}
75
194
  onPressSearch={onPressSearch}
76
195
  onPressAddMember={onPressAddMember}
@@ -86,28 +205,42 @@ const ChatDetail = memo(
86
205
  default: 0,
87
206
  })}
88
207
  >
89
- <ChatList
90
- messages={messages}
91
- currentUserId={currentUserId}
92
- renderChat={renderChat}
93
- onLoadEarlier={onLoadEarlier}
94
- isLoading={isLoading}
95
- isLoadingEarlier={isLoadingEarlier}
96
- hasMoreEarlier={hasMoreEarlier}
97
- />
208
+ {variant === 'legend' ? (
209
+ <ChatListLegend
210
+ messages={messages}
211
+ currentUserId={currentUserId}
212
+ renderChat={renderChat}
213
+ onLoadEarlier={onLoadEarlier}
214
+ isLoading={isLoading}
215
+ isLoadingEarlier={isLoadingEarlier}
216
+ hasMoreEarlier={hasMoreEarlier}
217
+ />
218
+ ) : (
219
+ <ChatList
220
+ messages={messages}
221
+ currentUserId={currentUserId}
222
+ renderChat={renderChat}
223
+ onLoadEarlier={onLoadEarlier}
224
+ isLoading={isLoading}
225
+ isLoadingEarlier={isLoadingEarlier}
226
+ hasMoreEarlier={hasMoreEarlier}
227
+ />
228
+ )}
98
229
 
99
230
  <ChatComposer
100
231
  value={currentInput}
101
232
  placeholder={inputPlaceholder}
102
233
  onChangeText={handleChangeInput}
103
- onSend={onSend}
234
+ onSend={handleSend}
104
235
  onPressAttach={onPressAttach}
105
236
  onPressEmoji={onPressEmoji}
106
- quickActions={quickActions}
107
- attachmentActions={attachmentActions}
237
+ showQuickActions={showQuickActions}
238
+ quickActions={resolvedQuickActions}
239
+ attachmentActions={resolvedAttachmentActions}
108
240
  onQuickActionPress={onQuickActionPress}
109
241
  onAttachmentAction={onAttachmentAction}
110
242
  renderQuickAction={renderQuickAction}
243
+ renderQuickActions={renderQuickActions}
111
244
  renderAttachmentAction={renderAttachmentAction}
112
245
  attachmentColumns={attachmentColumns}
113
246
  />
@@ -16,8 +16,7 @@ const ChatDetailHeader = memo(
16
16
  subtitle,
17
17
  avatarUri,
18
18
  avatarFullName,
19
- chatType,
20
- chatCategory,
19
+ peerType,
21
20
  applicationType,
22
21
  showAddMember = false,
23
22
  onBack,
@@ -81,17 +80,13 @@ const ChatDetailHeader = memo(
81
80
  <AvatarSection
82
81
  avatar={avatarUri ?? null}
83
82
  fullName={avatarFullName ?? title}
84
- chatCategory={chatCategory}
83
+ peerType={peerType}
85
84
  applicationType={applicationType}
86
- chatType={chatType}
87
85
  />
88
86
 
89
87
  <KContainer.View flex marginL="0.5rem">
90
88
  <KContainer.View row alignItems>
91
- <NamePrefixIcon
92
- chatCategory={chatCategory}
93
- chatType={chatType}
94
- />
89
+ <NamePrefixIcon peerType={peerType} />
95
90
  <KLabel.Text
96
91
  typo="TextLgBold"
97
92
  color={KColors.gray.dark}
@@ -117,9 +112,8 @@ const ChatDetailHeader = memo(
117
112
  [
118
113
  avatarFullName,
119
114
  avatarUri,
120
- chatCategory,
115
+ peerType,
121
116
  applicationType,
122
- chatType,
123
117
  onBack,
124
118
  onPressAvatar,
125
119
  subtitle,
@@ -0,0 +1,86 @@
1
+ import { memo } from 'react';
2
+ import { ActivityIndicator, StyleSheet } from 'react-native';
3
+ import {
4
+ KContainer,
5
+ KImage,
6
+ KLabel,
7
+ KColors,
8
+ KSpacingValue,
9
+ KDims,
10
+ } from '@droppii/libs';
11
+ import type { IUrlMetadata } from '../../types/common';
12
+
13
+ interface ChatLinkPreviewProps {
14
+ metadata?: IUrlMetadata;
15
+ isLoading?: boolean;
16
+ onDismiss?: () => void;
17
+ }
18
+
19
+ const HEIGHT = 51;
20
+
21
+ export const ChatLinkPreview = memo(
22
+ ({ metadata, isLoading, onDismiss }: ChatLinkPreviewProps) => {
23
+ return (
24
+ <KContainer.View style={styles.container}>
25
+ <KContainer.View style={styles.left}>
26
+ {isLoading ? (
27
+ <ActivityIndicator color={KColors.primary.normal} size={16} />
28
+ ) : metadata?.image ? (
29
+ <KImage.Base uri={metadata?.image} width={HEIGHT} height={HEIGHT} />
30
+ ) : (
31
+ <KImage.VectorIcons
32
+ name="link-alt-o"
33
+ color={KColors.primary.normal}
34
+ />
35
+ )}
36
+ </KContainer.View>
37
+ <KContainer.View style={styles.center}>
38
+ <KLabel.Text typo="TextNmMedium" numberOfLines={1}>
39
+ {metadata?.title}
40
+ </KLabel.Text>
41
+ <KLabel.Text
42
+ typo="TextSmNormal"
43
+ color={KColors.gray.light}
44
+ numberOfLines={1}
45
+ >
46
+ {metadata?.description}
47
+ </KLabel.Text>
48
+ </KContainer.View>
49
+ <KContainer.Touchable onPress={onDismiss} style={styles.right}>
50
+ <KImage.VectorIcons name="close-o" size={16} />
51
+ </KContainer.Touchable>
52
+ </KContainer.View>
53
+ );
54
+ }
55
+ );
56
+
57
+ ChatLinkPreview.displayName = 'ChatLinkPreview';
58
+
59
+ const styles = StyleSheet.create({
60
+ container: {
61
+ position: 'absolute',
62
+ flexDirection: 'row',
63
+ flex: 1,
64
+ width: KDims.width,
65
+ alignItems: 'center',
66
+ gap: KSpacingValue['0.5rem'],
67
+ backgroundColor: KColors.palette.blue.w25,
68
+ height: HEIGHT,
69
+ top: -HEIGHT,
70
+ zIndex: 10000,
71
+ },
72
+ left: {
73
+ width: HEIGHT,
74
+ height: HEIGHT,
75
+ justifyContent: 'center',
76
+ alignItems: 'center',
77
+ },
78
+ center: {
79
+ flex: 1,
80
+ },
81
+ right: {
82
+ paddingRight: KSpacingValue['0.5rem'],
83
+ justifyContent: 'center',
84
+ alignItems: 'center',
85
+ },
86
+ });
@@ -9,6 +9,7 @@ import {
9
9
  import { KContainer, KColors, KSpacingValue } from '@droppii/libs';
10
10
  import { mapOpenIMMessagesToGiftedChat } from '../../utils/giftedChatMessage';
11
11
  import type { DGiftedChatMessage } from '../../utils/giftedChatMessage';
12
+
12
13
  import type { ChatListProps } from './types';
13
14
  import { ChatDay } from './ChatDay';
14
15
  import { ChatLoadEarlier } from './ChatLoadEarlier';
@@ -24,6 +25,8 @@ export const ChatList = memo(
24
25
  isLoading,
25
26
  isLoadingEarlier,
26
27
  hasMoreEarlier,
28
+ // Note: onLoadNewer, isLoadingNewer, hasMoreNewer are not used in GiftedChat
29
+ // as it has its own pagination mechanism. They're kept for API compatibility.
27
30
  }: ChatListProps) => {
28
31
  const giftedMessages = useMemo(
29
32
  () => mapOpenIMMessagesToGiftedChat(messages),