@linktr.ee/messaging-react 3.6.1 → 3.6.2-rc-1783305084

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.
Files changed (30) hide show
  1. package/dist/{Card-d0_xEfdM.cjs → Card-BThi6-oD.cjs} +2 -2
  2. package/dist/{Card-d0_xEfdM.cjs.map → Card-BThi6-oD.cjs.map} +1 -1
  3. package/dist/{Card-BrC7mKtr.js → Card-Cz8tanga.js} +2 -2
  4. package/dist/{Card-BrC7mKtr.js.map → Card-Cz8tanga.js.map} +1 -1
  5. package/dist/{Card-BuR6mbUu.cjs → Card-DEk34Twe.cjs} +2 -2
  6. package/dist/{Card-BuR6mbUu.cjs.map → Card-DEk34Twe.cjs.map} +1 -1
  7. package/dist/{Card-B0lzpuYf.js → Card-DSQclaiH.js} +3 -3
  8. package/dist/{Card-B0lzpuYf.js.map → Card-DSQclaiH.js.map} +1 -1
  9. package/dist/{Card-DcUPqd79.cjs → Card-Jc1n2Iqu.cjs} +2 -2
  10. package/dist/{Card-DcUPqd79.cjs.map → Card-Jc1n2Iqu.cjs.map} +1 -1
  11. package/dist/{Card-CxS7GNqp.js → Card-NDZLmjxS.js} +2 -2
  12. package/dist/{Card-CxS7GNqp.js.map → Card-NDZLmjxS.js.map} +1 -1
  13. package/dist/{LockedThumbnail-BDtKMJjz.cjs → LockedThumbnail-CqcnnPXB.cjs} +2 -2
  14. package/dist/{LockedThumbnail-BDtKMJjz.cjs.map → LockedThumbnail-CqcnnPXB.cjs.map} +1 -1
  15. package/dist/{LockedThumbnail-BaDgF8qJ.js → LockedThumbnail-t9fLaFmy.js} +2 -2
  16. package/dist/{LockedThumbnail-BaDgF8qJ.js.map → LockedThumbnail-t9fLaFmy.js.map} +1 -1
  17. package/dist/index-CPCX_7gP.cjs +2 -0
  18. package/dist/index-CPCX_7gP.cjs.map +1 -0
  19. package/dist/{index-BPfehHDD.js → index-bPlX3Oo5.js} +1885 -1693
  20. package/dist/index-bPlX3Oo5.js.map +1 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +1 -1
  23. package/package.json +2 -2
  24. package/src/components/ChannelHeaderRedesign.tsx +231 -0
  25. package/src/components/ChannelView.stories.tsx +68 -11
  26. package/src/components/ChannelView.test.tsx +54 -13
  27. package/src/components/ChannelView.tsx +74 -28
  28. package/dist/index-BPfehHDD.js.map +0 -1
  29. package/dist/index-G4pnfm4m.cjs +0 -2
  30. package/dist/index-G4pnfm4m.cjs.map +0 -1
@@ -25,6 +25,7 @@ import { resolveParticipantDisplayName } from '../utils/resolveParticipantDispla
25
25
 
26
26
  import { Avatar } from './Avatar'
27
27
  import { ChannelActionsMenu } from './ChannelActionsMenu'
28
+ import { ChannelHeaderRedesign } from './ChannelHeaderRedesign'
28
29
  import { CustomDateSeparator } from './CustomDateSeparator'
29
30
  import { CustomMessage } from './CustomMessage'
30
31
  import { CustomMessageActions } from './CustomMessage/CustomMessageActions'
@@ -464,6 +465,34 @@ const ChannelViewInner: React.FC<{
464
465
  dmAgentEnabled &&
465
466
  currentUserIsAccount === false &&
466
467
  participantIsAccount === true
468
+ const hasVisibleMessages = channel.state.messages.some(
469
+ (message) => message.type !== 'deleted'
470
+ )
471
+ const channelBanner = renderChannelBanner ? (
472
+ <React.Fragment key="lt-channel-banner">
473
+ {renderChannelBanner()}
474
+ </React.Fragment>
475
+ ) : null
476
+ const redesignedHeader = onParticipantNameClick ? (
477
+ <ChannelHeaderRedesign
478
+ onBack={onBack}
479
+ showBackButton={showBackButton}
480
+ showChannelInfo={showChannelInfo}
481
+ showStarButton={showStarButton}
482
+ dmAgentEnabled={showDmAgentHeader}
483
+ onLeaveConversation={onLeaveConversation}
484
+ onBlockParticipant={onBlockParticipant}
485
+ showDeleteConversation={showDeleteConversation}
486
+ showBlockParticipant={showBlockParticipant}
487
+ showReportParticipant={showReportParticipant}
488
+ onDeleteConversationClick={onDeleteConversationClick}
489
+ onBlockParticipantClick={onBlockParticipantClick}
490
+ onReportParticipantClick={onReportParticipantClick}
491
+ customChannelActions={customChannelActions}
492
+ renderChannelActions={renderChannelActions}
493
+ onParticipantNameClick={onParticipantNameClick}
494
+ />
495
+ ) : null
467
496
 
468
497
  // Prevents all message instances from unmounting when ChannelViewInner re-renders
469
498
  const MessageOverride = useCallback(
@@ -497,41 +526,58 @@ const ChannelViewInner: React.FC<{
497
526
  >
498
527
  <Window>
499
528
  {/* Custom Channel Header */}
500
- <div key="lt-channel-header">
501
- <CustomChannelHeader
502
- onBack={onBack}
503
- showBackButton={showBackButton}
504
- showChannelInfo={showChannelInfo}
505
- showStarButton={showStarButton}
506
- dmAgentEnabled={showDmAgentHeader}
507
- onLeaveConversation={onLeaveConversation}
508
- onBlockParticipant={onBlockParticipant}
509
- showDeleteConversation={showDeleteConversation}
510
- showBlockParticipant={showBlockParticipant}
511
- showReportParticipant={showReportParticipant}
512
- onDeleteConversationClick={onDeleteConversationClick}
513
- onBlockParticipantClick={onBlockParticipantClick}
514
- onReportParticipantClick={onReportParticipantClick}
515
- customChannelActions={customChannelActions}
516
- renderChannelActions={renderChannelActions}
517
- onParticipantNameClick={onParticipantNameClick}
518
- renderHeaderTitleBadges={renderHeaderTitleBadges}
519
- />
520
- </div>
529
+ {!onParticipantNameClick && (
530
+ <>
531
+ <div key="lt-channel-header">
532
+ <CustomChannelHeader
533
+ onBack={onBack}
534
+ showBackButton={showBackButton}
535
+ showChannelInfo={showChannelInfo}
536
+ showStarButton={showStarButton}
537
+ dmAgentEnabled={showDmAgentHeader}
538
+ onLeaveConversation={onLeaveConversation}
539
+ onBlockParticipant={onBlockParticipant}
540
+ showDeleteConversation={showDeleteConversation}
541
+ showBlockParticipant={showBlockParticipant}
542
+ showReportParticipant={showReportParticipant}
543
+ onDeleteConversationClick={onDeleteConversationClick}
544
+ onBlockParticipantClick={onBlockParticipantClick}
545
+ onReportParticipantClick={onReportParticipantClick}
546
+ customChannelActions={customChannelActions}
547
+ renderChannelActions={renderChannelActions}
548
+ renderHeaderTitleBadges={renderHeaderTitleBadges}
549
+ />
550
+ </div>
551
+ {channelBanner}
552
+ </>
553
+ )}
521
554
 
522
- {/* Custom Banner/Summary */}
523
- {renderChannelBanner ? (
524
- <React.Fragment key="lt-channel-banner">
525
- {renderChannelBanner()}
526
- </React.Fragment>
527
- ) : null}
555
+ {/* Stream only renders MessageList.head when there are messages, so
556
+ empty redesigned channels need the header and banner in normal flow. */}
557
+ {onParticipantNameClick && !hasVisibleMessages && (
558
+ <div className="px-4 @lg:px-6">
559
+ {redesignedHeader}
560
+ {channelBanner}
561
+ </div>
562
+ )}
528
563
 
529
564
  {/* Message List */}
530
565
  <div
531
566
  key="lt-channel-message-list"
532
567
  className="flex-1 overflow-hidden relative"
533
568
  >
534
- <MessageList hideDeletedMessages hideNewMessageSeparator={false} />
569
+ <MessageList
570
+ head={
571
+ onParticipantNameClick && hasVisibleMessages ? (
572
+ <div className="sticky top-0 z-10">
573
+ {redesignedHeader}
574
+ {channelBanner}
575
+ </div>
576
+ ) : undefined
577
+ }
578
+ hideDeletedMessages
579
+ hideNewMessageSeparator={false}
580
+ />
535
581
  </div>
536
582
 
537
583
  {renderConversationFooter ? (