diff --git a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx index d6da0fb6a..2fe9ab3e8 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/RowActions.tsx @@ -25,6 +25,9 @@ import { import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import type { Document } from "./types"; +// Only FILE and NOTE document types can be edited +const EDITABLE_DOCUMENT_TYPES = ["FILE", "NOTE"] as const; + export function RowActions({ document, deleteDocument, @@ -41,6 +44,10 @@ export function RowActions({ const [isDeleting, setIsDeleting] = useState(false); const router = useRouter(); + const isEditable = EDITABLE_DOCUMENT_TYPES.includes( + document.document_type as (typeof EDITABLE_DOCUMENT_TYPES)[number] + ); + const handleDelete = async () => { setIsDeleting(true); try { @@ -65,28 +72,30 @@ export function RowActions({
{/* Desktop Actions */}
- - - - - - - -

Edit Document

-
-
+ + + + +

Edit Document

+
+ + )} @@ -146,10 +155,12 @@ export function RowActions({ - - - Edit - + {isEditable && ( + + + Edit + + )} setIsMetadataOpen(true)}> Metadata diff --git a/surfsense_web/components/markdown-viewer.tsx b/surfsense_web/components/markdown-viewer.tsx index 5318ba5d1..407adba7a 100644 --- a/surfsense_web/components/markdown-viewer.tsx +++ b/surfsense_web/components/markdown-viewer.tsx @@ -1,6 +1,5 @@ import Image from "next/image"; -import type { Components } from "react-markdown"; -import { Streamdown } from "streamdown"; +import { type StreamdownProps, Streamdown } from "streamdown"; import { cn } from "@/lib/utils"; interface MarkdownViewerProps { @@ -9,7 +8,7 @@ interface MarkdownViewerProps { } export function MarkdownViewer({ content, className }: MarkdownViewerProps) { - const components: Components = { + const components: StreamdownProps["components"] = { // Define custom components for markdown elements p: ({ children, ...props }) => (

diff --git a/surfsense_web/package.json b/surfsense_web/package.json index 2a6eaf8a6..ccb34b973 100644 --- a/surfsense_web/package.json +++ b/surfsense_web/package.json @@ -89,7 +89,6 @@ "react-dropzone": "^14.3.8", "react-hook-form": "^7.61.1", "react-json-view-lite": "^2.4.1", - "react-markdown": "^10.1.0", "react-syntax-highlighter": "^15.6.1", "react-wrap-balancer": "^1.1.1", "rehype-raw": "^7.0.0", diff --git a/surfsense_web/pnpm-lock.yaml b/surfsense_web/pnpm-lock.yaml index f11cb77b9..a184b6cd0 100644 --- a/surfsense_web/pnpm-lock.yaml +++ b/surfsense_web/pnpm-lock.yaml @@ -212,9 +212,6 @@ importers: react-json-view-lite: specifier: ^2.4.1 version: 2.5.0(react@19.2.3) - react-markdown: - specifier: ^10.1.0 - version: 10.1.0(@types/react@19.2.7)(react@19.2.3) react-syntax-highlighter: specifier: ^15.6.1 version: 15.6.6(react@19.2.3)