From 7c5978d5df40a0d95c7cae82179b7adfcee62110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 28 May 2026 20:33:26 -0400 Subject: [PATCH] Make the chat channel search functional The conversation header search button was inert. Toggle a search field that filters the channel's root messages by body text; clearing or pressing Escape restores the full timeline. Search stays scoped to the open space, so results respect the membership the user already has. --- .../src/pages/chat/ChatConversation.tsx | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/AgentCompany-New/src/renderer/src/pages/chat/ChatConversation.tsx b/AgentCompany-New/src/renderer/src/pages/chat/ChatConversation.tsx index c4024210..11173758 100644 --- a/AgentCompany-New/src/renderer/src/pages/chat/ChatConversation.tsx +++ b/AgentCompany-New/src/renderer/src/pages/chat/ChatConversation.tsx @@ -1,4 +1,4 @@ -import type { FormEvent, MutableRefObject } from "react"; +import { useState, type FormEvent, type MutableRefObject } from "react"; import { AvatarStack, Icon, IconButton } from "../../shared/ui"; import type { ApprovalRecord, @@ -53,13 +53,18 @@ export function ChatConversation({ onSubmit: (event: FormEvent) => void; composerRef: MutableRefObject; }) { + const [query, setQuery] = useState(""); + const trimmed = query.trim().toLowerCase(); + const visibleRoots = trimmed + ? rootMessages.filter((message) => message.bodyMd.toLowerCase().includes(trimmed)) + : rootMessages; return (
- {space && } + {space && }
{space && ( void; }) { + const [searchOpen, setSearchOpen] = useState(false); + const toggleSearch = () => { + setSearchOpen((open) => { + if (open) onQueryChange(""); + return !open; + }); + }; return (
@@ -114,8 +130,20 @@ function ConversationHeader({ {space.topic}
- {participants.length > 0 && } - + {searchOpen && ( + onQueryChange(event.target.value)} + onKeyDown={(event) => { if (event.key === "Escape") toggleSearch(); }} + style={{ width: 200, height: 28, padding: "0 10px" }} + /> + )} + {!searchOpen && participants.length > 0 && } +