From f0e4aa6539c3f74fae073c2e8b18156c241510d7 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Fri, 6 Mar 2026 15:35:58 +0530 Subject: [PATCH] refactor: enhance document mention functionality in chat by introducing pending mentions and removals atoms, and updating DocumentsSidebar and Composer components for improved document management --- .../(manage)/components/DocumentsFilters.tsx | 59 +--- .../components/DocumentsTableShell.tsx | 262 ++++++++++-------- .../atoms/chat/mentioned-documents.atom.ts | 18 +- .../assistant-ui/inline-mention-editor.tsx | 29 ++ .../components/assistant-ui/thread.tsx | 37 +++ .../layout/ui/sidebar/DocumentsSidebar.tsx | 91 +++--- surfsense_web/components/ui/tooltip.tsx | 2 +- 7 files changed, 261 insertions(+), 237 deletions(-) diff --git a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsFilters.tsx b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsFilters.tsx index 1cc7d8907..fabbaee39 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsFilters.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsFilters.tsx @@ -1,20 +1,9 @@ "use client"; -import { CircleAlert, ListFilter, Search, Trash, Upload, X } from "lucide-react"; +import { ListFilter, Search, Upload, X } from "lucide-react"; import { useTranslations } from "next-intl"; import React, { useMemo, useRef, useState } from "react"; import { useDocumentUploadDialog } from "@/components/assistant-ui/document-upload-popup"; -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, - AlertDialogTrigger, -} from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; @@ -24,18 +13,14 @@ import { getDocumentTypeIcon, getDocumentTypeLabel } from "./DocumentTypeIcon"; export function DocumentsFilters({ typeCounts: typeCountsRecord, - selectedIds, onSearch, searchValue, - onBulkDelete, onToggleType, activeTypes, }: { typeCounts: Partial>; - selectedIds: Set; onSearch: (v: string) => void; searchValue: string; - onBulkDelete: () => Promise; onToggleType: (type: DocumentTypeEnum, checked: boolean) => void; activeTypes: DocumentTypeEnum[]; }) { @@ -189,48 +174,6 @@ export function DocumentsFilters({ )} - {/* Bulk Delete Button */} - {selectedIds.size > 0 && ( - - - - - -
- - - - Delete {selectedIds.size} document{selectedIds.size !== 1 ? "s" : ""}? - - - This action cannot be undone. This will permanently delete the selected{" "} - {selectedIds.size === 1 ? "document" : "documents"} from your search space. - - -
- - Cancel - - Delete - - -
-
- )} - {/* Upload Button */}