@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "1.12.6",
3
+ "version": "1.12.8-rc-1765966726",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -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?.asset_url) return attachment.asset_url
46
- if (attachment?.image_url) return attachment.image_url
47
- if (attachment?.og_scrape_url) return attachment.og_scrape_url
48
- if (attachment?.thumb_url) return attachment.thumb_url
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
- <Window>
491
- {/* Custom Channel Header */}
492
- <div className="p-4">
493
- <CustomChannelHeader
494
- onBack={onBack}
495
- showBackButton={showBackButton}
496
- onShowInfo={handleShowInfo}
497
- canShowInfo={Boolean(participant)}
498
- />
499
- </div>
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
- {/* Message List */}
502
- <div className="flex-1 overflow-hidden relative">
503
- <MessageList
504
- hideDeletedMessages
505
- hideNewMessageSeparator={false}
506
- messageActions={[]}
507
- />
508
- </div>
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
- {/* Message Input */}
511
- <CustomMessageInput
512
- renderActions={() => renderMessageInputActions?.(channel)}
513
- />
514
- </Window>
520
+ {/* Message Input */}
521
+ <CustomMessageInput
522
+ renderActions={() => renderMessageInputActions?.(channel)}
523
+ />
524
+ </Window>
525
+ </WithComponents>
515
526
 
516
527
  {/* Channel Info Dialog */}
517
528
  <ChannelInfoDialog
@@ -0,0 +1,9 @@
1
+ import { MessageSimple, type MessageUIComponentProps } from 'stream-chat-react'
2
+
3
+ export const CustomMessage = (props: MessageUIComponentProps) => {
4
+ return (
5
+ <div className="custom-message">
6
+ <MessageSimple {...props} />
7
+ </div>
8
+ )
9
+ }