diff --git a/packages/webui/components/chat/message-input.tsx b/packages/webui/components/chat/message-input.tsx index fe0309da..a3318ae5 100644 --- a/packages/webui/components/chat/message-input.tsx +++ b/packages/webui/components/chat/message-input.tsx @@ -6,6 +6,7 @@ import { client } from '@/ui/api/client' import { useAnnotationStore } from '@/ui/stores/annotation-store' import type { Annotation } from '@/ui/types' import { useMutation } from '@tanstack/react-query' +import { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar' import { Skeleton } from '../ui/skeleton' import { useMemberStore } from '@/ui/stores/members' import { useTeamContextStore } from '@/ui/stores/team-context' @@ -158,6 +159,7 @@ export const ChatInput = React.forwardRef( const editorRef = useRef(null) const fileInputRef = useRef(null) const mentionRangeRef = useRef(null) + const mentionListRef = useRef(null) const { mutateAsync: uploadAttachment } = useMutation({ mutationFn: async ({ @@ -238,6 +240,22 @@ export const ChatInput = React.forwardRef( setHighlightedIndex(0) }, [mentionQuery, showMentionList, collapsedSections]) + // Keep the highlighted mention item visible when navigating with arrow keys + useEffect(() => { + mentionListRef.current + ?.querySelector(`[data-index="${highlightedIndex}"]`) + ?.scrollIntoView({ block: 'nearest' }) + }, [highlightedIndex]) + + const getInitials = (name: string) => { + return name + .split(' ') + .map((n) => n[0]) + .slice(0, 2) + .join('') + .toUpperCase() + } + const handleInput = () => { if (!editorRef.current) return setHasContent(!!editorRef.current.innerText.trim()) @@ -492,7 +510,7 @@ export const ChatInput = React.forwardRef( {showMentionList && (membersLoading || filteredAgents.length > 0 || filteredHumans.length > 0) && (
-
+
{membersLoading ? (
{/* Agents Skeleton */} @@ -547,6 +565,7 @@ export const ChatInput = React.forwardRef( return ( ) @@ -587,6 +615,7 @@ export const ChatInput = React.forwardRef( return ( )