From b72a9c6bc4e3371994286bf62c58a030f3fa1529 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Sun, 5 Jul 2026 15:33:54 +0200 Subject: [PATCH] Show project names in directory switcher dropdown (#10207) Co-authored-by: Claude Opus 4.6 (1M context) --- .../components/bottom_menu/DirSwitcher.tsx | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx b/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx index 32a88ba72..f269e00e5 100644 --- a/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx +++ b/ui/desktop/src/components/bottom_menu/DirSwitcher.tsx @@ -43,6 +43,24 @@ const i18n = defineMessages({ }, }); +const splitDirPath = (dir: string): { name: string; parent: string } => { + const normalized = dir.replace(/[\\/]+$/, ''); + const parts = normalized.split(/[\\/]/); + const name = parts.pop() || dir; + const parent = parts.join('/'); + return { name, parent }; +}; + +const DirNameLabel: React.FC<{ dir: string }> = ({ dir }) => { + const { name, parent } = splitDirPath(dir); + return ( +
+ {name} + {parent && {parent}} +
+ ); +}; + interface DirSwitcherProps { className: string; sessionId: string | undefined; @@ -190,14 +208,14 @@ export const DirSwitcher: React.FC = ({ - + {intl.formatMessage(i18n.currentDirectory)} void window.electron.openDirectoryInExplorer(workingDir)} > - - {workingDir} - + + + @@ -208,8 +226,8 @@ export const DirSwitcher: React.FC = ({ key={`worktree-${dir}`} onSelect={() => void handleSelectDirectory(dir)} > - - {dir} + + )) ) : ( @@ -228,8 +246,8 @@ export const DirSwitcher: React.FC = ({ key={`recent-${dir}`} onSelect={() => void handleSelectDirectory(dir)} > - - {dir} + + ))}