@linktr.ee/messaging-react 3.5.6-rc-1783064039 → 3.5.6-rc-1783100793
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/dist/{Card-BY5GWs2L.cjs → Card-4eHS-HQB.cjs} +2 -2
- package/dist/{Card-BY5GWs2L.cjs.map → Card-4eHS-HQB.cjs.map} +1 -1
- package/dist/{Card-DdUewLf6.cjs → Card-Bxu71IQM.cjs} +2 -2
- package/dist/{Card-DdUewLf6.cjs.map → Card-Bxu71IQM.cjs.map} +1 -1
- package/dist/{Card-CsQmLvWE.cjs → Card-By-eDX0U.cjs} +2 -2
- package/dist/{Card-CsQmLvWE.cjs.map → Card-By-eDX0U.cjs.map} +1 -1
- package/dist/{Card-CuWniEOV.js → Card-CmLNgIdO.js} +2 -2
- package/dist/{Card-CuWniEOV.js.map → Card-CmLNgIdO.js.map} +1 -1
- package/dist/{Card-CpgkVykU.js → Card-XSDNvOZf.js} +3 -3
- package/dist/{Card-CpgkVykU.js.map → Card-XSDNvOZf.js.map} +1 -1
- package/dist/{Card-DQdw5-A_.js → Card-mDB7sZiu.js} +2 -2
- package/dist/{Card-DQdw5-A_.js.map → Card-mDB7sZiu.js.map} +1 -1
- package/dist/{LockedThumbnail-D5hLQ6Kz.js → LockedThumbnail-C44Wkle9.js} +3 -3
- package/dist/{LockedThumbnail-D5hLQ6Kz.js.map → LockedThumbnail-C44Wkle9.js.map} +1 -1
- package/dist/{LockedThumbnail-s_LZkGm4.cjs → LockedThumbnail-CWhzO3wx.cjs} +2 -2
- package/dist/{LockedThumbnail-s_LZkGm4.cjs.map → LockedThumbnail-CWhzO3wx.cjs.map} +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/{index-3vM1UOPb.js → index-BRV621wo.js} +1601 -1794
- package/dist/index-BRV621wo.js.map +1 -0
- package/dist/index-DBVgTHrA.cjs +2 -0
- package/dist/index-DBVgTHrA.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/AttachmentCard/index.tsx +1 -1
- package/src/components/ChannelView.stories.tsx +11 -65
- package/src/components/ChannelView.test.tsx +12 -30
- package/src/components/ChannelView.tsx +22 -50
- package/src/components/CustomLinkPreviewList/CustomLinkPreviewCard.tsx +1 -1
- package/src/components/CustomLinkPreviewList/index.tsx +6 -12
- package/src/components/CustomMessage/CustomMessage.stories.tsx +27 -0
- package/src/components/CustomMessage/MessageAttachmentConversations.stories.tsx +2 -2
- package/src/components/CustomMessage/MessageTag.stories.tsx +2 -2
- package/src/components/CustomMessageInput/index.tsx +4 -12
- package/src/components/LinkAttachment/components/_shared/CardShell.tsx +1 -1
- package/src/components/LockedAttachment/components/_shared/LockedCardShell.tsx +1 -1
- package/src/components/MediaMessage/index.tsx +8 -1
- package/src/components/MessageAttachment/_shared/Bubble.tsx +7 -7
- package/src/components/MessageAttachment/_shared/CompactDocumentRow.tsx +3 -3
- package/src/styles.css +75 -6
- package/dist/index-3vM1UOPb.js.map +0 -1
- package/dist/index-BIJpO0jL.cjs +0 -2
- package/dist/index-BIJpO0jL.cjs.map +0 -1
- package/src/components/ChannelHeaderRedesign.tsx +0 -231
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ArrowLeftIcon,
|
|
3
|
-
CaretRightIcon,
|
|
4
|
-
CurrencyDollarIcon,
|
|
5
|
-
StarIcon,
|
|
6
|
-
} from '@phosphor-icons/react'
|
|
7
|
-
import classNames from 'classnames'
|
|
8
|
-
import React from 'react'
|
|
9
|
-
import type { ChannelMemberResponse, Channel as ChannelType } from 'stream-chat'
|
|
10
|
-
import { useChannelStateContext, useChatContext } from 'stream-chat-react'
|
|
11
|
-
|
|
12
|
-
import { useChannelStar } from '../hooks/useChannelStar'
|
|
13
|
-
import type { ChannelViewProps } from '../types'
|
|
14
|
-
import { resolveConversationParticipant } from '../utils/resolveConversationParticipant'
|
|
15
|
-
import { resolveParticipantDisplayName } from '../utils/resolveParticipantDisplayName'
|
|
16
|
-
|
|
17
|
-
import { Avatar } from './Avatar'
|
|
18
|
-
import { ChannelActionsMenu } from './ChannelActionsMenu'
|
|
19
|
-
|
|
20
|
-
const ICON_BTN_CLASS =
|
|
21
|
-
'pointer-events-auto flex size-10 flex-shrink-0 items-center justify-center rounded-full bg-white/65 shadow-[0px_4px_8px_0px_rgba(0,0,0,0.06),0px_0px_0px_1px_rgba(0,0,0,0.04)] backdrop-blur-[40px] transition-filter duration-150 hover:brightness-95 aria-expanded:brightness-95 focus-ring'
|
|
22
|
-
|
|
23
|
-
const CUSTOMER_PAID_TAG = 'CUSTOMER_PAID'
|
|
24
|
-
|
|
25
|
-
const isCustomerPaidTag = (value: unknown) =>
|
|
26
|
-
typeof value === 'string' &&
|
|
27
|
-
value
|
|
28
|
-
.trim()
|
|
29
|
-
.replace(/[\s-]+/g, '_')
|
|
30
|
-
.toUpperCase() === CUSTOMER_PAID_TAG
|
|
31
|
-
|
|
32
|
-
const hasCustomerPaidTag = (participant?: ChannelMemberResponse) => {
|
|
33
|
-
const member = participant as
|
|
34
|
-
| {
|
|
35
|
-
customerTag?: unknown
|
|
36
|
-
customer_tag?: unknown
|
|
37
|
-
}
|
|
38
|
-
| undefined
|
|
39
|
-
|
|
40
|
-
return [member?.customerTag, member?.customer_tag].some(isCustomerPaidTag)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface ChannelHeaderRedesignProps {
|
|
44
|
-
onBack?: () => void
|
|
45
|
-
showBackButton: boolean
|
|
46
|
-
showStarButton?: boolean
|
|
47
|
-
dmAgentEnabled?: boolean
|
|
48
|
-
onLeaveConversation?: (channel: ChannelType) => void
|
|
49
|
-
onBlockParticipant?: (participantId?: string) => void
|
|
50
|
-
showDeleteConversation?: boolean
|
|
51
|
-
showBlockParticipant?: boolean
|
|
52
|
-
showReportParticipant?: boolean
|
|
53
|
-
onDeleteConversationClick?: () => void
|
|
54
|
-
onBlockParticipantClick?: () => void
|
|
55
|
-
onReportParticipantClick?: () => void
|
|
56
|
-
customChannelActions?: React.ReactNode
|
|
57
|
-
renderChannelActions?: React.ReactNode
|
|
58
|
-
showChannelInfo?: boolean
|
|
59
|
-
onParticipantNameClick: () => void
|
|
60
|
-
renderHeaderTitleBadges?: ChannelViewProps['renderHeaderTitleBadges']
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export const ChannelHeaderRedesign: React.FC<ChannelHeaderRedesignProps> = ({
|
|
64
|
-
onBack,
|
|
65
|
-
showBackButton,
|
|
66
|
-
showStarButton = false,
|
|
67
|
-
dmAgentEnabled = false,
|
|
68
|
-
onLeaveConversation,
|
|
69
|
-
onBlockParticipant,
|
|
70
|
-
showDeleteConversation = true,
|
|
71
|
-
showBlockParticipant = true,
|
|
72
|
-
showReportParticipant = true,
|
|
73
|
-
onDeleteConversationClick,
|
|
74
|
-
onBlockParticipantClick,
|
|
75
|
-
onReportParticipantClick,
|
|
76
|
-
customChannelActions,
|
|
77
|
-
renderChannelActions,
|
|
78
|
-
showChannelInfo = true,
|
|
79
|
-
onParticipantNameClick,
|
|
80
|
-
renderHeaderTitleBadges,
|
|
81
|
-
}) => {
|
|
82
|
-
const { channel } = useChannelStateContext()
|
|
83
|
-
const { client } = useChatContext()
|
|
84
|
-
|
|
85
|
-
const participant = React.useMemo(
|
|
86
|
-
() =>
|
|
87
|
-
resolveConversationParticipant(
|
|
88
|
-
channel.state?.members,
|
|
89
|
-
client?.userID,
|
|
90
|
-
channel.type
|
|
91
|
-
),
|
|
92
|
-
[channel.state?.members, client?.userID, channel.type]
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
const participantName = resolveParticipantDisplayName(participant?.user)
|
|
96
|
-
const participantImage = participant?.user?.image
|
|
97
|
-
const isStarred = useChannelStar(channel)
|
|
98
|
-
const isPaidCustomer = hasCustomerPaidTag(participant)
|
|
99
|
-
const headerTitleBadges = renderHeaderTitleBadges?.({
|
|
100
|
-
channel,
|
|
101
|
-
participant,
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
const handleStarClick = async () => {
|
|
105
|
-
try {
|
|
106
|
-
if (isStarred) {
|
|
107
|
-
await (channel as ChannelType).unpin()
|
|
108
|
-
} else {
|
|
109
|
-
await (channel as ChannelType).pin()
|
|
110
|
-
}
|
|
111
|
-
} catch (error) {
|
|
112
|
-
console.error(
|
|
113
|
-
'[ChannelHeaderRedesign] Failed to update pinned status:',
|
|
114
|
-
error
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return (
|
|
120
|
-
<div className="@container pointer-events-none sticky top-0 z-10 w-full bg-[linear-gradient(180deg,#FBFAF9_0%,rgba(251,250,249,0.92)_58%,rgba(251,250,249,0)_100%)]">
|
|
121
|
-
<div className="grid min-h-[100px] grid-cols-[40px_minmax(0,1fr)_40px] items-start pb-2 pt-5 @lg:min-h-[104px] @lg:pt-6">
|
|
122
|
-
<div className="flex items-start">
|
|
123
|
-
{showBackButton && (
|
|
124
|
-
<button
|
|
125
|
-
className={classNames(
|
|
126
|
-
ICON_BTN_CLASS,
|
|
127
|
-
'messaging-channel-view-back-button-mobile messaging-channel-view-back-button-desktop'
|
|
128
|
-
)}
|
|
129
|
-
onClick={onBack || (() => {})}
|
|
130
|
-
type="button"
|
|
131
|
-
aria-label="Back to conversations"
|
|
132
|
-
>
|
|
133
|
-
<ArrowLeftIcon className="size-5 text-black/90" />
|
|
134
|
-
</button>
|
|
135
|
-
)}
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
<div className="flex min-w-0 justify-center" data-dd-privacy="mask">
|
|
139
|
-
<button
|
|
140
|
-
type="button"
|
|
141
|
-
onClick={onParticipantNameClick}
|
|
142
|
-
aria-label={`View details for ${participantName}`}
|
|
143
|
-
className="group pointer-events-auto flex min-w-0 max-w-full appearance-none flex-col items-center border-0 bg-transparent px-2 focus-ring focus-visible:outline-none"
|
|
144
|
-
>
|
|
145
|
-
<Avatar
|
|
146
|
-
id={participant?.user?.id || channel.id || 'unknown'}
|
|
147
|
-
name={participantName}
|
|
148
|
-
image={participantImage}
|
|
149
|
-
dmAgentEnabled={dmAgentEnabled}
|
|
150
|
-
shape="circle"
|
|
151
|
-
size={48}
|
|
152
|
-
className="-mb-2"
|
|
153
|
-
/>
|
|
154
|
-
<span className="relative z-10 inline-flex max-w-full items-center justify-center rounded-full border border-white/10 bg-white/65 py-1.5 pl-3 pr-2 shadow-[0px_0px_0px_0px_rgba(0,0,0,0.04),0px_1px_2px_0px_rgba(0,0,0,0.04),0px_8px_32px_0px_rgba(0,0,0,0.1)] backdrop-blur-[2px] transition-colors duration-150 group-hover:bg-white/80">
|
|
155
|
-
<span className="min-w-0 truncate text-sm font-bold leading-[1.43] tracking-[0.28px] text-black/90">
|
|
156
|
-
{participantName}
|
|
157
|
-
</span>
|
|
158
|
-
<div className="ml-2 flex gap-1">
|
|
159
|
-
{isPaidCustomer && (
|
|
160
|
-
<span
|
|
161
|
-
aria-label="Paid customer"
|
|
162
|
-
className="flex size-4 shrink-0 items-center justify-center rounded-full bg-[#34C759] text-white"
|
|
163
|
-
>
|
|
164
|
-
<CurrencyDollarIcon className="size-2.5" weight="bold" />
|
|
165
|
-
</span>
|
|
166
|
-
)}
|
|
167
|
-
{showStarButton && isStarred && (
|
|
168
|
-
<span
|
|
169
|
-
aria-label="Starred conversation"
|
|
170
|
-
className="flex size-4 shrink-0 items-center justify-center rounded-full bg-[#FFD60A] text-white"
|
|
171
|
-
>
|
|
172
|
-
<StarIcon className="size-2.5" weight="fill" />
|
|
173
|
-
</span>
|
|
174
|
-
)}
|
|
175
|
-
{headerTitleBadges && (
|
|
176
|
-
<span className="shrink-0">{headerTitleBadges}</span>
|
|
177
|
-
)}
|
|
178
|
-
<CaretRightIcon
|
|
179
|
-
aria-hidden="true"
|
|
180
|
-
className="size-4 shrink-0 text-black/65"
|
|
181
|
-
weight="bold"
|
|
182
|
-
/>
|
|
183
|
-
</div>
|
|
184
|
-
</span>
|
|
185
|
-
</button>
|
|
186
|
-
</div>
|
|
187
|
-
|
|
188
|
-
<div className="flex items-start justify-end gap-2">
|
|
189
|
-
{showStarButton && (
|
|
190
|
-
<button
|
|
191
|
-
className={ICON_BTN_CLASS}
|
|
192
|
-
onClick={handleStarClick}
|
|
193
|
-
type="button"
|
|
194
|
-
aria-pressed={isStarred}
|
|
195
|
-
aria-label={
|
|
196
|
-
isStarred ? 'Unstar conversation' : 'Star conversation'
|
|
197
|
-
}
|
|
198
|
-
>
|
|
199
|
-
<StarIcon
|
|
200
|
-
className={classNames('size-5', {
|
|
201
|
-
'text-[#FFD60A]': isStarred,
|
|
202
|
-
'text-black/90': !isStarred,
|
|
203
|
-
})}
|
|
204
|
-
weight={isStarred ? 'fill' : 'regular'}
|
|
205
|
-
/>
|
|
206
|
-
</button>
|
|
207
|
-
)}
|
|
208
|
-
{showChannelInfo &&
|
|
209
|
-
(renderChannelActions !== undefined ? (
|
|
210
|
-
renderChannelActions
|
|
211
|
-
) : (
|
|
212
|
-
<ChannelActionsMenu
|
|
213
|
-
channel={channel as ChannelType}
|
|
214
|
-
participant={participant}
|
|
215
|
-
showDeleteConversation={showDeleteConversation}
|
|
216
|
-
showBlockParticipant={showBlockParticipant}
|
|
217
|
-
showReportParticipant={showReportParticipant}
|
|
218
|
-
onLeaveConversation={onLeaveConversation}
|
|
219
|
-
onBlockParticipant={onBlockParticipant}
|
|
220
|
-
onDeleteConversationClick={onDeleteConversationClick}
|
|
221
|
-
onBlockParticipantClick={onBlockParticipantClick}
|
|
222
|
-
onReportParticipantClick={onReportParticipantClick}
|
|
223
|
-
customChannelActions={customChannelActions}
|
|
224
|
-
triggerClassName={ICON_BTN_CLASS}
|
|
225
|
-
/>
|
|
226
|
-
))}
|
|
227
|
-
</div>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
)
|
|
231
|
-
}
|