diff --git a/surfsense_web/components/report-panel/report-panel.tsx b/surfsense_web/components/report-panel/report-panel.tsx index e3709edeb..a6621f135 100644 --- a/surfsense_web/components/report-panel/report-panel.tsx +++ b/surfsense_web/components/report-panel/report-panel.tsx @@ -5,8 +5,10 @@ import { ChevronDownIcon, XIcon } from "lucide-react"; import { useCallback, useEffect, useRef, useState } from "react"; import { toast } from "sonner"; import { z } from "zod"; +import { currentThreadAtom } from "@/atoms/chat/current-thread.atom"; import { closeReportPanelAtom, reportPanelAtom } from "@/atoms/chat/report-panel.atom"; import { PlateEditor } from "@/components/editor/plate-editor"; +import { MarkdownViewer } from "@/components/markdown-viewer"; import { Button } from "@/components/ui/button"; import { Drawer, DrawerContent, DrawerHandle, DrawerTitle } from "@/components/ui/drawer"; import { @@ -118,6 +120,10 @@ function ReportPanelContent({ // Editor state — tracks the latest markdown from the Plate editor const [editedMarkdown, setEditedMarkdown] = useState(null); + // Read-only when public (shareToken) OR shared (SEARCH_SPACE visibility) + const currentThreadState = useAtomValue(currentThreadAtom); + const isReadOnly = !!shareToken || currentThreadState.visibility === "SEARCH_SPACE"; + // Version state const [activeReportId, setActiveReportId] = useState(reportId); const [versions, setVersions] = useState([]); @@ -414,7 +420,7 @@ function ReportPanelContent({ )} - {/* Report content — skeleton/error/editor shown only in this area */} + {/* Report content — skeleton/error/viewer/editor shown only in this area */}
{isLoading ? ( @@ -426,16 +432,22 @@ function ReportPanelContent({
) : reportContent.content ? ( - + isReadOnly ? ( +
+ +
+ ) : ( + + ) ) : (

No content available.