Skip to content

Commit 0c64a3d

Browse files
committed
improvement(workflow-item): stabilize avatar layout and fix name truncation
1 parent 376f7cb commit 0c64a3d

File tree

2 files changed

+9
-7
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item

2 files changed

+9
-7
lines changed

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/avatars/avatars.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useSidebarStore } from '@/stores/sidebar/store'
1111
* Avatar display configuration for responsive layout.
1212
*/
1313
const AVATAR_CONFIG = {
14-
MIN_COUNT: 3,
14+
MIN_COUNT: 4,
1515
MAX_COUNT: 12,
1616
WIDTH_PER_AVATAR: 20,
1717
} as const
@@ -106,7 +106,9 @@ export function Avatars({ workflowId }: AvatarsProps) {
106106
}, [presenceUsers, currentWorkflowId, workflowId, currentSocketId])
107107

108108
/**
109-
* Calculate visible users and overflow count
109+
* Calculate visible users and overflow count.
110+
* Shows up to maxVisible avatars, with overflow indicator for any remaining.
111+
* Users are reversed so new avatars appear on the left (keeping right side stable).
110112
*/
111113
const { visibleUsers, overflowCount } = useMemo(() => {
112114
if (workflowUsers.length === 0) {
@@ -116,7 +118,8 @@ export function Avatars({ workflowId }: AvatarsProps) {
116118
const visible = workflowUsers.slice(0, maxVisible)
117119
const overflow = Math.max(0, workflowUsers.length - maxVisible)
118120

119-
return { visibleUsers: visible, overflowCount: overflow }
121+
// Reverse so rightmost avatars stay stable as new ones are revealed on the left
122+
return { visibleUsers: [...visible].reverse(), overflowCount: overflow }
120123
}, [workflowUsers, maxVisible])
121124

122125
if (visibleUsers.length === 0) {
@@ -129,7 +132,7 @@ export function Avatars({ workflowId }: AvatarsProps) {
129132
<Tooltip.Root>
130133
<Tooltip.Trigger asChild>
131134
<Avatar size='xs' style={{ zIndex: 0 } as CSSProperties}>
132-
<AvatarFallback className='border-0 bg-[#404040] font-semibold text-[7px] text-white'>
135+
<AvatarFallback className='border-0 bg-[var(--text-tertiary)] font-semibold text-[7px] text-white'>
133136
+{overflowCount}
134137
</AvatarFallback>
135138
</Avatar>
@@ -139,9 +142,8 @@ export function Avatars({ workflowId }: AvatarsProps) {
139142
</Tooltip.Content>
140143
</Tooltip.Root>
141144
)}
142-
143145
{visibleUsers.map((user, index) => (
144-
<UserAvatar key={user.socketId} user={user} index={overflowCount > 0 ? index + 1 : index} />
146+
<UserAvatar key={user.socketId} user={user} index={index} />
145147
))}
146148
</div>
147149
)

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export function WorkflowItem({
347347
) : (
348348
<div
349349
className={clsx(
350-
'min-w-0 flex-1 truncate font-medium',
350+
'min-w-0 truncate font-medium',
351351
active
352352
? 'text-[var(--text-primary)]'
353353
: 'text-[var(--text-tertiary)] group-hover:text-[var(--text-primary)]'

0 commit comments

Comments
 (0)