@@ -132,26 +132,62 @@ export function ChatSwitcher({
132132 router . push ( `/workspace/${ workspaceId } /chat/${ selectedChatId } ` )
133133 }
134134
135+ /** The split chip's primary action: jump straight into the latest chat. */
136+ const handleOpenMostRecent = ( ) => {
137+ if ( ! mostRecent ) {
138+ setOpen ( true )
139+ return
140+ }
141+ handleSelect ( mostRecent . id )
142+ }
143+
135144 const chipIcon = isWorking ? (
136145 < ThinkingLoader size = { 18 } className = 'flex-shrink-0' />
137146 ) : (
138147 < BubbleChatDelay className = 'size-[16px] flex-shrink-0 text-[var(--text-icon)]' />
139148 )
140149
141150 const trigger = iconOnly ? (
142- < button
143- type = 'button'
144- aria-label = 'Recents'
145- onClick = { ( ) => setOpen ( ( prev ) => ! prev ) }
146- className = { cn (
147- 'flex h-[30px] flex-shrink-0 items-center gap-1 rounded-lg px-1.5 transition-colors' ,
148- 'hover-hover:bg-[var(--surface-active)]' ,
149- open && 'bg-[var(--surface-active)]'
150- ) }
151- >
152- { chipIcon }
153- < ChevronDown className = 'size-[14px] flex-shrink-0 text-[var(--text-icon)]' />
154- </ button >
151+ /* Split chip: the icon opens the most recent chat outright; the chevron
152+ opens the Recents list. The 1px bg-colored divider only reads when a
153+ segment carries its fill, slicing the pill into two buttons. */
154+ < span className = 'flex h-[30px] flex-shrink-0 items-stretch' >
155+ < Tooltip . Root >
156+ < Tooltip . Trigger asChild >
157+ < button
158+ type = 'button'
159+ aria-label = 'Open most recent chat'
160+ onClick = { handleOpenMostRecent }
161+ className = 'flex items-center rounded-l-lg px-1.5 transition-colors hover-hover:bg-[var(--surface-active)]'
162+ >
163+ { chipIcon }
164+ </ button >
165+ </ Tooltip . Trigger >
166+ < Tooltip . Content side = 'bottom' >
167+ < p > Open chat</ p >
168+ </ Tooltip . Content >
169+ </ Tooltip . Root >
170+ < span aria-hidden = 'true' className = 'w-px self-stretch bg-[var(--bg)]' />
171+ < Tooltip . Root >
172+ < Tooltip . Trigger asChild >
173+ < button
174+ type = 'button'
175+ aria-label = 'Recents'
176+ onClick = { ( ) => setOpen ( ( prev ) => ! prev ) }
177+ className = { cn (
178+ 'flex items-center rounded-r-lg px-1 transition-colors' ,
179+ 'hover-hover:bg-[var(--surface-active)]' ,
180+ open && 'bg-[var(--surface-active)]'
181+ ) }
182+ >
183+ < ChevronDown className = 'size-[14px] flex-shrink-0 text-[var(--text-icon)]' />
184+ </ button >
185+ </ Tooltip . Trigger >
186+ < Tooltip . Content side = 'bottom' >
187+ < p > Recents</ p >
188+ </ Tooltip . Content >
189+ </ Tooltip . Root >
190+ </ span >
155191 ) : (
156192 < button
157193 type = 'button'
@@ -173,20 +209,7 @@ export function ChatSwitcher({
173209
174210 return (
175211 < Popover size = 'md' open = { open } onOpenChange = { setOpen } >
176- < PopoverAnchor asChild >
177- { iconOnly ? (
178- < span className = 'flex flex-shrink-0' >
179- < Tooltip . Root >
180- < Tooltip . Trigger asChild > { trigger } </ Tooltip . Trigger >
181- < Tooltip . Content side = 'bottom' >
182- < p > Recents</ p >
183- </ Tooltip . Content >
184- </ Tooltip . Root >
185- </ span >
186- ) : (
187- trigger
188- ) }
189- </ PopoverAnchor >
212+ < PopoverAnchor asChild > { trigger } </ PopoverAnchor >
190213 { /* Mirrors the sidebar flyout's anchor rhythm: the chip sits at y 7..37 in
191214 the 44px bar, so offset 13 lands the panel 6px below the bar, and the
192215 -33 align offset walks back from the chip to 8px off the panel edge. */ }
0 commit comments