From 21344384475fc3eff3d1dd866ccf06a34613269a Mon Sep 17 00:00:00 2001 From: Ben Russell <46113261+benjamindrussell@users.noreply.github.com> Date: Thu, 4 Dec 2025 11:19:14 -0500 Subject: [PATCH] 5527 multiple file popups (#5905) Signed-off-by: benjamindrussell --- ui/desktop/src/components/ChatInput.tsx | 22 +++++++++++------ .../components/bottom_menu/DirSwitcher.tsx | 24 ++++++++++++++++--- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/ui/desktop/src/components/ChatInput.tsx b/ui/desktop/src/components/ChatInput.tsx index 5f1ba35a64..ecf8fe1170 100644 --- a/ui/desktop/src/components/ChatInput.tsx +++ b/ui/desktop/src/components/ChatInput.tsx @@ -142,6 +142,7 @@ export default function ChatInput({ const [diagnosticsOpen, setDiagnosticsOpen] = useState(false); const [showCreateRecipeModal, setShowCreateRecipeModal] = useState(false); const [showEditRecipeModal, setShowEditRecipeModal] = useState(false); + const [isFilePickerOpen, setIsFilePickerOpen] = useState(false); // Save queue state (paused/interrupted) to storage useEffect(() => { @@ -1014,12 +1015,18 @@ export default function ChatInput({ }; const handleFileSelect = async () => { - const path = await window.electron.selectFileOrDirectory(); - if (path) { - const newValue = displayValue.trim() ? `${displayValue.trim()} ${path}` : path; - setDisplayValue(newValue); - setValue(newValue); - textAreaRef.current?.focus(); + if (isFilePickerOpen) return; + setIsFilePickerOpen(true); + try { + const path = await window.electron.selectFileOrDirectory(); + if (path) { + const newValue = displayValue.trim() ? `${displayValue.trim()} ${path}` : path; + setDisplayValue(newValue); + setValue(newValue); + textAreaRef.current?.focus(); + } + } finally { + setIsFilePickerOpen(false); } }; @@ -1457,9 +1464,10 @@ export default function ChatInput({ diff --git a/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx b/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx index d5d0c82428..8aa80e25aa 100644 --- a/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx +++ b/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx @@ -8,12 +8,24 @@ interface DirSwitcherProps { export const DirSwitcher: React.FC = ({ className = '' }) => { const [isTooltipOpen, setIsTooltipOpen] = useState(false); + const [isDirectoryChooserOpen, setIsDirectoryChooserOpen] = useState(false); const handleDirectoryChange = async () => { - window.electron.directoryChooser(true); + if (isDirectoryChooserOpen) return; + setIsDirectoryChooserOpen(true); + try { + await window.electron.directoryChooser(true); + } finally { + setIsDirectoryChooserOpen(false); + } }; const handleDirectoryClick = async (event: React.MouseEvent) => { + if (isDirectoryChooserOpen) { + event.preventDefault(); + event.stopPropagation(); + return; + } const isCmdOrCtrlClick = event.metaKey || event.ctrlKey; if (isCmdOrCtrlClick) { @@ -28,11 +40,17 @@ export const DirSwitcher: React.FC = ({ className = '' }) => { return ( - + { + if (!isDirectoryChooserOpen) setIsTooltipOpen(open); + }} + >