@linktr.ee/messaging-react 1.8.8 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/messaging-react",
3
- "version": "1.8.8",
3
+ "version": "1.9.1-rc-1764214654",
4
4
  "description": "React messaging components built on messaging-core for web applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,6 +9,7 @@ export interface AvatarProps {
9
9
  image?: string
10
10
  size?: number
11
11
  className?: string
12
+ shape?: 'squircle' | 'circle'
12
13
  }
13
14
 
14
15
  /**
@@ -19,6 +20,7 @@ export const Avatar: React.FC<AvatarProps> = ({
19
20
  image,
20
21
  size = 40,
21
22
  className,
23
+ shape = 'squircle',
22
24
  }) => {
23
25
  const emoji = getAvatarEmoji(id)
24
26
 
@@ -31,15 +33,21 @@ export const Avatar: React.FC<AvatarProps> = ({
31
33
 
32
34
  const fontSizeClass = getFontSizeClass()
33
35
 
36
+ const borderStyle =
37
+ shape === 'circle'
38
+ ? { borderRadius: '50%' }
39
+ : {
40
+ borderRadius: '33%',
41
+ 'corner-shape': 'superellipse(1.3)',
42
+ }
43
+
34
44
  return (
35
45
  <div
36
46
  className={classNames('flex-shrink-0 overflow-hidden', className)}
37
47
  style={{
38
48
  width: `${size}px`,
39
49
  height: `${size}px`,
40
- borderRadius: '33%',
41
- // @ts-expect-error - corner-shape is not recognized by react types
42
- 'corner-shape': 'superellipse(1.3)',
50
+ ...borderStyle,
43
51
  }}
44
52
  >
45
53
  {image ? (
@@ -114,7 +114,7 @@ const CustomChannelPreview: React.FC<
114
114
  {lastMessageText}
115
115
  </p>
116
116
  {unreadCount > 0 && (
117
- <span className="bg-primary text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0">
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
  )}
@@ -315,7 +315,7 @@ const ChannelInfoDialog: React.FC<{
315
315
  name={participantName}
316
316
  image={participantImage}
317
317
  size={88}
318
- className="!rounded-full"
318
+ shape="circle"
319
319
  />
320
320
  <div className="flex flex-col min-w-0 flex-1">
321
321
  <p className="truncate text-base font-semibold text-charcoal">
@@ -51,13 +51,14 @@ export const FaqList: React.FC<FaqListProps> = ({
51
51
  name={avatarName || 'Account'}
52
52
  image={avatarImage}
53
53
  size={24}
54
+ shape="circle"
54
55
  />
55
56
  </div>
56
57
  )}
57
58
 
58
59
  {/* FAQs with grey background */}
59
60
  <div
60
- className="flex-1 rounded-lg p-4 space-y-3"
61
+ className="flex-1 flex flex-col gap-3 rounded-lg p-4"
61
62
  style={{ backgroundColor: '#F1F0EE' }}
62
63
  >
63
64
  {headerText && (
@@ -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-primary text-white size-12',
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
- onStartConversation?: () => void
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
- Choose a conversation from the list or{' '}
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-primary hover:bg-primary-alt rounded-lg focus:outline-none focus:ring-2 focus:ring-primary transition-colors"
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, setPickerKey] = useState(0) // Key to force remount of ParticipantPicker
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>