@linktr.ee/messaging-react 3.5.0-rc-1782792813 → 3.5.0-rc-1782792958

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": "3.5.0-rc-1782792813",
3
+ "version": "3.5.0-rc-1782792958",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@linktr.ee/component-library": "11.8.6",
41
- "@linktr.ee/messaging-core": "2.3.0-rc-1782792813",
41
+ "@linktr.ee/messaging-core": "2.3.0-rc-1782792958",
42
42
  "@phosphor-icons/react": "^2.1.10"
43
43
  },
44
44
  "devDependencies": {
@@ -1,5 +1,6 @@
1
1
  import type { Meta, StoryFn } from '@storybook/react'
2
2
  import React from 'react'
3
+ import type { ChannelPreviewUIComponentProps } from 'stream-chat-react'
3
4
 
4
5
  import { MockChatProviderWithChannels } from '../../stories/mocks'
5
6
 
@@ -37,6 +38,35 @@ const Template: StoryFn<ComponentProps> = (args) => {
37
38
  )
38
39
  }
39
40
 
41
+ const HostChannelPreview: React.FC<ChannelPreviewUIComponentProps> = ({
42
+ channel,
43
+ unread,
44
+ }) => {
45
+ const participant = Object.values(channel?.state?.members || {}).find(
46
+ (member) => member.user?.id !== channel?._client?.userID
47
+ )
48
+
49
+ return (
50
+ <div className="mx-3 mt-3 rounded-[20px] border border-[#e0dfdb] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.06)]">
51
+ <div className="flex items-center justify-between">
52
+ <div className="min-w-0">
53
+ <p className="truncate text-sm font-semibold text-[#191918]">
54
+ {participant?.user?.name ?? 'Unknown visitor'}
55
+ </p>
56
+ <p className="mt-1 line-clamp-1 text-xs text-[#717070]">
57
+ Host-owned channel preview
58
+ </p>
59
+ </div>
60
+ {Boolean(unread) && (
61
+ <span className="ml-3 rounded-full bg-[#7f22fe] px-2 py-1 text-xs font-medium text-white">
62
+ {unread}
63
+ </span>
64
+ )}
65
+ </div>
66
+ </div>
67
+ )
68
+ }
69
+
40
70
  export const Default: StoryFn<ComponentProps> = Template.bind({})
41
71
  Default.args = {
42
72
  filters: { type: 'messaging' },
@@ -49,4 +79,11 @@ WithSelection.args = {
49
79
  onChannelSelect: (channel) => console.log('Channel selected:', channel.id),
50
80
  }
51
81
 
82
+ export const Custom: StoryFn<ComponentProps> = Template.bind({})
83
+ Custom.args = {
84
+ filters: { type: 'messaging' },
85
+ onChannelSelect: (channel) => console.log('Channel selected:', channel.id),
86
+ channelPreview: HostChannelPreview,
87
+ }
88
+
52
89
 
@@ -6,7 +6,6 @@ import {
6
6
  LocalMessage,
7
7
  StreamChat,
8
8
  } from 'stream-chat'
9
- import type { ChannelPreviewUIComponentProps } from 'stream-chat-react'
10
9
 
11
10
  import {
12
11
  daysAgo,
@@ -15,12 +14,9 @@ import {
15
14
  now,
16
15
  secondsAgo,
17
16
  } from '../../stories/decorators/storyTime'
18
- import { MockChatProviderWithChannels } from '../../stories/mocks'
19
17
 
20
18
  import CustomChannelPreview from './CustomChannelPreview'
21
19
 
22
- import { ChannelList } from '.'
23
-
24
20
  type ComponentProps = React.ComponentProps<typeof CustomChannelPreview>
25
21
 
26
22
  const meta: Meta<ComponentProps> = {
@@ -866,46 +862,3 @@ WithLongAttachmentUrl.args = {
866
862
  }),
867
863
  }
868
864
  WithLongAttachmentUrl.parameters = skipInChromatic
869
-
870
- const HostChannelPreview: React.FC<ChannelPreviewUIComponentProps> = ({
871
- channel,
872
- unread,
873
- }) => {
874
- const participant = Object.values(channel?.state?.members || {}).find(
875
- (member) => member.user?.id !== channel?._client?.userID
876
- )
877
-
878
- return (
879
- <div className="mx-3 mt-3 rounded-[20px] border border-[#e0dfdb] bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.06)]">
880
- <div className="flex items-center justify-between">
881
- <div className="min-w-0">
882
- <p className="truncate text-sm font-semibold text-[#191918]">
883
- {participant?.user?.name ?? 'Unknown visitor'}
884
- </p>
885
- <p className="mt-1 line-clamp-1 text-xs text-[#717070]">
886
- Host-owned channel preview
887
- </p>
888
- </div>
889
- {Boolean(unread) && (
890
- <span className="ml-3 rounded-full bg-[#7f22fe] px-2 py-1 text-xs font-medium text-white">
891
- {unread}
892
- </span>
893
- )}
894
- </div>
895
- </div>
896
- )
897
- }
898
-
899
- export const Custom: StoryFn = () => (
900
- <MockChatProviderWithChannels>
901
- <div className="h-screen w-full md:w-[360px] bg-chalk">
902
- <ChannelList
903
- filters={{ type: 'messaging' }}
904
- onChannelSelect={(channel) => {
905
- console.log('Channel selected:', channel.id)
906
- }}
907
- channelPreview={HostChannelPreview}
908
- />
909
- </div>
910
- </MockChatProviderWithChannels>
911
- )