From 19a5aee38ed751cfb025305774ad73c2d00c9197 Mon Sep 17 00:00:00 2001 From: yyh Date: Tue, 3 Feb 2026 14:18:17 +0800 Subject: [PATCH] fix: hide divider when OnlineUsers component is not rendered Move the Divider into the OnlineUsers component so it conditionally renders together with the online users content, preventing an orphaned divider from appearing next to the preview button. --- .../workflow/header/header-in-normal.tsx | 2 - .../workflow/header/online-users.tsx | 242 +++++++++--------- 2 files changed, 123 insertions(+), 121 deletions(-) diff --git a/web/app/components/workflow/header/header-in-normal.tsx b/web/app/components/workflow/header/header-in-normal.tsx index 7d7e531691..309e75ed99 100644 --- a/web/app/components/workflow/header/header-in-normal.tsx +++ b/web/app/components/workflow/header/header-in-normal.tsx @@ -5,7 +5,6 @@ import { } from 'react' import { useNodes } from 'reactflow' import { useInputFieldPanel } from '@/app/components/rag-pipeline/hooks' -import Divider from '../../base/divider' import { useNodesInteractions, useNodesReadOnly, @@ -75,7 +74,6 @@ const HeaderInNormal = ({
-
{components?.chatVariableTrigger} diff --git a/web/app/components/workflow/header/online-users.tsx b/web/app/components/workflow/header/online-users.tsx index fa6f5d95cd..9157b04cc6 100644 --- a/web/app/components/workflow/header/online-users.tsx +++ b/web/app/components/workflow/header/online-users.tsx @@ -4,6 +4,7 @@ import { ChevronDownIcon } from '@heroicons/react/20/solid' import { useEffect, useState } from 'react' import { useReactFlow } from 'reactflow' import Avatar from '@/app/components/base/avatar' +import Divider from '@/app/components/base/divider' import { PortalToFollowElem, PortalToFollowElemContent, @@ -107,134 +108,137 @@ const OnlineUsers = () => { const hasCounter = remainingCount > 0 return ( -
-
-
- {visibleUsers.map((user, index) => { - const isCurrentUser = user.user_id === currentUserId - const userColor = isCurrentUser ? undefined : getUserColor(user.user_id) - return ( - -
0 && '-ml-1.5', - !isCurrentUser && 'cursor-pointer transition-transform hover:scale-110', + <> +
+
+
+ {visibleUsers.map((user, index) => { + const isCurrentUser = user.user_id === currentUserId + const userColor = isCurrentUser ? undefined : getUserColor(user.user_id) + return ( + !isCurrentUser && jumpToUserCursor(user.user_id)} + position="bottom" + triggerMethod="hover" + needsDelay={false} + asChild + popupClassName="flex h-[28px] items-center justify-center gap-1 rounded-md border-[0.5px] border-components-panel-border bg-components-tooltip-bg px-3 py-[6px] shadow-lg shadow-shadow-shadow-5 backdrop-blur-[10px]" + noDecoration > - -
- - ) - })} - {remainingCount > 0 && ( - - setDropdownOpen(prev => !prev)} - asChild - > -
0 && '-ml-1', + 'relative flex size-6 items-center justify-center', + index > 0 && '-ml-1.5', + !isCurrentUser && 'cursor-pointer transition-transform hover:scale-110', + )} + style={{ zIndex: visibleUsers.length - index }} + onClick={() => !isCurrentUser && jumpToUserCursor(user.user_id)} + > + +
+ + ) + })} + {remainingCount > 0 && ( + + setDropdownOpen(prev => !prev)} + asChild + > +
+
0 && '-ml-1', + )} + > + + + {remainingCount} +
+ +
+
+ +
- + - {remainingCount} -
- -
-
- -
- {onlineUsers.map((user) => { - const isCurrentUser = user.user_id === currentUserId - const userColor = isCurrentUser ? undefined : getUserColor(user.user_id) - return ( -
{ - if (!isCurrentUser) { - jumpToUserCursor(user.user_id) - setDropdownOpen(false) - } - }} - > -
- + {onlineUsers.map((user) => { + const isCurrentUser = user.user_id === currentUserId + const userColor = isCurrentUser ? undefined : getUserColor(user.user_id) + return ( +
{ + if (!isCurrentUser) { + jumpToUserCursor(user.user_id) + setDropdownOpen(false) + } + }} + > +
+ +
+ {renderDisplayName( + user, + 'system-xs-medium text-text-secondary', + 'text-text-tertiary', + )}
- {renderDisplayName( - user, - 'system-xs-medium text-text-secondary', - 'text-text-tertiary', - )} -
- ) - })} -
- - - )} + ) + })} +
+
+
+ )} +
-
+ + ) }