From 10c7a5f36bca4fe7aacdbb896a0c49e98ef15e77 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Fri, 7 Mar 2025 20:24:38 +0530 Subject: [PATCH] (clean) comments --- frontend/src/components/ContextMenu.tsx | 1 - frontend/src/components/DropdownMenu.tsx | 28 ++---------------------- frontend/src/settings/Documents.tsx | 4 ---- frontend/src/settings/General.tsx | 4 ---- frontend/src/settings/Logs.tsx | 4 ---- 5 files changed, 2 insertions(+), 39 deletions(-) diff --git a/frontend/src/components/ContextMenu.tsx b/frontend/src/components/ContextMenu.tsx index 8a721198..96497482 100644 --- a/frontend/src/components/ContextMenu.tsx +++ b/frontend/src/components/ContextMenu.tsx @@ -61,7 +61,6 @@ export default function ContextMenu({ let top = rect.bottom + scrollY + offset.y; let left = rect.right + scrollX + offset.x; - // Adjust position based on position prop switch (position) { case 'bottom-left': left = rect.left + scrollX - offset.x; diff --git a/frontend/src/components/DropdownMenu.tsx b/frontend/src/components/DropdownMenu.tsx index e0c046f4..56242d7a 100644 --- a/frontend/src/components/DropdownMenu.tsx +++ b/frontend/src/components/DropdownMenu.tsx @@ -13,7 +13,6 @@ type DropdownMenuProps = { className?: string; position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'; offset?: { x: number; y: number }; - contextMenuAdjacent?: boolean; // New prop to indicate if it should position next to context menu }; export default function DropdownMenu({ @@ -28,7 +27,6 @@ export default function DropdownMenu({ className = '', position = 'bottom-right', offset = { x: 0, y: 8 }, - contextMenuAdjacent = false, // Default to false for backward compatibility }: DropdownMenuProps) { const dropdownRef = React.useRef(null); const [internalIsOpen, setInternalIsOpen] = React.useState(false); @@ -71,30 +69,8 @@ export default function DropdownMenu({ const rect = anchorRef.current.getBoundingClientRect(); - // Default positioning - let top = rect.bottom + offset.y; - let left = rect.right + offset.x; - - if (contextMenuAdjacent) { - // Position to the left of the context menu - left = rect.left - 50; // Width of dropdown + some spacing - top = rect.top; // Align tops - } else { - // Standard positioning based on position prop - switch (position) { - case 'bottom-left': - left = rect.left - offset.x; - break; - case 'top-right': - top = rect.top - offset.y; - break; - case 'top-left': - top = rect.top - offset.y; - left = rect.left - offset.x; - break; - // bottom-right is default - } - } + const top = rect.bottom + offset.y; + const left = rect.right + offset.x; return { position: 'fixed', diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx index c4a5086b..3ff6a01d 100644 --- a/frontend/src/settings/Documents.tsx +++ b/frontend/src/settings/Documents.tsx @@ -87,17 +87,13 @@ export default function Documents({ activeMenuId === docId; if (isAnyMenuOpen) { - // Close both menus setSyncMenuState((prev) => ({ ...prev, isOpen: false, docId: null })); setActiveMenuId(null); return; } - - // If no menu is open, open the context menu setActiveMenuId(docId); }; - // Close menu when clicking outside useEffect(() => { const handleClickOutside = (event: MouseEvent) => { if (activeMenuId) { diff --git a/frontend/src/settings/General.tsx b/frontend/src/settings/General.tsx index 2ffd054d..3046ca3c 100644 --- a/frontend/src/settings/General.tsx +++ b/frontend/src/settings/General.tsx @@ -84,10 +84,8 @@ export default function General() { return (
{' '} - {/* Added consistent gap between sections */}
{' '} - {/* Consistent gap between label and input */} @@ -171,9 +169,7 @@ export default function General() { setPrompts={setPrompts} />
- {/* Add horizontal line before delete button */}
- {/* Delete conversations button without label */}