@@ -73,6 +73,8 @@ interface WorkspaceHeaderProps {
7373 onLeaveWorkspace ?: ( workspaceId : string ) => Promise < void >
7474 /** Current user's session ID for owner check */
7575 sessionUserId ?: string
76+ /** Whether the sidebar is collapsed */
77+ isCollapsed ?: boolean
7678}
7779
7880/**
@@ -97,6 +99,7 @@ export function WorkspaceHeader({
9799 onColorChange,
98100 onLeaveWorkspace,
99101 sessionUserId,
102+ isCollapsed = false ,
100103} : WorkspaceHeaderProps ) {
101104 const [ isCreateModalOpen , setIsCreateModalOpen ] = useState ( false )
102105 const [ isInviteModalOpen , setIsInviteModalOpen ] = useState ( false )
@@ -322,7 +325,12 @@ export function WorkspaceHeader({
322325 < button
323326 type = 'button'
324327 aria-label = 'Switch workspace'
325- className = 'group flex h-[32px] w-full min-w-0 cursor-pointer items-center gap-[8px] rounded-[8px] border border-[var(--border)] bg-[var(--surface-2)] pr-[8px] pl-[6.5px] transition-colors hover:bg-[var(--surface-5)]'
328+ className = { cn (
329+ 'group flex min-w-0 items-center rounded-[8px] border border-[var(--border)] bg-[var(--surface-2)] transition-colors hover:bg-[var(--surface-5)]' ,
330+ isCollapsed
331+ ? 'h-[35px] w-[35px] justify-center px-0'
332+ : 'h-[32px] w-full cursor-pointer gap-[8px] pr-[8px] pl-[6.5px]'
333+ ) }
326334 title = { activeWorkspace ?. name || 'Loading...' }
327335 onContextMenu = { ( e ) => {
328336 if ( activeWorkspaceFull ) {
@@ -338,25 +346,36 @@ export function WorkspaceHeader({
338346 >
339347 { workspaceInitial }
340348 </ div >
341- < span className = 'min-w-0 flex-1 truncate text-left font-base text-[14px] text-[var(--text-primary)]' >
342- { activeWorkspace ?. name || 'Loading...' }
343- </ span >
344- < ChevronDown
345- className = { `sidebar-collapse-hide h-[8px] w-[10px] flex-shrink-0 text-[var(--text-muted)] transition-transform duration-100 group-hover:text-[var(--text-secondary)] ${
346- isWorkspaceMenuOpen ? 'rotate-180' : ''
347- } `}
348- />
349+ { ! isCollapsed && (
350+ < >
351+ < span className = 'min-w-0 flex-1 truncate text-left font-base text-[14px] text-[var(--text-primary)]' >
352+ { activeWorkspace ?. name || 'Loading...' }
353+ </ span >
354+ < ChevronDown
355+ className = { `sidebar-collapse-hide h-[8px] w-[10px] flex-shrink-0 text-[var(--text-muted)] transition-transform duration-100 group-hover:text-[var(--text-secondary)] ${
356+ isWorkspaceMenuOpen ? 'rotate-180' : ''
357+ } `}
358+ />
359+ </ >
360+ ) }
349361 </ button >
350362 </ DropdownMenuTrigger >
351363 < DropdownMenuContent
352364 align = 'start'
353- side = 'bottom'
354- sideOffset = { 8 }
355- style = { {
356- width : 'var(--radix-dropdown-menu-trigger-width)' ,
357- minWidth : 'var(--radix-dropdown-menu-trigger-width)' ,
358- maxWidth : 'var(--radix-dropdown-menu-trigger-width)' ,
359- } }
365+ side = { isCollapsed ? 'right' : 'bottom' }
366+ sideOffset = { isCollapsed ? 12 : 8 }
367+ style = {
368+ isCollapsed
369+ ? {
370+ width : '248px' ,
371+ maxWidth : 'calc(100vw - 24px)' ,
372+ }
373+ : {
374+ width : 'var(--radix-dropdown-menu-trigger-width)' ,
375+ minWidth : 'var(--radix-dropdown-menu-trigger-width)' ,
376+ maxWidth : 'var(--radix-dropdown-menu-trigger-width)' ,
377+ }
378+ }
360379 onCloseAutoFocus = { ( e ) => e . preventDefault ( ) }
361380 >
362381 { isWorkspacesLoading ? (
@@ -512,7 +531,12 @@ export function WorkspaceHeader({
512531 < button
513532 type = 'button'
514533 aria-label = 'Switch workspace'
515- className = 'flex h-[32px] w-full min-w-0 items-center gap-[8px] rounded-[8px] border border-[var(--border)] bg-[var(--surface-2)] pr-[8px] pl-[6.5px]'
534+ className = { cn (
535+ 'flex min-w-0 items-center rounded-[8px] border border-[var(--border)] bg-[var(--surface-2)]' ,
536+ isCollapsed
537+ ? 'h-[35px] w-[35px] justify-center px-0'
538+ : 'h-[32px] w-full gap-[8px] pr-[8px] pl-[6.5px]'
539+ ) }
516540 title = { activeWorkspace ?. name || 'Loading...' }
517541 disabled
518542 >
@@ -522,10 +546,14 @@ export function WorkspaceHeader({
522546 >
523547 { workspaceInitial }
524548 </ div >
525- < span className = 'min-w-0 flex-1 truncate text-left font-base text-[14px] text-[var(--text-primary)]' >
526- { activeWorkspace ?. name || 'Loading...' }
527- </ span >
528- < ChevronDown className = 'sidebar-collapse-hide h-[8px] w-[10px] flex-shrink-0 text-[var(--text-muted)]' />
549+ { ! isCollapsed && (
550+ < >
551+ < span className = 'min-w-0 flex-1 truncate text-left font-base text-[14px] text-[var(--text-primary)]' >
552+ { activeWorkspace ?. name || 'Loading...' }
553+ </ span >
554+ < ChevronDown className = 'sidebar-collapse-hide h-[8px] w-[10px] flex-shrink-0 text-[var(--text-muted)]' />
555+ </ >
556+ ) }
529557 </ button >
530558 ) }
531559 </ div >
0 commit comments