From 2b2a4c858a1679fda786a5f3502ac38e009a4f3b Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Tue, 17 Feb 2026 03:25:24 +0530 Subject: [PATCH] refactor: update report panel and toolbar components for improved layout and accessibility, including enhanced styling and conditional rendering --- .../components/report-panel/report-panel.tsx | 5 +- surfsense_web/components/ui/editor.tsx | 6 +- .../components/ui/fixed-toolbar-buttons.tsx | 183 +++++++++--------- .../components/ui/insert-toolbar-button.tsx | 2 +- .../ui/turn-into-toolbar-button.tsx | 4 +- 5 files changed, 102 insertions(+), 98 deletions(-) diff --git a/surfsense_web/components/report-panel/report-panel.tsx b/surfsense_web/components/report-panel/report-panel.tsx index 7200e1003..780af9cac 100644 --- a/surfsense_web/components/report-panel/report-panel.tsx +++ b/surfsense_web/components/report-panel/report-panel.tsx @@ -8,7 +8,7 @@ import { z } from "zod"; import { closeReportPanelAtom, reportPanelAtom } from "@/atoms/chat/report-panel.atom"; import { PlateEditor } from "@/components/editor/plate-editor"; import { Button } from "@/components/ui/button"; -import { Drawer, DrawerContent, DrawerHandle } from "@/components/ui/drawer"; +import { Drawer, DrawerContent, DrawerHandle, DrawerTitle } from "@/components/ui/drawer"; import { DropdownMenu, DropdownMenuContent, @@ -499,8 +499,9 @@ function MobileReportDrawer() { }} shouldScaleBackground={false} > - + + {panelState.title || "Report"}
- {!readOnly && ( - <> +
+ {/* Scrollable editing buttons */} +
+ {!readOnly && ( + <> + + { + editor.undo(); + editor.tf.focus(); + }} + > + + + + { + editor.redo(); + editor.tf.focus(); + }} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + )} +
+ + {/* Fixed right-side buttons (Save + Mode) */} +
+ {/* Save button — only in edit mode with unsaved changes */} + {!readOnly && onSave && hasUnsavedChanges && ( { - editor.undo(); - editor.tf.focus(); - }} + tooltip={isSaving ? 'Saving...' : 'Save (⌘+S)'} + onClick={onSave} + disabled={isSaving} + className="bg-primary text-primary-foreground hover:bg-primary/90" > - - - - { - editor.redo(); - editor.tf.focus(); - }} - > - + {isSaving ? ( + + ) : ( + + )} + )} + {/* Mode toggle */} + {canToggleMode && ( - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - )} - -
- - {/* Save button — only in edit mode with unsaved changes */} - {!readOnly && onSave && hasUnsavedChanges && ( - - - {isSaving ? ( - - ) : ( - - )} - - - )} - - {/* Mode toggle */} - {canToggleMode && ( - - - - )} + )} +
); } diff --git a/surfsense_web/components/ui/insert-toolbar-button.tsx b/surfsense_web/components/ui/insert-toolbar-button.tsx index 4abf6a57b..666704c0c 100644 --- a/surfsense_web/components/ui/insert-toolbar-button.tsx +++ b/surfsense_web/components/ui/insert-toolbar-button.tsx @@ -195,7 +195,7 @@ export function InsertToolbarButton(props: DropdownMenuProps) { {groups.map(({ group, items }) => ( diff --git a/surfsense_web/components/ui/turn-into-toolbar-button.tsx b/surfsense_web/components/ui/turn-into-toolbar-button.tsx index 4b8c80c8e..94b77529d 100644 --- a/surfsense_web/components/ui/turn-into-toolbar-button.tsx +++ b/surfsense_web/components/ui/turn-into-toolbar-button.tsx @@ -145,7 +145,7 @@ export function TurnIntoToolbarButton({ tooltip = 'Turn into', ...props }: Dropd { e.preventDefault(); editor.tf.focus();