From 4874c21dfdb21408064b374290f05eeedaa611fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Sat, 15 Aug 2026 20:57:15 +0000 Subject: [PATCH] search results take you to a thing, they do not open it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clicking a file result navigated to its folder AND opened a viewer pane in one gesture. Search is how you find where something is; opening it is a separate decision — so a search for a name you were merely locating left a pane you then had to close. file → its containing folder, with the row selected directory → inside it, which is what opening a folder means The file is selected rather than merely listed, so the thing you searched for is picked out of whatever else is in that folder. That makes clicking a FILE identical to Show location — one behaviour reached two ways — so the menu stops offering it twice under two names. "Open folder" now appears only on a directory result, which is the only kind that has somewhere to go into; a file gets Show location alone. `ExternalLink` went with it, since nothing was left importing it for. `handleShowLocation` is unchanged and still reveals a DIRECTORY's parent, so the two menu items on a folder are genuinely different: Open folder goes in, Show location goes to where it sits. tsgo clean, frontend builds, 817 pass / 7 fail unchanged. Co-Authored-By: Claude Opus 5 --- .../components/FileViewContainer.tsx | 18 ++++++++++------- .../FileBrowserApp/useFileBrowserApp.ts | 20 ++++++++++++++++--- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileViewContainer.tsx b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileViewContainer.tsx index 2a46ce74..78224d4d 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileViewContainer.tsx +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/components/FileViewContainer.tsx @@ -12,7 +12,7 @@ import { MessageSquare, Download, Mic, - ExternalLink, + FolderOpen, FolderSearch, GitBranch, Eye, @@ -206,12 +206,16 @@ export const FileViewContainer = ({ fileBrowserManager }: FileViewContainerProps path from the folder being browsed — reusing it would act on the wrong file. These three take the path as given. */} - handleSearchResultClick(entry)} className="cursor-pointer"> - - Open - - {/* The other question a search result raises. Clicking it opens it; this goes - to the folder it lives in and selects it there, leaving nothing open. */} + {/* Only a folder gets "Open", because only a folder has somewhere to go INTO. + For a file, opening and locating are now the same act — both land you in + its folder with it selected — so it is offered once, as Show location, + rather than twice under two names. */} + {isDir && ( + handleSearchResultClick(entry)} className="cursor-pointer"> + + Open folder + + )} handleShowLocation(entry)} className="cursor-pointer"> Show location diff --git a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts index 359df8ef..f2f70804 100644 --- a/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts +++ b/src/workspaces/officerdev/src/apps/FileBrowser/FileBrowserApp/useFileBrowserApp.ts @@ -283,14 +283,28 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, urlPa // ── Handlers ── + /** + * Clicking a search result takes you TO the thing, and does not open it. + * + * A file used to navigate to its folder and open a viewer pane in one gesture. Search is how you find + * where something is; opening it is a separate decision, and making one click do both meant a search + * for a name you were merely locating left a pane you then had to close. + * + * file → its containing folder, with the row selected + * directory → inside it, which is what opening a folder means + * + * The file case is deliberately identical to `handleShowLocation`. They are one behaviour reached two + * ways, so the menu offers it once — see the search menu in FileViewContainer. + */ const handleSearchResultClick = (entry: DirEntry) => { if (!entry.path) return; if (entry.type === 'directory') { setCurrentPath(entry.path); + setSelected(new Set()); } else { - const parentPath = entry.path.substring(0, entry.path.lastIndexOf('/')) || '/'; - setCurrentPath(parentPath); - setViewerParams({ view: entry.path }); + setCurrentPath(entry.path.substring(0, entry.path.lastIndexOf('/')) || '/'); + // Selected, so the file you searched for is picked out of whatever else is in that folder. + setSelected(new Set([entry.name])); } setSearchQuery(''); };