@linktr.ee/messaging-react 1.9.0 → 1.9.1-rc-1764214654
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/index.js +437 -477
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelList/CustomChannelPreview.tsx +1 -1
- package/src/components/IconButton/IconButton.stories.tsx +1 -1
- package/src/components/MessagingShell/EmptyState.stories.tsx +0 -4
- package/src/components/MessagingShell/EmptyState.tsx +4 -38
- package/src/components/MessagingShell/ErrorState.tsx +1 -1
- package/src/components/MessagingShell/index.tsx +3 -21
package/package.json
CHANGED
|
@@ -114,7 +114,7 @@ const CustomChannelPreview: React.FC<
|
|
|
114
114
|
{lastMessageText}
|
|
115
115
|
</p>
|
|
116
116
|
{unreadCount > 0 && (
|
|
117
|
-
<span className="bg-
|
|
117
|
+
<span className="bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0">
|
|
118
118
|
{unreadCount > 99 ? '99+' : unreadCount}
|
|
119
119
|
</span>
|
|
120
120
|
)}
|
|
@@ -36,5 +36,5 @@ export const WithCustomClassName: StoryFn<ComponentProps> = Template.bind({})
|
|
|
36
36
|
WithCustomClassName.args = {
|
|
37
37
|
label: 'Custom styled button',
|
|
38
38
|
children: <XIcon className="h-6 w-6" />,
|
|
39
|
-
className: 'bg-
|
|
39
|
+
className: 'bg-[#7f22fe] text-white size-12',
|
|
40
40
|
}
|
|
@@ -27,13 +27,9 @@ const Template: StoryFn<ComponentProps> = (args) => {
|
|
|
27
27
|
export const NoChannels: StoryFn<ComponentProps> = Template.bind({})
|
|
28
28
|
NoChannels.args = {
|
|
29
29
|
hasChannels: false,
|
|
30
|
-
participantLabel: 'followers',
|
|
31
|
-
onStartConversation: () => console.log('Start conversation clicked'),
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
export const WithChannels: StoryFn<ComponentProps> = Template.bind({})
|
|
35
33
|
WithChannels.args = {
|
|
36
34
|
hasChannels: true,
|
|
37
|
-
participantLabel: 'participants',
|
|
38
|
-
onStartConversation: () => console.log('Start conversation clicked'),
|
|
39
35
|
}
|
|
@@ -5,9 +5,7 @@ import React from 'react'
|
|
|
5
5
|
*/
|
|
6
6
|
export const EmptyState: React.FC<{
|
|
7
7
|
hasChannels: boolean
|
|
8
|
-
|
|
9
|
-
participantLabel: string
|
|
10
|
-
}> = ({ hasChannels, onStartConversation, participantLabel }) => (
|
|
8
|
+
}> = ({ hasChannels }) => (
|
|
11
9
|
<div className="messaging-empty-state flex items-center justify-center h-full p-8 text-balance">
|
|
12
10
|
<div className="text-center max-w-sm">
|
|
13
11
|
<div className="w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6">
|
|
@@ -17,42 +15,10 @@ export const EmptyState: React.FC<{
|
|
|
17
15
|
<h2 className="font-semibold text-charcoal">Welcome to Messages</h2>
|
|
18
16
|
|
|
19
17
|
<p className="text-stone text-sm mb-6">
|
|
20
|
-
{hasChannels
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{onStartConversation && (
|
|
24
|
-
<TextButton onClick={onStartConversation}>
|
|
25
|
-
start a new conversation with a {participantLabel.slice(0, -1)}.
|
|
26
|
-
</TextButton>
|
|
27
|
-
)}
|
|
28
|
-
</>
|
|
29
|
-
) : (
|
|
30
|
-
onStartConversation && (
|
|
31
|
-
<>
|
|
32
|
-
<TextButton onClick={onStartConversation}>
|
|
33
|
-
Start a new conversation with one of your {participantLabel}
|
|
34
|
-
</TextButton>{' '}
|
|
35
|
-
to begin messaging.
|
|
36
|
-
</>
|
|
37
|
-
)
|
|
38
|
-
)}
|
|
18
|
+
{hasChannels
|
|
19
|
+
? 'Choose a conversation from the list.'
|
|
20
|
+
: 'No conversations yet.'}
|
|
39
21
|
</p>
|
|
40
22
|
</div>
|
|
41
23
|
</div>
|
|
42
24
|
)
|
|
43
|
-
|
|
44
|
-
const TextButton = ({
|
|
45
|
-
onClick,
|
|
46
|
-
children,
|
|
47
|
-
}: {
|
|
48
|
-
onClick: () => void
|
|
49
|
-
children: React.ReactNode
|
|
50
|
-
}) => (
|
|
51
|
-
<button
|
|
52
|
-
type="button"
|
|
53
|
-
onClick={onClick}
|
|
54
|
-
className="inline-flex items-center gap-1 text-sm font-medium text-primary hover:text-primary-alt focus:outline-none focus:ring-2 focus:ring-primary"
|
|
55
|
-
>
|
|
56
|
-
{children}
|
|
57
|
-
</button>
|
|
58
|
-
)
|
|
@@ -21,7 +21,7 @@ export const ErrorState: React.FC<{
|
|
|
21
21
|
<button
|
|
22
22
|
type="button"
|
|
23
23
|
onClick={onBack}
|
|
24
|
-
className="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-
|
|
24
|
+
className="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-[#7f22fe] hover:bg-primary-alt rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition-colors"
|
|
25
25
|
>
|
|
26
26
|
Go Back
|
|
27
27
|
</button>
|
|
@@ -44,7 +44,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
44
44
|
const [existingParticipantIds, setExistingParticipantIds] = useState<
|
|
45
45
|
Set<string>
|
|
46
46
|
>(new Set())
|
|
47
|
-
const [pickerKey,
|
|
47
|
+
const [pickerKey, _setPickerKey] = useState(0) // Key to force remount of ParticipantPicker
|
|
48
48
|
const [directConversationMode, setDirectConversationMode] = useState(false)
|
|
49
49
|
const [directConversationError, setDirectConversationError] = useState<
|
|
50
50
|
string | null
|
|
@@ -52,11 +52,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
52
52
|
|
|
53
53
|
const participantPickerRef = useRef<HTMLDialogElement>(null)
|
|
54
54
|
|
|
55
|
-
const {
|
|
56
|
-
showStartConversation = false,
|
|
57
|
-
participantSource,
|
|
58
|
-
participantLabel = 'participants',
|
|
59
|
-
} = capabilities
|
|
55
|
+
const { participantSource, participantLabel = 'participants' } = capabilities
|
|
60
56
|
|
|
61
57
|
// Create default filters and merge with provided filters
|
|
62
58
|
const channelFilters = React.useMemo(() => {
|
|
@@ -276,14 +272,6 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
276
272
|
setSelectedChannel(null)
|
|
277
273
|
}, [directConversationMode])
|
|
278
274
|
|
|
279
|
-
const handleStartConversation = useCallback(() => {
|
|
280
|
-
if (participantSource) {
|
|
281
|
-
setPickerKey((prev) => prev + 1) // Increment key to force remount
|
|
282
|
-
setShowParticipantPicker(true)
|
|
283
|
-
participantPickerRef.current?.showModal()
|
|
284
|
-
}
|
|
285
|
-
}, [participantSource])
|
|
286
|
-
|
|
287
275
|
const handleSelectParticipant = useCallback(
|
|
288
276
|
async (participant: Participant) => {
|
|
289
277
|
if (!service) return
|
|
@@ -460,13 +448,7 @@ export const MessagingShell: React.FC<MessagingShellProps> = ({
|
|
|
460
448
|
/>
|
|
461
449
|
</div>
|
|
462
450
|
) : (
|
|
463
|
-
<EmptyState
|
|
464
|
-
hasChannels={hasChannels}
|
|
465
|
-
onStartConversation={
|
|
466
|
-
showStartConversation ? handleStartConversation : undefined
|
|
467
|
-
}
|
|
468
|
-
participantLabel={participantLabel}
|
|
469
|
-
/>
|
|
451
|
+
<EmptyState hasChannels={hasChannels} />
|
|
470
452
|
)}
|
|
471
453
|
</div>
|
|
472
454
|
</div>
|