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(''); };