diff --git a/surfsense_web/components/documents/DocumentNode.tsx b/surfsense_web/components/documents/DocumentNode.tsx index 315d4b29a..e55512e96 100644 --- a/surfsense_web/components/documents/DocumentNode.tsx +++ b/surfsense_web/components/documents/DocumentNode.tsx @@ -1,7 +1,7 @@ "use client"; -import { Eye, MoreHorizontal, Move, PenLine, Trash2 } from "lucide-react"; -import React, { useCallback } from "react"; +import { AlertCircle, Clock, Eye, MoreHorizontal, Move, PenLine, Trash2 } from "lucide-react"; +import React, { useCallback, useRef } from "react"; import { useDrag } from "react-dnd"; import { getDocumentTypeIcon } from "@/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentTypeIcon"; import { Button } from "@/components/ui/button"; @@ -18,6 +18,8 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; +import { Spinner } from "@/components/ui/spinner"; +import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import type { DocumentTypeEnum } from "@/contracts/types/document.types"; import { cn } from "@/lib/utils"; import { DND_TYPES } from "./FolderNode"; @@ -76,48 +78,78 @@ export const DocumentNode = React.memo(function DocumentNode({ ); const isProcessing = statusState === "pending" || statusState === "processing"; + const rowRef = useRef(null); + + const attachRef = useCallback( + (node: HTMLButtonElement | null) => { + (rowRef as React.MutableRefObject).current = node; + drag(node); + }, + [drag] + ); return ( - {/* biome-ignore lint/a11y/useSemanticElements: div required for drag ref */} -
{ - if (e.key === "Enter" || e.key === " ") { - e.preventDefault(); - handleCheckChange(); - } - }} > - {isSelectable ? ( + {(() => { + if (statusState === "pending") { + return ( + + + + + + + Pending - waiting to be synced + + ); + } + if (statusState === "processing") { + return ( + + + + + + + Syncing + + ); + } + if (statusState === "failed") { + return ( + + + + + + + + {doc.status?.reason || "Processing failed"} + + + ); + } + return ( e.stopPropagation()} className="h-3.5 w-3.5 shrink-0" /> - ) : ( - - - - )} + ); + })()} {doc.title} @@ -164,7 +196,7 @@ export const DocumentNode = React.memo(function DocumentNode({ -
+
{contextMenuOpen && (