diff --git a/surfsense_desktop/src/modules/window.ts b/surfsense_desktop/src/modules/window.ts index 8b7c02133..5317005d5 100644 --- a/surfsense_desktop/src/modules/window.ts +++ b/surfsense_desktop/src/modules/window.ts @@ -7,6 +7,7 @@ import { setActiveSearchSpaceId } from './active-search-space'; const isDev = !app.isPackaged; const HOSTED_FRONTEND_URL = process.env.HOSTED_FRONTEND_URL as string; +const isMac = process.platform === 'darwin'; let mainWindow: BrowserWindow | null = null; let isQuitting = false; @@ -35,7 +36,12 @@ export function createMainWindow(initialPath = '/dashboard'): BrowserWindow { webviewTag: false, }, show: false, - titleBarStyle: 'hiddenInset', + ...(isMac + ? { + titleBarStyle: 'hidden' as const, + trafficLightPosition: { x: 12, y: 10 }, + } + : {}), }); mainWindow.once('ready-to-show', () => { diff --git a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx index 027a25af3..b379e58e3 100644 --- a/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx +++ b/surfsense_web/components/layout/ui/right-panel/RightPanel.tsx @@ -3,7 +3,7 @@ import { useAtom, useAtomValue, useSetAtom } from "jotai"; import { PanelRight } from "lucide-react"; import dynamic from "next/dynamic"; -import { startTransition, useEffect, type MouseEvent } from "react"; +import { type MouseEvent, startTransition, useEffect } from "react"; import { closeReportPanelAtom, reportPanelAtom } from "@/atoms/chat/report-panel.atom"; import { citationPanelAtom, closeCitationPanelAtom } from "@/atoms/citation/citation-panel.atom"; import { documentsSidebarOpenAtom } from "@/atoms/documents/ui.atoms"; @@ -12,6 +12,7 @@ import { rightPanelCollapsedAtom, rightPanelTabAtom } from "@/atoms/layout/right import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { closeHitlEditPanelAtom, hitlEditPanelAtom } from "@/features/chat-messages/hitl"; +import { cn } from "@/lib/utils"; import { DocumentsSidebar } from "../sidebar"; const EditorPanelContent = dynamic( @@ -51,6 +52,8 @@ interface RightPanelProps { open: boolean; onOpenChange: (open: boolean) => void; }; + showCollapseButton?: boolean; + showTopBorder?: boolean; } function isKeyboardClick(event: MouseEvent) { @@ -80,13 +83,66 @@ function CollapseButton({ onClick }: { onClick: () => void }) { ); } +interface RightPanelToggleButtonProps { + className?: string; + iconClassName?: string; + disabled?: boolean; +} + +export function RightPanelToggleButton({ + className, + iconClassName, + disabled = false, +}: RightPanelToggleButtonProps) { + const [collapsed, setCollapsed] = useAtom(rightPanelCollapsedAtom); + const documentsOpen = useAtomValue(documentsSidebarOpenAtom); + const reportState = useAtomValue(reportPanelAtom); + const editorState = useAtomValue(editorPanelAtom); + const hitlEditState = useAtomValue(hitlEditPanelAtom); + const citationState = useAtomValue(citationPanelAtom); + const reportOpen = reportState.isOpen && !!reportState.reportId; + const editorOpen = + editorState.isOpen && + (editorState.kind === "document" ? !!editorState.documentId : !!editorState.localFilePath); + const hitlEditOpen = hitlEditState.isOpen && !!hitlEditState.onSave; + const citationOpen = citationState.isOpen && citationState.chunkId != null; + const hasContent = documentsOpen || reportOpen || editorOpen || hitlEditOpen || citationOpen; + const label = collapsed ? "Expand panel" : "Collapse panel"; + + if (!hasContent) return null; + + return ( + + + + + {label} + + ); +} + /** * Absolutely positioned expand button — renders at top-right of the main * container so it occupies the same screen position as the collapse button * inside the Documents header. */ export function RightPanelExpandButton() { - const [collapsed, setCollapsed] = useAtom(rightPanelCollapsedAtom); + const [collapsed] = useAtom(rightPanelCollapsedAtom); const documentsOpen = useAtomValue(documentsSidebarOpenAtom); const reportState = useAtomValue(reportPanelAtom); const editorState = useAtomValue(editorPanelAtom); @@ -104,24 +160,7 @@ export function RightPanelExpandButton() { return (
- - - - - Expand panel - +
); } @@ -134,7 +173,11 @@ const PANEL_WIDTHS = { citation: 560, } as const; -export function RightPanel({ documentsPanel }: RightPanelProps) { +export function RightPanel({ + documentsPanel, + showCollapseButton = true, + showTopBorder = false, +}: RightPanelProps) { const [activeTab] = useAtom(rightPanelTabAtom); const reportState = useAtomValue(reportPanelAtom); const closeReport = useSetAtom(closeReportPanelAtom); @@ -208,14 +251,19 @@ export function RightPanel({ documentsPanel }: RightPanelProps) { } const targetWidth = PANEL_WIDTHS[effectiveTab]; - const collapseButton = setCollapsed(true)} />; + const collapseButton = showCollapseButton ? ( + setCollapsed(true)} /> + ) : null; if (!isVisible) return null; return (