@linktr.ee/messaging-react 1.12.6 → 1.12.8-rc-1765966726
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
|
@@ -37,15 +37,23 @@ const CustomChannelPreview = React.memo<CustomChannelPreviewProps>(
|
|
|
37
37
|
const lastMessage =
|
|
38
38
|
channel?.state?.messages?.[channel.state.messages.length - 1]
|
|
39
39
|
|
|
40
|
-
// Fallback order: text -> attachment URL -> "No messages yet"
|
|
41
40
|
const getLastMessageText = () => {
|
|
42
41
|
if (lastMessage?.text) return lastMessage.text
|
|
43
42
|
|
|
44
43
|
const attachment = lastMessage?.attachments?.[0]
|
|
45
|
-
if (attachment
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
if (attachment) {
|
|
45
|
+
// Link previews - show the actual URL
|
|
46
|
+
if (attachment.og_scrape_url) return attachment.og_scrape_url
|
|
47
|
+
|
|
48
|
+
// Type-based detection
|
|
49
|
+
if (attachment.type === 'image') return '📷 Sent an image'
|
|
50
|
+
if (attachment.type === 'video') return '🎥 Sent a video'
|
|
51
|
+
if (attachment.type === 'audio') return '🎵 Sent audio'
|
|
52
|
+
if (attachment.type === 'file') return '📎 Sent a file'
|
|
53
|
+
|
|
54
|
+
// Fallback
|
|
55
|
+
return '📎 Sent an attachment'
|
|
56
|
+
}
|
|
49
57
|
|
|
50
58
|
return 'No messages yet'
|
|
51
59
|
}
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
Window,
|
|
15
15
|
MessageList,
|
|
16
16
|
useChannelStateContext,
|
|
17
|
+
WithComponents,
|
|
18
|
+
MessageUIComponentProps,
|
|
17
19
|
} from 'stream-chat-react'
|
|
18
20
|
|
|
19
21
|
import { useMessagingContext } from '../providers/MessagingProvider'
|
|
@@ -22,6 +24,7 @@ import type { ChannelViewProps } from '../types'
|
|
|
22
24
|
import ActionButton from './ActionButton'
|
|
23
25
|
import { Avatar } from './Avatar'
|
|
24
26
|
import { CloseButton } from './CloseButton'
|
|
27
|
+
import { CustomMessage } from './CustomMessage'
|
|
25
28
|
import { CustomMessageInput } from './CustomMessageInput'
|
|
26
29
|
import { CustomSystemMessage } from './CustomSystemMessage'
|
|
27
30
|
import { ChannelEmptyState } from './MessagingShell/ChannelEmptyState'
|
|
@@ -487,31 +490,39 @@ const ChannelViewInner: React.FC<{
|
|
|
487
490
|
|
|
488
491
|
return (
|
|
489
492
|
<>
|
|
490
|
-
<
|
|
491
|
-
{
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
493
|
+
<WithComponents
|
|
494
|
+
overrides={{
|
|
495
|
+
Message: (props: MessageUIComponentProps) => (
|
|
496
|
+
<CustomMessage {...props} />
|
|
497
|
+
),
|
|
498
|
+
}}
|
|
499
|
+
>
|
|
500
|
+
<Window>
|
|
501
|
+
{/* Custom Channel Header */}
|
|
502
|
+
<div className="p-4">
|
|
503
|
+
<CustomChannelHeader
|
|
504
|
+
onBack={onBack}
|
|
505
|
+
showBackButton={showBackButton}
|
|
506
|
+
onShowInfo={handleShowInfo}
|
|
507
|
+
canShowInfo={Boolean(participant)}
|
|
508
|
+
/>
|
|
509
|
+
</div>
|
|
500
510
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
511
|
+
{/* Message List */}
|
|
512
|
+
<div className="flex-1 overflow-hidden relative">
|
|
513
|
+
<MessageList
|
|
514
|
+
hideDeletedMessages
|
|
515
|
+
hideNewMessageSeparator={false}
|
|
516
|
+
messageActions={undefined}
|
|
517
|
+
/>
|
|
518
|
+
</div>
|
|
509
519
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
520
|
+
{/* Message Input */}
|
|
521
|
+
<CustomMessageInput
|
|
522
|
+
renderActions={() => renderMessageInputActions?.(channel)}
|
|
523
|
+
/>
|
|
524
|
+
</Window>
|
|
525
|
+
</WithComponents>
|
|
515
526
|
|
|
516
527
|
{/* Channel Info Dialog */}
|
|
517
528
|
<ChannelInfoDialog
|