From f3e5b19a9931a277eaa225eb6aac4bdc2193911e Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Thu, 5 Mar 2026 21:21:21 +0530 Subject: [PATCH] refactor: clean up DocumentsFilters component by removing unused imports and buttons, and streamline type toggle functionality --- .../(manage)/components/DocumentsFilters.tsx | 27 +++---------------- 1 file changed, 3 insertions(+), 24 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 ff9e1f246..401655c65 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,12 +1,10 @@ "use client"; -import { useSetAtom } from "jotai"; import { CircleAlert, FileType, ListFilter, Search, - SlidersHorizontal, Trash, Upload, X, @@ -14,7 +12,6 @@ import { import { motion } from "motion/react"; import { useTranslations } from "next-intl"; import React, { useMemo, useRef, useState } from "react"; -import { connectorDialogOpenAtom } from "@/atoms/connector-dialog/connector-dialog.atoms"; import { useDocumentUploadDialog } from "@/components/assistant-ui/document-upload-popup"; import { AlertDialog, @@ -55,9 +52,7 @@ export function DocumentsFilters({ const id = React.useId(); const inputRef = useRef(null); - // Dialog hooks for action buttons const { openDialog: openUploadDialog } = useDocumentUploadDialog(); - const setConnectorDialogOpen = useSetAtom(connectorDialogOpenAtom); const [typeSearchQuery, setTypeSearchQuery] = useState(""); @@ -99,15 +94,6 @@ export function DocumentsFilters({ Upload documents - {/* Spacer */} @@ -193,18 +179,11 @@ export function DocumentsFilters({ ) : ( filteredTypes.map((value: DocumentTypeEnum, i) => ( -
onToggleType(value, !activeTypes.includes(value))} - onKeyDown={(e) => { - if (e.key === "Enter" || e.key === " ") { - e.preventDefault(); - onToggleType(value, !activeTypes.includes(value)); - } - }} > {/* Icon */}
@@ -227,7 +206,7 @@ export function DocumentsFilters({ onCheckedChange={(checked: boolean) => onToggleType(value, !!checked)} className="h-4 w-4 shrink-0 rounded border-muted-foreground/30 data-[state=checked]:bg-primary data-[state=checked]:border-primary" /> -
+ )) )}