Skip to content

Commit 77649d3

Browse files
authored
fix(sidebar): keep the pin visible on the chat you're viewing (#6377)
The pin glyph carried a stale `!isCurrentRoute` guard copy-pasted from the status dot back when the dot was also hidden on the current route. #4354 later relaxed the dot's guard but left the pin's untouched, so opening a pinned chat made its pin vanish. Derive `showStatusDot` once and express the pin as its negation so the two conditions can no longer drift apart. Also align the collapsed rail, which never forwarded `isCurrentRoute` and so showed an unread dot on the chat you were already reading, and hide the pin by the same opacity mechanism the dot uses instead of a display toggle plus a mount guard.
1 parent 1305e9d commit 77649d3

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export function CollapsedChatFlyoutItem({
300300
<ConversationListItem
301301
title={chat.name}
302302
isActive={!!chat.isActive}
303-
isUnread={!!chat.isUnread}
303+
isUnread={!!chat.isUnread && !isCurrentRoute}
304304
/>
305305
</Link>
306306
</DropdownMenuItem>

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ const SidebarChatItem = memo(function SidebarChatItem({
195195
}) {
196196
const dragGhostRef = useRef<HTMLElement | null>(null)
197197

198+
/**
199+
* The trailing slot fits one glyph, and the dot wins over the pin: it reports
200+
* transient state (a run in progress, or an unread reply elsewhere), while pinning
201+
* is persistent and already conveyed by the row sorting to the top of the list.
202+
*/
203+
const showStatusDot = isActive || (!isCurrentRoute && isUnread)
204+
198205
function handleDragStart(e: React.DragEvent) {
199206
e.dataTransfer.effectAllowed = 'copyMove'
200207
e.dataTransfer.setData(
@@ -238,23 +245,26 @@ const SidebarChatItem = memo(function SidebarChatItem({
238245
>
239246
<div className='min-w-0 flex-1 truncate text-[var(--text-body)]'>{chat.name}</div>
240247
{chat.id !== 'new' && (
241-
<div className='relative flex h-[18px] w-[18px] flex-shrink-0 items-center justify-center'>
242-
{(isActive || (!isCurrentRoute && isUnread)) && (
248+
<div className='relative flex size-[18px] flex-shrink-0 items-center justify-center'>
249+
{showStatusDot && (
243250
<span
244251
aria-hidden='true'
245252
className={cn(
246-
'h-[6px] w-[6px] rounded-full transition-opacity',
253+
'size-[6px] rounded-full transition-opacity',
247254
isMenuOpen ? 'opacity-0' : 'group-hover:opacity-0'
248255
)}
249256
style={{
250257
backgroundColor: isActive ? '#EAB308' : 'var(--brand-accent)',
251258
}}
252259
/>
253260
)}
254-
{!isActive && !isUnread && isPinned && !isCurrentRoute && !isMenuOpen && (
261+
{!showStatusDot && isPinned && (
255262
<Pin
256263
aria-hidden='true'
257-
className='absolute size-[12px] text-[var(--text-icon)] group-hover:hidden'
264+
className={cn(
265+
'absolute size-[12px] text-[var(--text-icon)] transition-opacity',
266+
isMenuOpen ? 'opacity-0' : 'group-hover:opacity-0'
267+
)}
258268
/>
259269
)}
260270
<button

0 commit comments

Comments
 (0)