Skip to content

Commit da1f668

Browse files
authored
improvement(sidebar): fix workspace name truncation on sidebar preview (#2628)
1 parent 8806508 commit da1f668

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

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

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ export function WorkspaceHeader({
259259
}
260260

261261
return (
262-
<div className='flex min-w-0 items-center justify-between gap-[2px]'>
262+
<div className={`flex items-center gap-[8px] ${isCollapsed ? '' : 'min-w-0 justify-between'}`}>
263263
{/* Workspace Name with Switcher */}
264-
<div className='min-w-0 flex-1'>
264+
<div className={isCollapsed ? '' : 'min-w-0 flex-1'}>
265265
{/* Workspace Switcher Popover - only render after mount to avoid Radix ID hydration mismatch */}
266266
{isMounted ? (
267267
<Popover
@@ -278,10 +278,16 @@ export function WorkspaceHeader({
278278
<button
279279
type='button'
280280
aria-label='Switch workspace'
281-
className='-mx-[6px] flex min-w-0 max-w-full cursor-pointer items-center gap-[8px] rounded-[6px] bg-transparent px-[6px] py-[4px] transition-colors hover:bg-[var(--surface-6)] dark:hover:bg-[var(--surface-5)]'
281+
className={`flex cursor-pointer items-center gap-[8px] rounded-[6px] bg-transparent px-[6px] py-[4px] transition-colors hover:bg-[var(--surface-6)] dark:hover:bg-[var(--surface-5)] ${
282+
isCollapsed ? '' : '-mx-[6px] min-w-0 max-w-full'
283+
}`}
282284
title={activeWorkspace?.name || 'Loading...'}
283285
>
284-
<span className='truncate font-base text-[14px] text-[var(--text-primary)]'>
286+
<span
287+
className={`font-base text-[14px] text-[var(--text-primary)] ${
288+
isCollapsed ? 'max-w-[120px] truncate' : 'truncate'
289+
}`}
290+
>
285291
{activeWorkspace?.name || 'Loading...'}
286292
</span>
287293
<ChevronDown
@@ -421,11 +427,17 @@ export function WorkspaceHeader({
421427
<button
422428
type='button'
423429
aria-label='Switch workspace'
424-
className='-mx-[6px] flex min-w-0 max-w-full cursor-pointer items-center gap-[8px] rounded-[6px] bg-transparent px-[6px] py-[4px] transition-colors hover:bg-[var(--surface-6)] dark:hover:bg-[var(--surface-5)]'
430+
className={`flex cursor-pointer items-center gap-[8px] rounded-[6px] bg-transparent px-[6px] py-[4px] transition-colors hover:bg-[var(--surface-6)] dark:hover:bg-[var(--surface-5)] ${
431+
isCollapsed ? '' : '-mx-[6px] min-w-0 max-w-full'
432+
}`}
425433
title={activeWorkspace?.name || 'Loading...'}
426434
disabled
427435
>
428-
<span className='truncate font-base text-[14px] text-[var(--text-primary)] dark:text-[var(--white)]'>
436+
<span
437+
className={`font-base text-[14px] text-[var(--text-primary)] dark:text-[var(--white)] ${
438+
isCollapsed ? 'max-w-[120px] truncate' : 'truncate'
439+
}`}
440+
>
429441
{activeWorkspace?.name || 'Loading...'}
430442
</span>
431443
<ChevronDown className='h-[8px] w-[12px] flex-shrink-0 text-[var(--text-muted)]' />
@@ -434,10 +446,12 @@ export function WorkspaceHeader({
434446
</div>
435447
{/* Workspace Actions */}
436448
<div className='flex flex-shrink-0 items-center gap-[10px]'>
437-
{/* Invite */}
438-
<Badge className='cursor-pointer' onClick={() => setIsInviteModalOpen(true)}>
439-
Invite
440-
</Badge>
449+
{/* Invite - hidden in collapsed mode */}
450+
{!isCollapsed && (
451+
<Badge className='cursor-pointer' onClick={() => setIsInviteModalOpen(true)}>
452+
Invite
453+
</Badge>
454+
)}
441455
{/* Sidebar Collapse Toggle */}
442456
{showCollapseButton && (
443457
<Button

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ export function Sidebar() {
437437
return (
438438
<>
439439
{isCollapsed ? (
440-
/* Floating collapsed header */
441-
<div className='fixed top-[14px] left-[10px] z-10 max-w-[232px] rounded-[10px] border border-[var(--border)] bg-[var(--surface-1)] px-[12px] py-[6px]'>
440+
/* Floating collapsed header - minimal pill showing workspace name and expand toggle */
441+
<div className='fixed top-[14px] left-[10px] z-10 w-fit rounded-[10px] border border-[var(--border)] bg-[var(--surface-1)] px-[10px] py-[6px]'>
442442
<WorkspaceHeader
443443
activeWorkspace={activeWorkspace}
444444
workspaceId={workspaceId}

0 commit comments

Comments
 (0)