Skip to content

Commit 66dfe2c

Browse files
authored
improvement(workflow-item): stabilize avatar layout and fix name truncation (#2939)
* improvement(workflow-item): stabilize avatar layout and fix name truncation * fix(avatars): revert overflow bg to hardcoded color for contrast
1 parent 376f7cb commit 66dfe2c

File tree

2 files changed

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

2 files changed

+8
-6
lines changed

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

Lines changed: 7 additions & 5 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) {
@@ -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)