From 105e65215c0ea10e345dd762c0814aa047b83c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Tue, 15 Sep 2026 21:32:05 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20=C3=87elebi=20chat=20search?= =?UTF-8?q?=20and=20jump-to-latest=20-=20filter=20the=20open=20thread=20wi?= =?UTF-8?q?th=20DataTableSearch=20over=20message=20text=20-=20show=20a=20j?= =?UTF-8?q?ump-to-latest=20control=20when=20the=20transcript=20is=20scroll?= =?UTF-8?q?ed=20up=20-=20SidePanel=20gains=20optional=20bodyClass=20so=20?= =?UTF-8?q?=C3=87elebi=20can=20lock=20overflow=20to=20its=20=20=20own=20sc?= =?UTF-8?q?roll=20region;=20EN/TR=20copy=20for=20search,=20empty=20results?= =?UTF-8?q?=20and=20the=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/layout/celebi-panel.tsx | 43 +++++++++++++++++++++++--- src/components/ui/side-panel.tsx | 3 +- src/i18n/messages.ts | 9 ++++++ 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/components/layout/celebi-panel.tsx b/src/components/layout/celebi-panel.tsx index 12dd1ff..6828f98 100644 --- a/src/components/layout/celebi-panel.tsx +++ b/src/components/layout/celebi-panel.tsx @@ -7,8 +7,9 @@ import { CelebiMarkdown } from "@/components/layout/celebi-markdown"; import { CelebiReplyActions } from "@/components/layout/celebi-reply-actions"; import { CelebiThinkingLabel } from "@/components/layout/celebi-thinking-label"; import { ConfirmDialog } from "@/components/ui/confirm-dialog"; +import { DataTableSearch } from "@/components/ui/data-table-search"; import { EmptyInline } from "@/components/ui/empty-inline"; -import { IconAlert, IconBotSquare, IconCopy, IconEdit, IconPlus, IconTrash } from "@/components/ui/icons"; +import { IconAlert, IconBotSquare, IconChevronDown, IconCopy, IconEdit, IconPlus, IconTrash } from "@/components/ui/icons"; import { SidePanel } from "@/components/ui/side-panel"; import { cn } from "@/lib/cn"; import { usePreferences, useT } from "@/stores/preferences-context"; @@ -34,6 +35,8 @@ export function CelebiPanel(props: { open: boolean; onOpenChange: (open: boolean const [threads, setThreads] = createSignal([]); const [sending, setSending] = createSignal(false); const [copiedId, setCopiedId] = createSignal(); + const [searchQuery, setSearchQuery] = createSignal(""); + const [showScrollToLatest, setShowScrollToLatest] = createSignal(false); const copyMessage = async (message: PanelMessage) => { await navigator.clipboard.writeText(message.content); @@ -94,7 +97,18 @@ export function CelebiPanel(props: { open: boolean; onOpenChange: (open: boolean const NEAR_BOTTOM_PX = 64; const scrollToLatest = () => { if (!transcript) return; - transcript.scrollTop = transcript.scrollHeight; + transcript.scrollTo({ top: transcript.scrollHeight, behavior: "smooth" }); + setShowScrollToLatest(false); + }; + const handleTranscriptScroll = () => { + if (!transcript) return; + const distance = transcript.scrollHeight - transcript.scrollTop - transcript.clientHeight; + setShowScrollToLatest(distance > NEAR_BOTTOM_PX); + }; + const filteredMessages = () => { + const query = searchQuery().trim().toLocaleLowerCase(locale()); + if (!query) return messages(); + return messages().filter((message) => message.content.toLocaleLowerCase(locale()).includes(query)); }; createEffect(() => { const items = messages(); @@ -217,7 +231,7 @@ export function CelebiPanel(props: { open: boolean; onOpenChange: (open: boolean }; return ( - +
-
+
+ + + + +
+
0} fallback={ } > + 0} + fallback={

{t("ai.noSearchResults")}

} + >
- + {(message) => (
@@ -312,6 +344,7 @@ export function CelebiPanel(props: { open: boolean; onOpenChange: (open: boolean
+
, ) { // Kobalte's modal Dialog hides the app with aria-hidden before its focus @@ -74,7 +75,7 @@ export function SidePanel(
-
+
{props.children}
diff --git a/src/i18n/messages.ts b/src/i18n/messages.ts index 968bee6..6b79a5d 100644 --- a/src/i18n/messages.ts +++ b/src/i18n/messages.ts @@ -25,6 +25,9 @@ export type MessageKey = | "ai.goTo" | "ai.didYouMean" | "ai.skipTyping" + | "ai.searchPlaceholder" + | "ai.scrollToLatest" + | "ai.noSearchResults" | "nav.today" | "nav.classes" | "nav.classGroups" @@ -1908,6 +1911,9 @@ const en: Dict = { "ai.goTo": "Go to the page", "ai.didYouMean": "Did you mean one of these?", "ai.skipTyping": "Show the whole answer", + "ai.searchPlaceholder": "Search this chat...", + "ai.scrollToLatest": "Latest", + "ai.noSearchResults": "No messages match your search.", "nav.today": "Today", "nav.classes": "Courses", "nav.classGroups": "Classes", @@ -3802,6 +3808,9 @@ const tr: Dict = { "ai.goTo": "Sayfaya git", "ai.didYouMean": "Bunu mu demek istedin?", "ai.skipTyping": "Cevabın tamamını göster", + "ai.searchPlaceholder": "Bu sohbette ara...", + "ai.scrollToLatest": "En alta git", + "ai.noSearchResults": "Aramanla eşleşen mesaj yok.", "nav.today": "Bugün", "nav.classes": "Dersler", "nav.classGroups": "Şubeler",