From 804e5e42f3da0ed4d05b15ee54b98dfd6fa630d6 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Thu, 16 Jul 2026 13:34:27 +0530 Subject: [PATCH] refactor(citation-panel): remove showHeader prop and enhance close button functionality in CitationPanelContent --- .../assistant-ui/inline-citation.tsx | 2 +- .../citation-panel/citation-panel.tsx | 48 ++++++++----------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/surfsense_web/components/assistant-ui/inline-citation.tsx b/surfsense_web/components/assistant-ui/inline-citation.tsx index a66c22fa3..a846e8311 100644 --- a/surfsense_web/components/assistant-ui/inline-citation.tsx +++ b/surfsense_web/components/assistant-ui/inline-citation.tsx @@ -100,7 +100,7 @@ const NumericChunkCitation: FC<{ chunkId: number }> = ({ chunkId }) => { Citation
- +
diff --git a/surfsense_web/components/citation-panel/citation-panel.tsx b/surfsense_web/components/citation-panel/citation-panel.tsx index 34cc89c8b..f501281b9 100644 --- a/surfsense_web/components/citation-panel/citation-panel.tsx +++ b/surfsense_web/components/citation-panel/citation-panel.tsx @@ -8,6 +8,7 @@ import { useEffect, useMemo, useRef } from "react"; import { openEditorPanelAtom } from "@/atoms/editor/editor-panel.atom"; import { MarkdownViewer } from "@/components/markdown-viewer"; import { Button } from "@/components/ui/button"; +import { Separator } from "@/components/ui/separator"; import { Spinner } from "@/components/ui/spinner"; import { documentsApiService } from "@/lib/apis/documents-api.service"; @@ -16,7 +17,6 @@ const DEFAULT_CHUNK_WINDOW = 5; interface CitationPanelContentProps { chunkId: number; onClose?: () => void; - showHeader?: boolean; } /** @@ -25,11 +25,7 @@ interface CitationPanelContentProps { * with the cited one visually highlighted and auto-scrolled into view. * The user can jump to the full document via the editor panel. */ -export const CitationPanelContent: FC = ({ - chunkId, - onClose, - showHeader = true, -}) => { +export const CitationPanelContent: FC = ({ chunkId, onClose }) => { const openEditorPanel = useSetAtom(openEditorPanelAtom); const chunkWindow = DEFAULT_CHUNK_WINDOW; @@ -85,32 +81,13 @@ export const CitationPanelContent: FC = ({ return ( <>
- {showHeader && ( -
-

Citation

-
- {onClose && ( - - )} -
-
- )} -
+

{data?.title ?? (isLoading ? "Loading…" : `Chunk #${chunkId}`)}

-
- {totalChunks > 0 && {totalChunks} chunks} +
{!isLoading && !error && data && ( )} + {onClose && ( + <> + + + + )}