@linktr.ee/messaging-react 1.17.1 → 1.18.0

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.17.1",
3
+ "version": "1.18.0",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -55,7 +55,14 @@ const CustomChannelHeader: React.FC<{
55
55
  showBackButton: boolean
56
56
  onShowInfo: () => void
57
57
  canShowInfo: boolean
58
- }> = ({ onBack, showBackButton, onShowInfo, canShowInfo }) => {
58
+ showStarButton?: boolean
59
+ }> = ({
60
+ onBack,
61
+ showBackButton,
62
+ onShowInfo,
63
+ canShowInfo,
64
+ showStarButton = false,
65
+ }) => {
59
66
  const { channel } = useChannelStateContext()
60
67
 
61
68
  // Get participant info (excluding current user)
@@ -134,17 +141,21 @@ const CustomChannelHeader: React.FC<{
134
141
  </h1>
135
142
  </div>
136
143
  <div className="flex items-center gap-2">
137
- <button
138
- className="size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
139
- onClick={handleStarClick}
140
- type="button"
141
- aria-label={isStarred ? 'Unstar conversation' : 'Star conversation'}
142
- >
143
- <StarIcon
144
- className="size-5 text-black/90"
145
- weight={isStarred ? 'fill' : 'regular'}
146
- />
147
- </button>
144
+ {showStarButton && (
145
+ <button
146
+ className="size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
147
+ onClick={handleStarClick}
148
+ type="button"
149
+ aria-label={
150
+ isStarred ? 'Unstar conversation' : 'Star conversation'
151
+ }
152
+ >
153
+ <StarIcon
154
+ className="size-5 text-black/90"
155
+ weight={isStarred ? 'fill' : 'regular'}
156
+ />
157
+ </button>
158
+ )}
148
159
  <button
149
160
  className="size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
150
161
  onClick={onShowInfo}
@@ -181,17 +192,21 @@ const CustomChannelHeader: React.FC<{
181
192
  </div>
182
193
  </div>
183
194
  <div className="flex items-center gap-2">
184
- <button
185
- className="size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
186
- onClick={handleStarClick}
187
- type="button"
188
- aria-label={isStarred ? 'Unstar conversation' : 'Star conversation'}
189
- >
190
- <StarIcon
191
- className="size-5 text-black/90"
192
- weight={isStarred ? 'fill' : 'regular'}
193
- />
194
- </button>
195
+ {showStarButton && (
196
+ <button
197
+ className="size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
198
+ onClick={handleStarClick}
199
+ type="button"
200
+ aria-label={
201
+ isStarred ? 'Unstar conversation' : 'Star conversation'
202
+ }
203
+ >
204
+ <StarIcon
205
+ className="size-5 text-black/90"
206
+ weight={isStarred ? 'fill' : 'regular'}
207
+ />
208
+ </button>
209
+ )}
195
210
  {canShowInfo && onShowInfo && (
196
211
  <button
197
212
  className="size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
@@ -505,6 +520,7 @@ const ChannelViewInner: React.FC<{
505
520
  onDeleteConversationClick?: () => void
506
521
  onBlockParticipantClick?: () => void
507
522
  onReportParticipantClick?: () => void
523
+ showStarButton?: boolean
508
524
  }> = ({
509
525
  onBack,
510
526
  showBackButton,
@@ -515,6 +531,7 @@ const ChannelViewInner: React.FC<{
515
531
  onDeleteConversationClick,
516
532
  onBlockParticipantClick,
517
533
  onReportParticipantClick,
534
+ showStarButton = false,
518
535
  }) => {
519
536
  const { channel } = useChannelStateContext()
520
537
  const infoDialogRef = useRef<HTMLDialogElement>(null)
@@ -573,6 +590,7 @@ const ChannelViewInner: React.FC<{
573
590
  showBackButton={showBackButton}
574
591
  onShowInfo={handleShowInfo}
575
592
  canShowInfo={Boolean(participant)}
593
+ showStarButton={showStarButton}
576
594
  />
577
595
  </div>
578
596
 
@@ -630,6 +648,7 @@ export const ChannelView = React.memo<ChannelViewProps>(
630
648
  dmAgentEnabled,
631
649
  messageMetadata,
632
650
  onMessageSent,
651
+ showStarButton = false,
633
652
  }) => {
634
653
  // Custom send message handler that:
635
654
  // 1. Applies messageMetadata if provided
@@ -701,6 +720,7 @@ export const ChannelView = React.memo<ChannelViewProps>(
701
720
  onDeleteConversationClick={onDeleteConversationClick}
702
721
  onBlockParticipantClick={onBlockParticipantClick}
703
722
  onReportParticipantClick={onReportParticipantClick}
723
+ showStarButton={showStarButton}
704
724
  />
705
725
  </Channel>
706
726
  </div>
@@ -33,6 +33,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
33
33
  dmAgentEnabled,
34
34
  messageMetadata,
35
35
  onMessageSent,
36
+ showStarButton = false,
36
37
  }) => {
37
38
  const {
38
39
  service,
@@ -457,9 +458,15 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
457
458
  'messaging-conversation-view flex-1 flex-col min-w-0 min-h-0',
458
459
  {
459
460
  // In direct conversation mode (or waiting for it), always show (full width)
460
- flex: directConversationMode || isChannelSelected || initialParticipantFilter,
461
+ flex:
462
+ directConversationMode ||
463
+ isChannelSelected ||
464
+ initialParticipantFilter,
461
465
  // Normal mode: hide on mobile when no channel selected
462
- 'hidden lg:flex': !directConversationMode && !isChannelSelected && !initialParticipantFilter,
466
+ 'hidden lg:flex':
467
+ !directConversationMode &&
468
+ !isChannelSelected &&
469
+ !initialParticipantFilter,
463
470
  }
464
471
  )}
465
472
  >
@@ -481,6 +488,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
481
488
  dmAgentEnabled={dmAgentEnabled}
482
489
  messageMetadata={messageMetadata}
483
490
  onMessageSent={onMessageSent}
491
+ showStarButton={showStarButton}
484
492
  />
485
493
  </div>
486
494
  ) : initialParticipantFilter ? (
package/src/types.ts CHANGED
@@ -2,7 +2,11 @@ import type {
2
2
  MessagingUser,
3
3
  StreamChatServiceConfig,
4
4
  } from '@linktr.ee/messaging-core'
5
- import type { Channel, ChannelFilters, SendMessageAPIResponse } from 'stream-chat'
5
+ import type {
6
+ Channel,
7
+ ChannelFilters,
8
+ SendMessageAPIResponse,
9
+ } from 'stream-chat'
6
10
  import { EmptyStateIndicatorProps } from 'stream-chat-react'
7
11
 
8
12
  import type { MessageMetadata } from './stream-custom-data'
@@ -123,6 +127,13 @@ export interface ChannelViewProps {
123
127
  * }}
124
128
  */
125
129
  onMessageSent?: (response: SendMessageAPIResponse) => void
130
+
131
+ /**
132
+ * Show the star/pin button in channel header.
133
+ * Defaults to false. Only useful when users can view multiple channels
134
+ * and filter by starred/pinned status.
135
+ */
136
+ showStarButton?: boolean
126
137
  }
127
138
 
128
139
  /**
@@ -139,6 +150,7 @@ export type ChannelViewPassthroughProps = Pick<
139
150
  | 'dmAgentEnabled'
140
151
  | 'messageMetadata'
141
152
  | 'onMessageSent'
153
+ | 'showStarButton'
142
154
  >
143
155
 
144
156
  /**