@droppii-org/chat-mobile 0.2.66 → 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 (119) 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 +3 -1
  26. package/lib/module/hooks/conversation/useGetGroupInfo.js.map +1 -1
  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/useConversationList.js +9 -4
  30. package/lib/module/hooks/useConversationList.js.map +1 -1
  31. package/lib/module/screens/ChatInfo/ChatInfoProfile.js +4 -2
  32. package/lib/module/screens/ChatInfo/ChatInfoProfile.js.map +1 -1
  33. package/lib/module/screens/chat-detail/ChatComposer.js +11 -6
  34. package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
  35. package/lib/module/screens/chat-detail/ChatDetail.js +7 -0
  36. package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
  37. package/lib/module/screens/chat-detail/ChatDetailHeader.js +10 -3
  38. package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
  39. package/lib/module/screens/chat-detail/conversationHeader.utils.js +13 -3
  40. package/lib/module/screens/chat-detail/conversationHeader.utils.js.map +1 -1
  41. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +29 -2
  42. package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
  43. package/lib/module/screens/inbox/MessagesTab.js.map +1 -1
  44. package/lib/module/store/conversation.js +56 -12
  45. package/lib/module/store/conversation.js.map +1 -1
  46. package/lib/module/translation/resources/i18n.js +31 -0
  47. package/lib/module/translation/resources/i18n.js.map +1 -1
  48. package/lib/module/types/events.js +1 -0
  49. package/lib/module/types/events.js.map +1 -1
  50. package/lib/module/utils/messageUtils.js +95 -2
  51. package/lib/module/utils/messageUtils.js.map +1 -1
  52. package/lib/typescript/src/components/Avatar/Avatar.d.ts +1 -1
  53. package/lib/typescript/src/components/Avatar/Avatar.d.ts.map +1 -1
  54. package/lib/typescript/src/components/Avatar/Avatar.types.d.ts +5 -1
  55. package/lib/typescript/src/components/Avatar/Avatar.types.d.ts.map +1 -1
  56. package/lib/typescript/src/components/Avatar/DoubleAvatar.d.ts.map +1 -1
  57. package/lib/typescript/src/components/Avatar/QuadAvatar.d.ts +16 -0
  58. package/lib/typescript/src/components/Avatar/QuadAvatar.d.ts.map +1 -0
  59. package/lib/typescript/src/components/Avatar/TripleAvatar.d.ts +15 -0
  60. package/lib/typescript/src/components/Avatar/TripleAvatar.d.ts.map +1 -0
  61. package/lib/typescript/src/components/Avatar/index.d.ts +2 -0
  62. package/lib/typescript/src/components/Avatar/index.d.ts.map +1 -1
  63. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +2 -2
  64. package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -1
  65. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts +3 -1
  66. package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -1
  67. package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
  68. package/lib/typescript/src/components/messages/groupNotificationMessage/index.d.ts +3 -0
  69. package/lib/typescript/src/components/messages/groupNotificationMessage/index.d.ts.map +1 -0
  70. package/lib/typescript/src/context/ChatDetailContext.d.ts +2 -0
  71. package/lib/typescript/src/context/ChatDetailContext.d.ts.map +1 -1
  72. package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
  73. package/lib/typescript/src/hooks/conversation/useGetGroupInfo.d.ts.map +1 -1
  74. package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -1
  75. package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
  76. package/lib/typescript/src/screens/ChatInfo/ChatInfoProfile.d.ts.map +1 -1
  77. package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
  78. package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
  79. package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
  80. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts +1 -1
  81. package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts.map +1 -1
  82. package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
  83. package/lib/typescript/src/screens/inbox/MessagesTab.d.ts.map +1 -1
  84. package/lib/typescript/src/store/conversation.d.ts +11 -0
  85. package/lib/typescript/src/store/conversation.d.ts.map +1 -1
  86. package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
  87. package/lib/typescript/src/types/events.d.ts +6 -1
  88. package/lib/typescript/src/types/events.d.ts.map +1 -1
  89. package/lib/typescript/src/utils/messageUtils.d.ts +6 -1
  90. package/lib/typescript/src/utils/messageUtils.d.ts.map +1 -1
  91. package/package.json +2 -2
  92. package/src/build-ignore.d.ts +1 -0
  93. package/src/components/Avatar/Avatar.tsx +47 -0
  94. package/src/components/Avatar/Avatar.types.ts +5 -1
  95. package/src/components/Avatar/DoubleAvatar.tsx +16 -13
  96. package/src/components/Avatar/QuadAvatar.tsx +161 -0
  97. package/src/components/Avatar/TripleAvatar.tsx +119 -0
  98. package/src/components/Avatar/index.ts +2 -0
  99. package/src/components/ThreadCard/AvatarSection.tsx +58 -2
  100. package/src/components/ThreadCard/NamePrefixIcon.tsx +32 -25
  101. package/src/components/ThreadCard/ThreadCard.tsx +2 -0
  102. package/src/components/messages/groupNotificationMessage/index.tsx +28 -0
  103. package/src/context/ChatContext.tsx +1 -1
  104. package/src/context/ChatDetailContext.tsx +15 -0
  105. package/src/core/useChatListener.ts +175 -23
  106. package/src/hooks/conversation/useGetGroupInfo.ts +2 -0
  107. package/src/hooks/message/useSendMessage.ts +11 -3
  108. package/src/hooks/useConversationList.ts +17 -7
  109. package/src/screens/ChatInfo/ChatInfoProfile.tsx +6 -3
  110. package/src/screens/chat-detail/ChatComposer.tsx +19 -10
  111. package/src/screens/chat-detail/ChatDetail.tsx +12 -1
  112. package/src/screens/chat-detail/ChatDetailHeader.tsx +19 -3
  113. package/src/screens/chat-detail/conversationHeader.utils.ts +14 -6
  114. package/src/screens/chat-detail/legend/LegendChatMessage.tsx +36 -1
  115. package/src/screens/inbox/MessagesTab.tsx +0 -1
  116. package/src/store/conversation.ts +62 -17
  117. package/src/translation/resources/i18n.ts +31 -0
  118. package/src/types/events.ts +6 -0
  119. package/src/utils/messageUtils.ts +103 -1
@@ -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
  );
@@ -1,6 +1,6 @@
1
1
  import { memo } from 'react';
2
2
  import { Image, StyleSheet } from 'react-native';
3
- import { KContainer, KImage, KColors } from '@droppii/libs';
3
+ import { KContainer, KImage, KColors, type KSpacing } from '@droppii/libs';
4
4
  import Images from '../../assets/images';
5
5
  import { PeerType } from '@droppii/openim-rn-client-sdk';
6
6
 
@@ -13,34 +13,41 @@ const styles = StyleSheet.create({
13
13
 
14
14
  interface NamePrefixIconProps {
15
15
  peerType?: PeerType | string;
16
+ marginR?: KSpacing;
16
17
  }
17
18
 
18
- export const NamePrefixIcon = memo(({ peerType }: NamePrefixIconProps) => {
19
- if (peerType === PeerType.Bot) {
20
- return (
21
- <KContainer.View marginR="0.25rem">
22
- <Image source={Images.ICON_DROPPII} style={styles.icon} />
23
- </KContainer.View>
24
- );
25
- }
19
+ export const NamePrefixIcon = memo(
20
+ ({ peerType, marginR = '0.25rem' }: NamePrefixIconProps) => {
21
+ if (peerType === PeerType.Bot) {
22
+ return (
23
+ <KContainer.View marginR={marginR}>
24
+ <Image source={Images.ICON_DROPPII} style={styles.icon} />
25
+ </KContainer.View>
26
+ );
27
+ }
26
28
 
27
- if (peerType === PeerType.Group) {
28
- return (
29
- <KContainer.View marginR="0.25rem">
30
- <KImage.VectorIcons name="user-two-b" size={14} color={KColors.black} />
31
- </KContainer.View>
32
- );
33
- }
29
+ if (peerType === PeerType.Group) {
30
+ return (
31
+ <KContainer.View marginR={marginR}>
32
+ <KImage.VectorIcons
33
+ name="user-two-b"
34
+ size={14}
35
+ color={KColors.black}
36
+ />
37
+ </KContainer.View>
38
+ );
39
+ }
34
40
 
35
- // if (peerType === DChatPeerType.CUSTOMER) {
36
- // return (
37
- // <KContainer.View marginR="0.25rem">
38
- // <Image source={Images.ICON_DROPPII} style={styles.icon} />
39
- // </KContainer.View>
40
- // );
41
- // }
41
+ // if (peerType === DChatPeerType.CUSTOMER) {
42
+ // return (
43
+ // <KContainer.View marginR={marginR}>
44
+ // <Image source={Images.ICON_DROPPII} style={styles.icon} />
45
+ // </KContainer.View>
46
+ // );
47
+ // }
42
48
 
43
- return null;
44
- });
49
+ return null;
50
+ }
51
+ );
45
52
 
46
53
  NamePrefixIcon.displayName = 'NamePrefixIcon';
@@ -33,6 +33,7 @@ const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
33
33
  peerType,
34
34
  showName,
35
35
  faceURL,
36
+ members,
36
37
  unreadCount = 0,
37
38
  recvMsgOpt = MessageReceiveOptType.Normal,
38
39
  isPinned,
@@ -120,6 +121,7 @@ const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
120
121
  avatar={faceURL ?? null}
121
122
  fullName={fullName}
122
123
  peerType={peerType}
124
+ members={members}
123
125
  />
124
126
 
125
127
  {/* Chat-Content */}
@@ -0,0 +1,28 @@
1
+ import { memo } from 'react';
2
+ import { KLabel } from '@droppii/libs';
3
+ import { trans } from '../../../translation';
4
+ import { CHAT_BUBBLE_COLORS } from '../../../screens/chat-detail/constants';
5
+ import {
6
+ GROUP_NOTIFICATION_TEXT,
7
+ getNotificationOpUserNickname,
8
+ } from '../../../utils/messageUtils';
9
+ import type { BaseLegendMessageProps } from '../types';
10
+
11
+ export const GroupNotificationMessage = memo(
12
+ ({ message, isOutgoing }: BaseLegendMessageProps) => {
13
+ const notification = GROUP_NOTIFICATION_TEXT[message.contentType];
14
+ if (!notification) return null;
15
+
16
+ const sender = isOutgoing
17
+ ? 'Bạn'
18
+ : message.senderNickname || getNotificationOpUserNickname(message) || '';
19
+
20
+ return (
21
+ <KLabel.Text typo="TextXsNormal" color={CHAT_BUBBLE_COLORS.dayLabel}>
22
+ {trans(notification.bySenderKey, { sender })}
23
+ </KLabel.Text>
24
+ );
25
+ }
26
+ );
27
+
28
+ GroupNotificationMessage.displayName = 'GroupNotificationMessage';
@@ -130,7 +130,7 @@ const ChatSdkBridge = () => {
130
130
  };
131
131
 
132
132
  export const ChatProvider = ({ ...props }: ChatProviderProps) => {
133
- const { enabled = false } = props;
133
+ const { enabled = true } = props;
134
134
 
135
135
  if (!enabled) {
136
136
  return props.children;
@@ -5,6 +5,7 @@ import {
5
5
  useEffect,
6
6
  useMemo,
7
7
  useState,
8
+ type ComponentType,
8
9
  } from 'react';
9
10
  import { DeviceEventEmitter } from 'react-native';
10
11
  import {
@@ -189,3 +190,17 @@ export const ChatDetailProvider = ({ children }: ChatDetailProviderProps) => {
189
190
  </ChatDetailContext.Provider>
190
191
  );
191
192
  };
193
+
194
+ export function withChatDetailProvider<P extends object>(
195
+ Component: ComponentType<P>
196
+ ): ComponentType<P> {
197
+ const WithChatDetailProvider = (props: P) => (
198
+ <ChatDetailProvider>
199
+ <Component {...props} />
200
+ </ChatDetailProvider>
201
+ );
202
+ WithChatDetailProvider.displayName = `withChatDetailProvider(${
203
+ Component.displayName || Component.name || 'Component'
204
+ })`;
205
+ return WithChatDetailProvider;
206
+ }