Skip to content

Commit cb8338c

Browse files
authored
fix(workspaces): give the pin and options button one shared slot (#6402)
The pin sat inline before an always-reserved 18px options button, so a pinned row's name lost ~18px of truncation budget — pinning visibly re-truncated the name at the moment of the click, and hovering showed pin and options together. Match the chat rows: one fixed 18px slot with both absolutely positioned, the pin fading out as the button fades in. The trailing width is now constant, so pinning cannot reflow the name. The options glyph moves to --text-icon, the canonical icon token its new sibling already uses.
1 parent 457170b commit cb8338c

1 file changed

Lines changed: 34 additions & 26 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/workspace-header.tsx

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -747,33 +747,41 @@ function WorkspaceHeaderImpl({
747747
<span className='min-w-0 flex-1 truncate text-[var(--text-body)] text-sm'>
748748
{workspace.name}
749749
</span>
750-
{pinnedWorkspaceIds.has(workspace.id) && (
751-
<Pin
752-
aria-hidden={false}
753-
role='img'
754-
aria-label='Pinned'
755-
className='size-[12px] flex-shrink-0 text-[var(--text-icon)]'
756-
/>
757-
)}
758-
<button
759-
type='button'
760-
aria-label='Workspace options'
761-
onMouseDown={() => {
762-
isContextMenuOpeningRef.current = true
763-
}}
764-
onClick={(e) => {
765-
e.preventDefault()
766-
e.stopPropagation()
767-
const rect = e.currentTarget.getBoundingClientRect()
768-
openContextMenuAt(workspace, rect.right, rect.top)
769-
}}
770-
className={cn(
771-
'flex size-[18px] flex-shrink-0 items-center justify-center rounded-sm opacity-0 transition-opacity group-hover:opacity-100',
772-
isMenuOpen && 'opacity-100'
750+
{/* Pin and options share one fixed slot, as the chat rows do:
751+
the trailing width never changes, so pinning cannot re-truncate
752+
the name under the user's cursor. */}
753+
<div className='relative flex size-[18px] flex-shrink-0 items-center justify-center'>
754+
{pinnedWorkspaceIds.has(workspace.id) && (
755+
<Pin
756+
aria-hidden={false}
757+
role='img'
758+
aria-label='Pinned'
759+
className={cn(
760+
'absolute size-[12px] text-[var(--text-icon)] transition-opacity',
761+
isMenuOpen ? 'opacity-0' : 'group-hover:opacity-0'
762+
)}
763+
/>
773764
)}
774-
>
775-
<MoreHorizontal className='size-[14px] text-[var(--text-tertiary)]' />
776-
</button>
765+
<button
766+
type='button'
767+
aria-label='Workspace options'
768+
onMouseDown={() => {
769+
isContextMenuOpeningRef.current = true
770+
}}
771+
onClick={(e) => {
772+
e.preventDefault()
773+
e.stopPropagation()
774+
const rect = e.currentTarget.getBoundingClientRect()
775+
openContextMenuAt(workspace, rect.right, rect.top)
776+
}}
777+
className={cn(
778+
'absolute inset-0 flex items-center justify-center rounded-sm opacity-0 transition-opacity group-hover:opacity-100',
779+
isMenuOpen && 'opacity-100'
780+
)}
781+
>
782+
<MoreHorizontal className='size-[14px] text-[var(--text-icon)]' />
783+
</button>
784+
</div>
777785
</div>
778786
)}
779787
</div>

0 commit comments

Comments
 (0)