diff --git a/surfsense_web/components/documents/DocumentsFilters.tsx b/surfsense_web/components/documents/DocumentsFilters.tsx index 2b7cf0f10..a5ee57703 100644 --- a/surfsense_web/components/documents/DocumentsFilters.tsx +++ b/surfsense_web/components/documents/DocumentsFilters.tsx @@ -2,7 +2,6 @@ import { IconBinaryTree, IconBinaryTreeFilled } from "@tabler/icons-react"; import { FolderPlus, ListFilter, Search, Upload, X } from "lucide-react"; -import { AnimatePresence, motion } from "motion/react"; import { useTranslations } from "next-intl"; import React, { useCallback, useMemo, useRef, useState } from "react"; import { useDocumentUploadDialog } from "@/components/assistant-ui/document-upload-popup"; @@ -10,6 +9,7 @@ import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { Spinner } from "@/components/ui/spinner"; import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; @@ -74,17 +74,17 @@ export function DocumentsFilters({ return (
- {/* New Folder + Filter Toggle Group */} + {/* New Folder + AI Sort + Filter Toggle Group */} {onCreateFolder && ( { - e.preventDefault(); - onCreateFolder(); + className="h-9 w-9 shrink-0 border-sidebar-border text-muted-foreground hover:text-foreground hover:border-sidebar-border bg-sidebar" + onClick={(e) => { + e.preventDefault(); + onCreateFolder(); }} > @@ -94,13 +94,52 @@ export function DocumentsFilters({ )} + {onToggleAiSort && ( + + + { + e.preventDefault(); + onToggleAiSort(); + }} + aria-label={aiSortEnabled ? "Disable AI sort" : "Enable AI sort"} + aria-pressed={aiSortEnabled} + > + {aiSortBusy ? ( + + ) : aiSortEnabled ? ( + + ) : ( + + )} + + + + {aiSortBusy + ? "AI sort in progress..." + : aiSortEnabled + ? "AI sort active — click to disable" + : "Enable AI sort"} + + + )} + {activeTypes.length > 0 && ( @@ -182,70 +221,6 @@ export function DocumentsFilters({ - {/* AI Sort Toggle */} - {onToggleAiSort && ( - - - - - - {aiSortBusy - ? "AI sort in progress..." - : aiSortEnabled - ? "AI sort active — click to disable" - : "Enable AI sort"} - - - )} - {/* Search Input */}