@@ -32,7 +32,9 @@ type StackedLayoutInnerProps = Readonly<{
3232 activity : WebChatActivity ;
3333 children ?: ReactNode | undefined ;
3434 fromUser : boolean ;
35+ hasAvatar : boolean ;
3536 hasDisplayText : boolean ;
37+ hasNub : boolean ;
3638 id : string ;
3739 renderAvatar ?: false | ( ( ) => Exclude < ReactNode , boolean | null | undefined > ) | undefined ;
3840 renderBubbleContent : ( title ?: string | undefined , showStatus ?: boolean ) => ReactNode ;
@@ -45,31 +47,24 @@ const StackedLayoutInner = memo(
4547 activity,
4648 children,
4749 fromUser,
50+ hasAvatar,
4851 hasDisplayText,
52+ hasNub,
4953 id,
5054 renderAvatar,
5155 renderBubbleContent,
5256 showAvatar,
5357 showNub
5458 } : StackedLayoutInnerProps ) => {
55- const [ styleOptions ] = useStyleOptions ( ) ;
5659 const [ { initials : botInitials } ] = useAvatarForBot ( ) ;
57- const [ { initials : userInitials } ] = useAvatarForUser ( ) ;
5860 const localize = useLocalizer ( ) ;
5961 const classNames = useStyles ( styles ) ;
6062
6163 const messageThing = useMemo ( ( ) => getOrgSchemaMessage ( activity . entities ) , [ activity ] ) ;
62- const { bubbleNubSize, bubbleFromUserNubSize } = styleOptions ;
6364 const greetingAlt = (
6465 fromUser ? localize ( 'ACTIVITY_YOU_SAID_ALT' ) : localize ( 'ACTIVITY_BOT_SAID_ALT' , botInitials || '' )
6566 ) . replace ( / \s { 2 , } / gu, ' ' ) ;
6667
67- const initials = fromUser ? userInitials : botInitials ;
68- const nubSize = fromUser ? bubbleFromUserNubSize : bubbleNubSize ;
69-
70- const hasAvatar = initials || typeof initials === 'string' ;
71- const hasNub = typeof nubSize === 'number' ;
72-
7368 return (
7469 < StackedLayoutMain avatar = { showAvatar && renderAvatar && renderAvatar ( ) } >
7570 { ! ! ( hasDisplayText || messageThing ?. abstract ) && (
@@ -147,18 +142,18 @@ const StackedLayout = ({
147142 const nubSize = fromUser ? bubbleFromUserNubSize : bubbleNubSize ;
148143 const otherInitials = fromUser ? botInitials : userInitials ;
149144 const otherNubSize = fromUser ? bubbleNubSize : bubbleFromUserNubSize ;
145+ const activityKey = useGetKeyByActivity ( ) ( activity ) ;
146+ const isInGroup = ! ! useGetLogicalGroupKey ( ) ( activityKey ) ;
150147
151- const hasAvatar = initials || typeof initials === 'string' ;
148+ const hasAvatar = ( initials || typeof initials === 'string' ) && ! isInGroup ;
152149 const hasOtherAvatar = otherInitials || typeof otherInitials === 'string' ;
153150 const hasNub = typeof nubSize === 'number' ;
154151 const hasOtherNub = typeof otherNubSize === 'number' ;
155152 const topAlignedCallout = isZeroOrPositive ( nubOffset ) ;
156- const activityKey = useGetKeyByActivity ( ) ( activity ) ;
157- const isInGroup = ! ! useGetLogicalGroupKey ( ) ( activityKey ) ;
158153
159154 const extraTrailing = ! hasOtherAvatar && hasOtherNub ; // This is for bot message with user nub and no user avatar. And vice versa.
160155
161- const showAvatar = ! isInGroup && showCallout && hasAvatar && ! ! renderAvatar ;
156+ const showAvatar = showCallout && hasAvatar && ! ! renderAvatar ;
162157 const showNub = ! isInGroup && showCallout && hasNub && ( topAlignedCallout || ! attachments ?. length ) ;
163158
164159 const showStatus = ! ! messageThing ?. creativeWorkStatus || isInGroup ;
@@ -304,6 +299,7 @@ const StackedLayout = ({
304299 fromUser = { fromUser }
305300 hideAvatar = { hasAvatar && ! showAvatar }
306301 hideNub = { hasNub && ! showNub }
302+ isActivity = { true }
307303 noMessage = { ! activityDisplayText && ! isCollapsible }
308304 showAvatar = { showAvatar }
309305 showNub = { showNub }
@@ -312,7 +308,9 @@ const StackedLayout = ({
312308 < StackedLayoutInner
313309 activity = { activity }
314310 fromUser = { fromUser }
311+ hasAvatar = { hasAvatar }
315312 hasDisplayText = { ! ! activityDisplayText ?. length || isCollapsible }
313+ hasNub = { hasNub }
316314 id = { ariaLabelId }
317315 renderAvatar = { renderAvatar }
318316 renderBubbleContent = { renderBubbleContent }
0 commit comments