@droppii-org/chat-mobile 0.2.65 → 0.2.67

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 (153) hide show
  1. package/lib/module/components/Avatar/Avatar.js +39 -2
  2. package/lib/module/components/Avatar/Avatar.js.map +1 -1
  3. package/lib/module/components/Avatar/DoubleAvatar.js +18 -18
  4. package/lib/module/components/Avatar/DoubleAvatar.js.map +1 -1
  5. package/lib/module/components/Avatar/QuadAvatar.js +131 -0
  6. package/lib/module/components/Avatar/QuadAvatar.js.map +1 -0
  7. package/lib/module/components/Avatar/TripleAvatar.js +97 -0
  8. package/lib/module/components/Avatar/TripleAvatar.js.map +1 -0
  9. package/lib/module/components/Avatar/index.js +2 -0
  10. package/lib/module/components/Avatar/index.js.map +1 -1
  11. package/lib/module/components/ThreadCard/AvatarSection.js +41 -0
  12. package/lib/module/components/ThreadCard/AvatarSection.js.map +1 -1
  13. package/lib/module/components/ThreadCard/NamePrefixIcon.js +5 -4
  14. package/lib/module/components/ThreadCard/NamePrefixIcon.js.map +1 -1
  15. package/lib/module/components/ThreadCard/ThreadCard.js +3 -1
  16. package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
  17. package/lib/module/components/messages/groupNotificationMessage/index.js +25 -0
  18. package/lib/module/components/messages/groupNotificationMessage/index.js.map +1 -0
  19. package/lib/module/context/ChatContext.js +1 -1
  20. package/lib/module/context/ChatContext.js.map +1 -1
  21. package/lib/module/context/ChatDetailContext.js +9 -0
  22. package/lib/module/context/ChatDetailContext.js.map +1 -1
  23. package/lib/module/core/useChatListener.js +120 -21
  24. package/lib/module/core/useChatListener.js.map +1 -1
  25. package/lib/module/hooks/conversation/useGetGroupInfo.js +21 -0
  26. package/lib/module/hooks/conversation/useGetGroupInfo.js.map +1 -0
  27. package/lib/module/hooks/message/useSendMessage.js +6 -3
  28. package/lib/module/hooks/message/useSendMessage.js.map +1 -1
  29. package/lib/module/hooks/query-keys.js +2 -1
  30. package/lib/module/hooks/query-keys.js.map +1 -1
  31. package/lib/module/hooks/useConversationList.js +9 -4
  32. package/lib/module/hooks/useConversationList.js.map +1 -1
  33. package/lib/module/screens/ChatInfo/ChatInfo.js +18 -2
  34. package/lib/module/screens/ChatInfo/ChatInfo.js.map +1 -1
  35. package/lib/module/screens/ChatInfo/ChatInfoActions.js +83 -55
  36. package/lib/module/screens/ChatInfo/ChatInfoActions.js.map +1 -1
  37. package/lib/module/screens/ChatInfo/ChatInfoDescriptionRow.js +77 -0
  38. package/lib/module/screens/ChatInfo/ChatInfoDescriptionRow.js.map +1 -0
  39. package/lib/module/screens/ChatInfo/ChatInfoProfile.js +4 -2
  40. package/lib/module/screens/ChatInfo/ChatInfoProfile.js.map +1 -1
  41. package/lib/module/screens/ChatInfo/GroupDescriptionModal.js +58 -0
  42. package/lib/module/screens/ChatInfo/GroupDescriptionModal.js.map +1 -0
  43. package/lib/module/screens/chat-detail/ChatComposer.js +11 -6
  44. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  45. package/lib/module/screens/chat-detail/ChatDetail.js +7 -0
  46. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  47. package/lib/module/screens/chat-detail/ChatDetailHeader.js +10 -3
  48. package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
  49. package/lib/module/screens/chat-detail/conversationHeader.utils.js +13 -3
  50. package/lib/module/screens/chat-detail/conversationHeader.utils.js.map +1 -1
  51. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +29 -2
  52. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
  53. package/lib/module/screens/inbox/MessagesTab.js.map +1 -1
  54. package/lib/module/store/conversation.js +56 -12
  55. package/lib/module/store/conversation.js.map +1 -1
  56. package/lib/module/translation/resources/i18n.js +34 -0
  57. package/lib/module/translation/resources/i18n.js.map +1 -1
  58. package/lib/module/types/events.js +1 -0
  59. package/lib/module/types/events.js.map +1 -1
  60. package/lib/module/utils/conversation.js +3 -0
  61. package/lib/module/utils/conversation.js.map +1 -1
  62. package/lib/module/utils/messageUtils.js +95 -2
  63. package/lib/module/utils/messageUtils.js.map +1 -1
  64. package/lib/typescript/src/components/Avatar/Avatar.d.ts +1 -1
  65. package/lib/typescript/src/components/Avatar/Avatar.d.ts.map +1 -1
  66. package/lib/typescript/src/components/Avatar/Avatar.types.d.ts +5 -1
  67. package/lib/typescript/src/components/Avatar/Avatar.types.d.ts.map +1 -1
  68. package/lib/typescript/src/components/Avatar/DoubleAvatar.d.ts.map +1 -1
  69. package/lib/typescript/src/components/Avatar/QuadAvatar.d.ts +16 -0
  70. package/lib/typescript/src/components/Avatar/QuadAvatar.d.ts.map +1 -0
  71. package/lib/typescript/src/components/Avatar/TripleAvatar.d.ts +15 -0
  72. package/lib/typescript/src/components/Avatar/TripleAvatar.d.ts.map +1 -0
  73. package/lib/typescript/src/components/Avatar/index.d.ts +2 -0
  74. package/lib/typescript/src/components/Avatar/index.d.ts.map +1 -1
  75. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +2 -2
  76. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -1
  77. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts +3 -1
  78. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -1
  79. package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
  80. package/lib/typescript/src/components/messages/groupNotificationMessage/index.d.ts +3 -0
  81. package/lib/typescript/src/components/messages/groupNotificationMessage/index.d.ts.map +1 -0
  82. package/lib/typescript/src/context/ChatDetailContext.d.ts +2 -0
  83. package/lib/typescript/src/context/ChatDetailContext.d.ts.map +1 -1
  84. package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
  85. package/lib/typescript/src/hooks/conversation/useGetGroupInfo.d.ts +2 -0
  86. package/lib/typescript/src/hooks/conversation/useGetGroupInfo.d.ts.map +1 -0
  87. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
  88. package/lib/typescript/src/hooks/query-keys.d.ts +1 -0
  89. package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -1
  90. package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
  91. package/lib/typescript/src/screens/ChatInfo/ChatInfo.d.ts +1 -1
  92. package/lib/typescript/src/screens/ChatInfo/ChatInfo.d.ts.map +1 -1
  93. package/lib/typescript/src/screens/ChatInfo/ChatInfoActions.d.ts +3 -1
  94. package/lib/typescript/src/screens/ChatInfo/ChatInfoActions.d.ts.map +1 -1
  95. package/lib/typescript/src/screens/ChatInfo/ChatInfoDescriptionRow.d.ts +7 -0
  96. package/lib/typescript/src/screens/ChatInfo/ChatInfoDescriptionRow.d.ts.map +1 -0
  97. package/lib/typescript/src/screens/ChatInfo/ChatInfoProfile.d.ts.map +1 -1
  98. package/lib/typescript/src/screens/ChatInfo/GroupDescriptionModal.d.ts +9 -0
  99. package/lib/typescript/src/screens/ChatInfo/GroupDescriptionModal.d.ts.map +1 -0
  100. package/lib/typescript/src/screens/ChatInfo/types.d.ts +1 -0
  101. package/lib/typescript/src/screens/ChatInfo/types.d.ts.map +1 -1
  102. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  103. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  104. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
  105. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts +1 -1
  106. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts.map +1 -1
  107. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
  108. package/lib/typescript/src/screens/inbox/MessagesTab.d.ts.map +1 -1
  109. package/lib/typescript/src/store/conversation.d.ts +11 -0
  110. package/lib/typescript/src/store/conversation.d.ts.map +1 -1
  111. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  112. package/lib/typescript/src/types/events.d.ts +6 -1
  113. package/lib/typescript/src/types/events.d.ts.map +1 -1
  114. package/lib/typescript/src/utils/conversation.d.ts +1 -0
  115. package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
  116. package/lib/typescript/src/utils/messageUtils.d.ts +6 -1
  117. package/lib/typescript/src/utils/messageUtils.d.ts.map +1 -1
  118. package/package.json +2 -2
  119. package/src/build-ignore.d.ts +1 -0
  120. package/src/components/Avatar/Avatar.tsx +47 -0
  121. package/src/components/Avatar/Avatar.types.ts +5 -1
  122. package/src/components/Avatar/DoubleAvatar.tsx +16 -13
  123. package/src/components/Avatar/QuadAvatar.tsx +161 -0
  124. package/src/components/Avatar/TripleAvatar.tsx +119 -0
  125. package/src/components/Avatar/index.ts +2 -0
  126. package/src/components/ThreadCard/AvatarSection.tsx +58 -2
  127. package/src/components/ThreadCard/NamePrefixIcon.tsx +32 -25
  128. package/src/components/ThreadCard/ThreadCard.tsx +2 -0
  129. package/src/components/messages/groupNotificationMessage/index.tsx +28 -0
  130. package/src/context/ChatContext.tsx +1 -1
  131. package/src/context/ChatDetailContext.tsx +15 -0
  132. package/src/core/useChatListener.ts +175 -23
  133. package/src/hooks/conversation/useGetGroupInfo.ts +20 -0
  134. package/src/hooks/message/useSendMessage.ts +11 -3
  135. package/src/hooks/query-keys.ts +1 -0
  136. package/src/hooks/useConversationList.ts +17 -7
  137. package/src/screens/ChatInfo/ChatInfo.tsx +16 -0
  138. package/src/screens/ChatInfo/ChatInfoActions.tsx +68 -35
  139. package/src/screens/ChatInfo/ChatInfoDescriptionRow.tsx +102 -0
  140. package/src/screens/ChatInfo/ChatInfoProfile.tsx +6 -3
  141. package/src/screens/ChatInfo/GroupDescriptionModal.tsx +67 -0
  142. package/src/screens/ChatInfo/types.ts +1 -0
  143. package/src/screens/chat-detail/ChatComposer.tsx +19 -10
  144. package/src/screens/chat-detail/ChatDetail.tsx +12 -1
  145. package/src/screens/chat-detail/ChatDetailHeader.tsx +19 -3
  146. package/src/screens/chat-detail/conversationHeader.utils.ts +14 -6
  147. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +36 -1
  148. package/src/screens/inbox/MessagesTab.tsx +0 -1
  149. package/src/store/conversation.ts +62 -17
  150. package/src/translation/resources/i18n.ts +34 -0
  151. package/src/types/events.ts +6 -0
  152. package/src/utils/conversation.ts +6 -0
  153. package/src/utils/messageUtils.ts +103 -1
@@ -6,4 +6,5 @@ export declare const sortConversation: (map: Record<string, ConversationItem>) =
6
6
  list: string[];
7
7
  };
8
8
  export declare const getBotId: (conversation?: ConversationItem) => any;
9
+ export declare const isGroupConversation: (conversation?: Pick<ConversationItem, "conversationType" | "peerType">) => boolean;
9
10
  //# sourceMappingURL=conversation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,eAAO,MAAM,mBAAmB,GAC9B,GAAG,gBAAgB,EACnB,GAAG,gBAAgB,WAcpB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,aAAa,WAAW,EACxB,WAAW,MAAM,EACjB,aAAa,MAAM,WAUpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC;;;CAKrE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,eAAe,gBAAgB,QAWvD,CAAC"}
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,eAAO,MAAM,mBAAmB,GAC9B,GAAG,gBAAgB,EACnB,GAAG,gBAAgB,WAcpB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,aAAa,WAAW,EACxB,WAAW,MAAM,EACjB,aAAa,MAAM,WAUpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC;;;CAKrE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,eAAe,gBAAgB,QAWvD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,eAAe,IAAI,CAAC,gBAAgB,EAAE,kBAAkB,GAAG,UAAU,CAAC,YAGvE,CAAC"}
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * Message formatting and preview utilities
3
3
  */
4
- import { type ConversationItem, type MessageItem } from '@droppii/openim-rn-client-sdk';
4
+ import { MessageType, type ConversationItem, type MessageItem } from '@droppii/openim-rn-client-sdk';
5
5
  import type { IUrlMetadata } from '../types/common';
6
6
  import type { TextProps } from 'react-native';
7
7
  export declare const isMessageRevoked: (message: MessageItem) => boolean;
8
+ export declare const GROUP_NOTIFICATION_TEXT: Partial<Record<MessageType, {
9
+ previewKey: string;
10
+ bySenderKey: string;
11
+ }>>;
8
12
  export declare const extractTextContent: (message: MessageItem) => string;
9
13
  export declare const getMessagePreview: (message?: MessageItem) => string;
10
14
  export declare const getMessagePreviewTextProps: (message?: MessageItem) => TextProps;
@@ -20,6 +24,7 @@ export interface PinnedMessagePreview {
20
24
  fileIcon?: number;
21
25
  }
22
26
  export declare const getPinnedMessagePreview: (message: MessageItem) => PinnedMessagePreview;
27
+ export declare const getNotificationOpUserNickname: (message: MessageItem) => string | undefined;
23
28
  export declare const getSenderName: (message: MessageItem, currentUserId?: string, conversation?: ConversationItem) => string;
24
29
  export interface GetLastMessageTextParams {
25
30
  message: MessageItem | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"messageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/messageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,YAAY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,CAAC,EAAE,MAAM,CAAC;CACnB;AAmBD,eAAO,MAAM,uBAAuB,GAClC,SAAS,WAAW,KACnB,oBA0DF,CAAC;AAKF,eAAO,MAAM,6BAA6B,GACxC,SAAS,WAAW,KACnB,MAAM,GAAG,SAUX,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,SAAS,WAAW,EACpB,gBAAgB,MAAM,EACtB,eAAe,gBAAgB,KAC9B,MAUF,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED,eAAO,MAAM,kBAAkB,GAAI,0EAKhC,wBAAwB,KAAG,MAsB7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,UAAU,WAAW,EACrB,gBAAgB,MAAM,EACtB,eAAe,gBAAgB,EAC/B,SAAS,OAAO,KACf,MAOF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,YAAY,GAAG,SAS7D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,KAAG,MAUhE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@droppii-org/chat-mobile",
3
- "version": "0.2.65",
3
+ "version": "0.2.67",
4
4
  "description": "Droppii chat mobile",
5
5
  "keywords": [
6
6
  "react-native",
@@ -69,7 +69,7 @@
69
69
  "example-legacy": "yarn workspace @droppii-org/chat-mobile-example-legacy"
70
70
  },
71
71
  "dependencies": {
72
- "@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-rc23",
72
+ "@droppii/openim-rn-client-sdk": "git+ssh://git@github.com/droppii/open-im-sdk-reactnative.git#v1.0.0-rc27",
73
73
  "@legendapp/list": "^3.0.6",
74
74
  "axios": "^1.16.1",
75
75
  "lodash": "^4.18.1",
@@ -7,6 +7,7 @@ declare module '@droppii/libs' {
7
7
  export type KPopupProps = any;
8
8
  export type KToastBarProps = any;
9
9
  export type KListItemBaseItemProps = any;
10
+ export type KSpacing = any;
10
11
 
11
12
  export const KColors: any;
12
13
  export const KSpacingValue: any;
@@ -3,6 +3,8 @@ import { StyleSheet } from 'react-native';
3
3
  import { KContainer, KColors } from '@droppii/libs';
4
4
  import { SingleAvatar } from './SingleAvatar';
5
5
  import { DoubleAvatar } from './DoubleAvatar';
6
+ import { TripleAvatar } from './TripleAvatar';
7
+ import { QuadAvatar } from './QuadAvatar';
6
8
  import { AvatarBadge } from './AvatarBadge';
7
9
  import { SIZE_MAP } from './Avatar.utils';
8
10
  import type { AvatarProps } from './Avatar.types';
@@ -13,8 +15,12 @@ const Avatar = memo(
13
15
  size = 'md',
14
16
  type = 'single',
15
17
  secondarySource,
18
+ tertiarySource,
19
+ remainingCount,
16
20
  badge,
17
21
  fullName,
22
+ secondaryFullName,
23
+ tertiaryFullName,
18
24
  borderColor = KColors.white,
19
25
  borderWidth = 1,
20
26
  placeholderColor = KColors.palette.gray.w400,
@@ -23,6 +29,41 @@ const Avatar = memo(
23
29
  const sizeValue = useMemo(() => SIZE_MAP[size], [size]);
24
30
 
25
31
  const content = useMemo(() => {
32
+ if (type === 'quad' && remainingCount) {
33
+ return (
34
+ <QuadAvatar
35
+ primarySource={source}
36
+ secondarySource={secondarySource}
37
+ tertiarySource={tertiarySource}
38
+ remainingCount={remainingCount}
39
+ size={sizeValue}
40
+ borderColor={borderColor}
41
+ borderWidth={borderWidth}
42
+ placeholderColor={placeholderColor}
43
+ primaryFullName={fullName}
44
+ secondaryFullName={secondaryFullName}
45
+ tertiaryFullName={tertiaryFullName}
46
+ />
47
+ );
48
+ }
49
+
50
+ if (type === 'triple') {
51
+ return (
52
+ <TripleAvatar
53
+ primarySource={source}
54
+ secondarySource={secondarySource}
55
+ tertiarySource={tertiarySource}
56
+ size={sizeValue}
57
+ borderColor={borderColor}
58
+ borderWidth={borderWidth}
59
+ placeholderColor={placeholderColor}
60
+ primaryFullName={fullName}
61
+ secondaryFullName={secondaryFullName}
62
+ tertiaryFullName={tertiaryFullName}
63
+ />
64
+ );
65
+ }
66
+
26
67
  if (type === 'double') {
27
68
  return (
28
69
  <DoubleAvatar
@@ -32,6 +73,8 @@ const Avatar = memo(
32
73
  borderColor={borderColor}
33
74
  borderWidth={borderWidth}
34
75
  placeholderColor={placeholderColor}
76
+ primaryFullName={fullName}
77
+ secondaryFullName={secondaryFullName}
35
78
  />
36
79
  );
37
80
  }
@@ -51,11 +94,15 @@ const Avatar = memo(
51
94
  type,
52
95
  source,
53
96
  secondarySource,
97
+ tertiarySource,
98
+ remainingCount,
54
99
  sizeValue,
55
100
  borderColor,
56
101
  borderWidth,
57
102
  placeholderColor,
58
103
  fullName,
104
+ secondaryFullName,
105
+ tertiaryFullName,
59
106
  ]);
60
107
 
61
108
  const containerStyle = useMemo(
@@ -2,13 +2,17 @@ export interface AvatarProps {
2
2
  userId?: string;
3
3
  source?: string | null;
4
4
  size?: 'sm' | 'nm' | 'md' | 'lg' | '4xlg';
5
- type?: 'single' | 'double';
5
+ type?: 'single' | 'double' | 'triple' | 'quad';
6
6
  secondarySource?: string | null;
7
+ tertiarySource?: string | null;
8
+ remainingCount?: number;
7
9
  badge?: {
8
10
  label?: string;
9
11
  variant?: 'bot' | 'support' | 'mall' | 'custom';
10
12
  };
11
13
  fullName?: string;
14
+ secondaryFullName?: string;
15
+ tertiaryFullName?: string;
12
16
  borderColor?: string;
13
17
  borderWidth?: number;
14
18
  placeholderColor?: string;
@@ -25,8 +25,9 @@ export const DoubleAvatar = memo(
25
25
  primaryFullName,
26
26
  secondaryFullName,
27
27
  }: DoubleAvatarProps) => {
28
- const innerSize = Math.round(size * 0.6875); // 33/48 ratio
29
- const offset = Math.round(size * 0.3125); // 15/48 ratio
28
+ const primarySize = Math.round(size * 0.78);
29
+ const secondarySize = Math.round(size * 0.58);
30
+ const secondaryBorderWidth = borderWidth + 1;
30
31
 
31
32
  return (
32
33
  <KContainer.View
@@ -35,13 +36,13 @@ export const DoubleAvatar = memo(
35
36
  <KContainer.View
36
37
  style={[
37
38
  styles.doubleAvatarChild,
38
- styles.doubleAvatarTop,
39
- { width: innerSize, height: innerSize, right: offset },
39
+ styles.doubleAvatarBottomLeft,
40
+ { width: primarySize, height: primarySize },
40
41
  ]}
41
42
  >
42
43
  <SingleAvatar
43
44
  source={primarySource}
44
- size={innerSize}
45
+ size={primarySize}
45
46
  borderColor={borderColor}
46
47
  borderWidth={borderWidth}
47
48
  placeholderColor={placeholderColor}
@@ -52,15 +53,15 @@ export const DoubleAvatar = memo(
52
53
  <KContainer.View
53
54
  style={[
54
55
  styles.doubleAvatarChild,
55
- styles.doubleAvatarBottom,
56
- { width: innerSize, height: innerSize, left: offset },
56
+ styles.doubleAvatarTopRight,
57
+ { width: secondarySize, height: secondarySize },
57
58
  ]}
58
59
  >
59
60
  <SingleAvatar
60
61
  source={secondarySource}
61
- size={innerSize}
62
+ size={secondarySize}
62
63
  borderColor={borderColor}
63
- borderWidth={borderWidth}
64
+ borderWidth={secondaryBorderWidth}
64
65
  placeholderColor={placeholderColor}
65
66
  backgroundColor={KColors.palette.gray.w300}
66
67
  fullName={secondaryFullName}
@@ -80,10 +81,12 @@ const styles = StyleSheet.create({
80
81
  doubleAvatarChild: {
81
82
  position: 'absolute',
82
83
  },
83
- doubleAvatarTop: {
84
- top: 0,
85
- },
86
- doubleAvatarBottom: {
84
+ doubleAvatarBottomLeft: {
87
85
  bottom: 0,
86
+ left: 0,
87
+ },
88
+ doubleAvatarTopRight: {
89
+ top: 0,
90
+ right: 0,
88
91
  },
89
92
  });
@@ -0,0 +1,161 @@
1
+ import { memo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { KContainer, KLabel, KColors } from '@droppii/libs';
4
+ import { SingleAvatar } from './SingleAvatar';
5
+
6
+ interface QuadAvatarProps {
7
+ primarySource: string | null | undefined;
8
+ secondarySource: string | null | undefined;
9
+ tertiarySource: string | null | undefined;
10
+ remainingCount: number;
11
+ size: number;
12
+ borderColor: string;
13
+ borderWidth: number;
14
+ placeholderColor: string;
15
+ primaryFullName?: string;
16
+ secondaryFullName?: string;
17
+ tertiaryFullName?: string;
18
+ }
19
+
20
+ const getCountTypo = (cellSize: number) => {
21
+ if (cellSize <= 20) return 'Text2XsBold' as const;
22
+ if (cellSize <= 32) return 'TextXsBold' as const;
23
+ return 'TextNmBold' as const;
24
+ };
25
+
26
+ export const QuadAvatar = memo(
27
+ ({
28
+ primarySource,
29
+ secondarySource,
30
+ tertiarySource,
31
+ remainingCount,
32
+ size,
33
+ borderColor,
34
+ borderWidth,
35
+ placeholderColor,
36
+ primaryFullName,
37
+ secondaryFullName,
38
+ tertiaryFullName,
39
+ }: QuadAvatarProps) => {
40
+ const circleSize = Math.round(size * 0.58);
41
+ const clusterBorderWidth = borderWidth + 1;
42
+ const overflowLabel = remainingCount > 99 ? '99+' : `+${remainingCount}`;
43
+
44
+ return (
45
+ <KContainer.View
46
+ style={[styles.quadAvatarContainer, { width: size, height: size }]}
47
+ >
48
+ <KContainer.View
49
+ style={[
50
+ styles.quadAvatarChild,
51
+ styles.quadAvatarTopLeft,
52
+ { width: circleSize, height: circleSize },
53
+ ]}
54
+ >
55
+ <SingleAvatar
56
+ source={primarySource}
57
+ size={circleSize}
58
+ borderColor={borderColor}
59
+ borderWidth={clusterBorderWidth}
60
+ placeholderColor={placeholderColor}
61
+ backgroundColor={KColors.palette.gray.w300}
62
+ fullName={primaryFullName}
63
+ />
64
+ </KContainer.View>
65
+ <KContainer.View
66
+ style={[
67
+ styles.quadAvatarChild,
68
+ styles.quadAvatarBottomLeft,
69
+ { width: circleSize, height: circleSize },
70
+ ]}
71
+ >
72
+ <SingleAvatar
73
+ source={tertiarySource}
74
+ size={circleSize}
75
+ borderColor={borderColor}
76
+ borderWidth={clusterBorderWidth}
77
+ placeholderColor={placeholderColor}
78
+ backgroundColor={KColors.palette.gray.w300}
79
+ fullName={tertiaryFullName}
80
+ />
81
+ </KContainer.View>
82
+ <KContainer.View
83
+ style={[
84
+ styles.quadAvatarChild,
85
+ styles.quadAvatarTopRight,
86
+ { width: circleSize, height: circleSize },
87
+ ]}
88
+ >
89
+ <SingleAvatar
90
+ source={secondarySource}
91
+ size={circleSize}
92
+ borderColor={borderColor}
93
+ borderWidth={clusterBorderWidth}
94
+ placeholderColor={placeholderColor}
95
+ backgroundColor={KColors.palette.gray.w300}
96
+ fullName={secondaryFullName}
97
+ />
98
+ </KContainer.View>
99
+ <KContainer.View
100
+ style={[
101
+ styles.quadAvatarChild,
102
+ styles.quadAvatarBottomRight,
103
+ { width: circleSize, height: circleSize },
104
+ ]}
105
+ >
106
+ <KContainer.View
107
+ center
108
+ style={[
109
+ styles.overflowBadge,
110
+ {
111
+ width: circleSize,
112
+ height: circleSize,
113
+ borderRadius: circleSize / 2,
114
+ borderWidth: clusterBorderWidth,
115
+ borderColor,
116
+ },
117
+ ]}
118
+ >
119
+ <KLabel.Text typo={getCountTypo(circleSize)} color={KColors.white}>
120
+ {overflowLabel}
121
+ </KLabel.Text>
122
+ </KContainer.View>
123
+ </KContainer.View>
124
+ </KContainer.View>
125
+ );
126
+ }
127
+ );
128
+
129
+ QuadAvatar.displayName = 'QuadAvatar';
130
+
131
+ const styles = StyleSheet.create({
132
+ quadAvatarContainer: {
133
+ position: 'relative',
134
+ },
135
+ quadAvatarChild: {
136
+ position: 'absolute',
137
+ },
138
+ quadAvatarTopLeft: {
139
+ top: 0,
140
+ left: 0,
141
+ zIndex: 1,
142
+ },
143
+ quadAvatarBottomLeft: {
144
+ bottom: 0,
145
+ left: 0,
146
+ zIndex: 2,
147
+ },
148
+ quadAvatarTopRight: {
149
+ top: 0,
150
+ right: 0,
151
+ zIndex: 3,
152
+ },
153
+ quadAvatarBottomRight: {
154
+ bottom: 0,
155
+ right: 0,
156
+ zIndex: 4,
157
+ },
158
+ overflowBadge: {
159
+ backgroundColor: KColors.palette.gray.w500,
160
+ },
161
+ });
@@ -0,0 +1,119 @@
1
+ import { memo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { KContainer, KColors } from '@droppii/libs';
4
+ import { SingleAvatar } from './SingleAvatar';
5
+
6
+ interface TripleAvatarProps {
7
+ primarySource: string | null | undefined;
8
+ secondarySource: string | null | undefined;
9
+ tertiarySource: string | null | undefined;
10
+ size: number;
11
+ borderColor: string;
12
+ borderWidth: number;
13
+ placeholderColor: string;
14
+ primaryFullName?: string;
15
+ secondaryFullName?: string;
16
+ tertiaryFullName?: string;
17
+ }
18
+
19
+ export const TripleAvatar = memo(
20
+ ({
21
+ primarySource,
22
+ secondarySource,
23
+ tertiarySource,
24
+ size,
25
+ borderColor,
26
+ borderWidth,
27
+ placeholderColor,
28
+ primaryFullName,
29
+ secondaryFullName,
30
+ tertiaryFullName,
31
+ }: TripleAvatarProps) => {
32
+ const circleSize = Math.round(size * 0.6);
33
+ const topOffset = Math.round((size - circleSize) / 2);
34
+ const clusterBorderWidth = borderWidth + 1;
35
+
36
+ return (
37
+ <KContainer.View
38
+ style={[styles.tripleAvatarContainer, { width: size, height: size }]}
39
+ >
40
+ <KContainer.View
41
+ style={[
42
+ styles.tripleAvatarChild,
43
+ styles.tripleAvatarBottomLeft,
44
+ { width: circleSize, height: circleSize },
45
+ ]}
46
+ >
47
+ <SingleAvatar
48
+ source={secondarySource}
49
+ size={circleSize}
50
+ borderColor={borderColor}
51
+ borderWidth={clusterBorderWidth}
52
+ placeholderColor={placeholderColor}
53
+ backgroundColor={KColors.palette.gray.w300}
54
+ fullName={secondaryFullName}
55
+ />
56
+ </KContainer.View>
57
+ <KContainer.View
58
+ style={[
59
+ styles.tripleAvatarChild,
60
+ styles.tripleAvatarBottomRight,
61
+ { width: circleSize, height: circleSize },
62
+ ]}
63
+ >
64
+ <SingleAvatar
65
+ source={tertiarySource}
66
+ size={circleSize}
67
+ borderColor={borderColor}
68
+ borderWidth={clusterBorderWidth}
69
+ placeholderColor={placeholderColor}
70
+ backgroundColor={KColors.palette.gray.w300}
71
+ fullName={tertiaryFullName}
72
+ />
73
+ </KContainer.View>
74
+ <KContainer.View
75
+ style={[
76
+ styles.tripleAvatarChild,
77
+ styles.tripleAvatarTop,
78
+ { width: circleSize, height: circleSize, left: topOffset },
79
+ ]}
80
+ >
81
+ <SingleAvatar
82
+ source={primarySource}
83
+ size={circleSize}
84
+ borderColor={borderColor}
85
+ borderWidth={clusterBorderWidth}
86
+ placeholderColor={placeholderColor}
87
+ backgroundColor={KColors.palette.gray.w300}
88
+ fullName={primaryFullName}
89
+ />
90
+ </KContainer.View>
91
+ </KContainer.View>
92
+ );
93
+ }
94
+ );
95
+
96
+ TripleAvatar.displayName = 'TripleAvatar';
97
+
98
+ const styles = StyleSheet.create({
99
+ tripleAvatarContainer: {
100
+ position: 'relative',
101
+ },
102
+ tripleAvatarChild: {
103
+ position: 'absolute',
104
+ },
105
+ tripleAvatarTop: {
106
+ top: 0,
107
+ zIndex: 3,
108
+ },
109
+ tripleAvatarBottomLeft: {
110
+ bottom: 0,
111
+ left: 0,
112
+ zIndex: 1,
113
+ },
114
+ tripleAvatarBottomRight: {
115
+ bottom: 0,
116
+ right: 0,
117
+ zIndex: 2,
118
+ },
119
+ });
@@ -1,5 +1,7 @@
1
1
  export { default as Avatar } from './Avatar';
2
2
  export { SingleAvatar } from './SingleAvatar';
3
3
  export { DoubleAvatar } from './DoubleAvatar';
4
+ export { TripleAvatar } from './TripleAvatar';
5
+ export { QuadAvatar } from './QuadAvatar';
4
6
  export { AvatarBadge } from './AvatarBadge';
5
7
  export type { AvatarProps } from './Avatar.types';
@@ -3,7 +3,7 @@ import { Avatar } from '../Avatar';
3
3
  import { PeerType, type ConversationItem } from '@droppii/openim-rn-client-sdk';
4
4
 
5
5
  interface AvatarSectionProps extends Partial<
6
- Pick<ConversationItem, 'peerType'>
6
+ Pick<ConversationItem, 'peerType' | 'members'>
7
7
  > {
8
8
  avatar: string | null;
9
9
  fullName: string;
@@ -11,7 +11,13 @@ interface AvatarSectionProps extends Partial<
11
11
  }
12
12
 
13
13
  export const AvatarSection = memo(
14
- ({ avatar, fullName, peerType, size = 'md' }: AvatarSectionProps) => {
14
+ ({
15
+ avatar,
16
+ fullName,
17
+ peerType,
18
+ members,
19
+ size = 'md',
20
+ }: AvatarSectionProps) => {
15
21
  if (peerType === PeerType.Bot) {
16
22
  return (
17
23
  <Avatar
@@ -34,6 +40,56 @@ export const AvatarSection = memo(
34
40
  );
35
41
  }
36
42
 
43
+ const groupMembers = Array.isArray(members) ? members : [];
44
+
45
+ if (peerType === PeerType.Group && !avatar && groupMembers.length >= 4) {
46
+ const [first, second, third] = groupMembers;
47
+ const remainingCount = groupMembers.length - 3;
48
+ return (
49
+ <Avatar
50
+ type="quad"
51
+ source={first?.faceURL ?? null}
52
+ fullName={first?.nickname}
53
+ secondarySource={second?.faceURL ?? null}
54
+ secondaryFullName={second?.nickname}
55
+ tertiarySource={third?.faceURL ?? null}
56
+ tertiaryFullName={third?.nickname}
57
+ remainingCount={remainingCount}
58
+ size={size}
59
+ />
60
+ );
61
+ }
62
+
63
+ if (peerType === PeerType.Group && !avatar && groupMembers.length === 3) {
64
+ const [first, second, third] = groupMembers;
65
+ return (
66
+ <Avatar
67
+ type="triple"
68
+ source={first?.faceURL ?? null}
69
+ fullName={first?.nickname}
70
+ secondarySource={second?.faceURL ?? null}
71
+ secondaryFullName={second?.nickname}
72
+ tertiarySource={third?.faceURL ?? null}
73
+ tertiaryFullName={third?.nickname}
74
+ size={size}
75
+ />
76
+ );
77
+ }
78
+
79
+ if (peerType === PeerType.Group && !avatar && groupMembers.length === 2) {
80
+ const [first, second] = groupMembers;
81
+ return (
82
+ <Avatar
83
+ type="double"
84
+ source={first?.faceURL ?? null}
85
+ fullName={first?.nickname}
86
+ secondarySource={second?.faceURL ?? null}
87
+ secondaryFullName={second?.nickname}
88
+ size={size}
89
+ />
90
+ );
91
+ }
92
+
37
93
  return <Avatar source={avatar} fullName={fullName} size={size} />;
38
94
  }
39
95
  );