@linktr.ee/messaging-react 1.6.0 → 1.6.2
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.
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ const CustomChannelPreview: React.FC<
|
|
|
14
14
|
onChannelSelect: (channel: Channel) => void
|
|
15
15
|
debug?: boolean
|
|
16
16
|
}
|
|
17
|
-
> = ({ channel, selectedChannel, onChannelSelect, debug = false }) => {
|
|
17
|
+
> = ({ channel, selectedChannel, onChannelSelect, debug = false, unread }) => {
|
|
18
18
|
const isSelected = selectedChannel?.id === channel?.id
|
|
19
19
|
|
|
20
20
|
const handleClick = () => {
|
|
@@ -42,15 +42,15 @@ const CustomChannelPreview: React.FC<
|
|
|
42
42
|
})
|
|
43
43
|
: ''
|
|
44
44
|
|
|
45
|
-
//
|
|
46
|
-
const
|
|
45
|
+
// Use the unread prop passed by Stream Chat (reactive and updates automatically)
|
|
46
|
+
const unreadCount = unread ?? 0
|
|
47
47
|
|
|
48
48
|
if (debug) {
|
|
49
49
|
console.log('📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER', {
|
|
50
50
|
channelId: channel?.id,
|
|
51
51
|
isSelected,
|
|
52
52
|
participantName,
|
|
53
|
-
|
|
53
|
+
unreadCount,
|
|
54
54
|
hasTimestamp: !!lastMessageTime,
|
|
55
55
|
})
|
|
56
56
|
}
|
|
@@ -100,9 +100,9 @@ const CustomChannelPreview: React.FC<
|
|
|
100
100
|
<p className="text-xs text-stone mr-2 flex-1 line-clamp-2">
|
|
101
101
|
{lastMessageText}
|
|
102
102
|
</p>
|
|
103
|
-
{
|
|
103
|
+
{unreadCount > 0 && (
|
|
104
104
|
<span className="bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0">
|
|
105
|
-
{
|
|
105
|
+
{unreadCount > 99 ? '99+' : unreadCount}
|
|
106
106
|
</span>
|
|
107
107
|
)}
|
|
108
108
|
</div>
|