Skip to content

Commit 507a1af

Browse files
committed
feat(foundation): added mention related props to group channel preview
1 parent 785cc0f commit 507a1af

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

packages/uikit-react-native-foundation/src/ui/GroupChannelPreview/index.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ type Props = {
2929
frozen?: boolean;
3030
notificationOff?: boolean;
3131
broadcast?: boolean;
32+
mentioned?: boolean;
33+
mentionTrigger?: string;
3234
};
3335

3436
const GroupChannelPreview = ({
@@ -45,6 +47,8 @@ const GroupChannelPreview = ({
4547
frozen,
4648
notificationOff,
4749
broadcast,
50+
mentioned,
51+
mentionTrigger = '@',
4852
}: Props) => {
4953
const { colors } = useUIKitTheme();
5054
const color = colors.ui.groupChannelPreview;
@@ -115,7 +119,14 @@ const GroupChannelPreview = ({
115119
</Text>
116120
</View>
117121
</View>
118-
<View>{badgeCount > 0 && <Badge count={badgeCount} maxCount={maxBadgeCount} />}</View>
122+
<View style={styles.unreadContainer}>
123+
{mentioned && (
124+
<Text h2 color={colors.ui.badge.default.none.background} style={styles.unreadMention}>
125+
{mentionTrigger}
126+
</Text>
127+
)}
128+
{badgeCount > 0 && <Badge count={badgeCount} maxCount={maxBadgeCount} />}
129+
</View>
119130
</View>
120131
<Separator color={color.default.none.separator} />
121132
</View>
@@ -204,12 +215,12 @@ const styles = createStyleSheet({
204215
height: 26,
205216
marginRight: 4,
206217
},
207-
unreadBadge: {
208-
minWidth: 20,
209-
minHeight: 20,
210-
borderRadius: 99,
211-
alignItems: 'center',
212-
justifyContent: 'center',
218+
unreadContainer: {
219+
flexDirection: 'row',
220+
alignItems: 'flex-start',
221+
},
222+
unreadMention: {
223+
marginRight: 4,
213224
},
214225
separator: {
215226
position: 'absolute',

packages/uikit-react-native/src/containers/GroupChannelPreviewContainer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type Props = {
3232
onLongPress: () => void;
3333
};
3434
const GroupChannelPreviewContainer = ({ onPress, onLongPress, channel }: Props) => {
35-
const { currentUser, sdk, features } = useSendbirdChat();
35+
const { currentUser, sdk, features, mentionManager } = useSendbirdChat();
3636
const { STRINGS } = useLocalization();
3737
const { colors } = useUIKitTheme();
3838

@@ -100,6 +100,8 @@ const GroupChannelPreviewContainer = ({ onPress, onLongPress, channel }: Props)
100100
body={bodyText}
101101
bodyIcon={bodyIcon}
102102
badgeCount={channel.unreadMessageCount}
103+
mentioned={channel.unreadMentionCount > 0}
104+
mentionTrigger={mentionManager.config.trigger}
103105
memberCount={channel.memberCount > 2 ? channel.memberCount : undefined}
104106
frozen={channel.isFrozen}
105107
broadcast={channel.isBroadcast}

0 commit comments

Comments
 (0)