@@ -215,8 +215,6 @@ const SIDE_MENU_PAD_X = `calc(0.625rem - 0.375rem * var(--sm-collapse, 0))`;
215215 * rail buttons inset symmetrically (matching the left padding) instead of touching the edge.
216216 */
217217const SIDE_MENU_SCROLL_PAD_RIGHT = `calc(0.25rem * var(--sm-collapse, 0))` ;
218- /** Applied to every fading label so it tracks --sm-label-opacity (falls back to fully visible). */
219- const SIDE_MENU_LABEL_STYLE = { opacity : "var(--sm-label-opacity, 1)" } as const ;
220218/**
221219 * The selector rows' hover chevron: its 16px of layout width follows --sm-label-opacity so an
222220 * invisible chevron can never hold width mid-drag and push the row's overflow clip edge into the
@@ -226,6 +224,17 @@ const SIDE_MENU_LABEL_STYLE = { opacity: "var(--sm-label-opacity, 1)" } as const
226224const SIDE_MENU_CHEVRON_STYLE = {
227225 maxWidth : "calc(var(--sm-label-opacity, 1) * 16px)" ,
228226} as const ;
227+ /**
228+ * The selector rows' label container (org/project/environment): width and opacity both follow
229+ * --sm-label-opacity so the label tracks a drag frame-by-frame in BOTH directions. Gating these on
230+ * `isCollapsed` (which only flips on release) made the labels pop in after a drag-open instead of
231+ * fading in like the nav items. The variable also animates during the click-toggle, and is 0/1 at
232+ * the collapsed/expanded resting states, so no isCollapsed classes or CSS transitions are needed.
233+ */
234+ const SIDE_MENU_SELECTOR_LABEL_STYLE = {
235+ maxWidth : "calc(var(--sm-label-opacity, 1) * 200px)" ,
236+ opacity : "var(--sm-label-opacity, 1)" ,
237+ } as const ;
229238
230239function clamp ( value : number , min : number , max : number ) {
231240 return Math . min ( max , Math . max ( min , value ) ) ;
@@ -639,11 +648,12 @@ export function SideMenu({
639648 />
640649 < div className = "absolute inset-0 grid grid-cols-[100%] grid-rows-[2.5rem_auto_1fr_auto] overflow-hidden" >
641650 < div className = "flex min-w-0 items-center overflow-hidden border-b border-transparent px-1 py-1" >
642- < div className = { cn ( "min-w-0" , ! isCollapsed && "flex-1" ) } >
651+ < div className = { cn ( "min-w-0" , ( isDragging || ! isCollapsed ) && "flex-1" ) } >
643652 < OrgSelector
644653 organizations = { organizations }
645654 organization = { organization }
646655 isCollapsed = { isCollapsed }
656+ isDragging = { isDragging }
647657 />
648658 </ div >
649659 < CollapsibleElement isDragging = { isDragging } >
@@ -662,6 +672,7 @@ export function SideMenu({
662672 project = { project }
663673 environment = { environment }
664674 isCollapsed = { isCollapsed }
675+ isDragging = { isDragging }
665676 className = "w-full"
666677 />
667678 < div className = "flex items-center" >
@@ -670,6 +681,7 @@ export function SideMenu({
670681 project = { project }
671682 environment = { environment }
672683 isCollapsed = { isCollapsed }
684+ isDragging = { isDragging }
673685 className = "min-w-0 flex-1"
674686 />
675687 { environment . type === "DEVELOPMENT" && project . engine === "V2" && (
@@ -1139,10 +1151,13 @@ function OrgSelector({
11391151 organization,
11401152 organizations,
11411153 isCollapsed = false ,
1154+ isDragging = false ,
11421155} : {
11431156 organization : MatchedOrganization ;
11441157 organizations : MatchedOrganization [ ] ;
11451158 isCollapsed ?: boolean ;
1159+ /** True while the menu is being drag-resized; keeps the row in its expanded arrangement. */
1160+ isDragging ?: boolean ;
11461161} ) {
11471162 const currentPlan = useCurrentPlan ( ) ;
11481163 const [ isOrgMenuOpen , setOrgMenuOpen ] = useState ( false ) ;
@@ -1167,21 +1182,18 @@ function OrgSelector({
11671182 < PopoverTrigger
11681183 className = { cn (
11691184 "group flex h-8 items-center rounded pl-1.75 hover:bg-background-hover focus-custom" ,
1170- isCollapsed ? "justify-center pr-0.5" : "w-full justify-between pr-1"
1185+ // The expanded row arrangement applies while dragging too — the resting classes only
1186+ // flip on release, and the label reveal mid-drag needs the expanded layout.
1187+ isDragging || ! isCollapsed ? "w-full justify-between pr-1" : "justify-center pr-0.5"
11711188 ) }
11721189 >
11731190 < span className = "flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden" >
11741191 < Avatar avatar = { organization . avatar } size = { 1.25 } orgName = { organization . title } />
11751192 < span
1176- className = { cn (
1177- "flex min-w-0 items-center gap-1.5 overflow-hidden transition-all duration-200" ,
1178- isCollapsed ? "max-w-0 opacity-0" : "max-w-[200px] opacity-100"
1179- ) }
1193+ className = "flex min-w-0 items-center gap-1.5 overflow-hidden"
1194+ style = { SIDE_MENU_SELECTOR_LABEL_STYLE }
11801195 >
1181- < span
1182- className = "truncate text-[0.90625rem] font-medium tracking-[-0.01em] text-text-bright"
1183- style = { SIDE_MENU_LABEL_STYLE }
1184- >
1196+ < span className = "truncate text-[0.90625rem] font-medium tracking-[-0.01em] text-text-bright" >
11851197 { organization . title }
11861198 </ span >
11871199 </ span >
@@ -1432,12 +1444,15 @@ function ProjectSelector({
14321444 organization,
14331445 environment,
14341446 isCollapsed = false ,
1447+ isDragging = false ,
14351448 className,
14361449} : {
14371450 project : SideMenuProject ;
14381451 organization : MatchedOrganization ;
14391452 environment : SideMenuEnvironment ;
14401453 isCollapsed ?: boolean ;
1454+ /** True while the menu is being drag-resized; keeps the row in its expanded arrangement. */
1455+ isDragging ?: boolean ;
14411456 className ?: string ;
14421457} ) {
14431458 const [ isMenuOpen , setIsMenuOpen ] = useState ( false ) ;
@@ -1454,24 +1469,21 @@ function ProjectSelector({
14541469 < PopoverTrigger
14551470 className = { cn (
14561471 "group flex h-8 items-center rounded border pl-1.75 transition-[border-color] duration-150 hover:bg-background-hover focus-custom" ,
1457- isCollapsed
1458- ? "justify-center border-transparent pr-0.5"
1459- : "justify-between border-grid-bright pr-1" ,
1472+ // The expanded row arrangement applies while dragging too — the resting classes only
1473+ // flip on release, and the label reveal mid-drag needs the expanded layout.
1474+ isDragging || ! isCollapsed
1475+ ? "justify-between border-grid-bright pr-1"
1476+ : "justify-center border-transparent pr-0.5" ,
14601477 className
14611478 ) }
14621479 >
14631480 < span className = "flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden" >
14641481 < FolderOpenIcon className = "size-5 shrink-0 text-text-bright" />
14651482 < span
1466- className = { cn (
1467- "flex min-w-0 items-center overflow-hidden transition-all duration-200" ,
1468- isCollapsed ? "max-w-0 opacity-0" : "max-w-[200px] opacity-100"
1469- ) }
1483+ className = "flex min-w-0 items-center overflow-hidden"
1484+ style = { SIDE_MENU_SELECTOR_LABEL_STYLE }
14701485 >
1471- < span
1472- className = "truncate text-[0.90625rem] font-medium tracking-[-0.01em] text-text-bright"
1473- style = { SIDE_MENU_LABEL_STYLE }
1474- >
1486+ < span className = "truncate text-[0.90625rem] font-medium tracking-[-0.01em] text-text-bright" >
14751487 { project . name ?? "Select a project" }
14761488 </ span >
14771489 </ span >
0 commit comments