diff --git a/windows/tauri/src/features/layout/components/sidebar/main-sidebar.tsx b/windows/tauri/src/features/layout/components/sidebar/main-sidebar.tsx index 9168ef4b9..ee13aa2a9 100644 --- a/windows/tauri/src/features/layout/components/sidebar/main-sidebar.tsx +++ b/windows/tauri/src/features/layout/components/sidebar/main-sidebar.tsx @@ -26,6 +26,7 @@ import { getProjectSnapDuration, getProjectSwipeBounds, } from "@/features/layout/utils/project-carousel"; +import { shouldShowProjectSwitcher } from "@/features/layout/utils/project-switcher"; import type { SidebarView } from "@/features/layout/utils/sidebar-pane-utils"; import { useSettingsStore } from "@/features/settings/stores/settings.store"; import { useBufferStore } from "@/features/editor/stores/buffer.store"; @@ -154,6 +155,10 @@ export const SidebarActivityRail = memo(({ expanded = false }: SidebarActivityRa projectCarouselDirection < 0 && carouselTargetProject ? carouselTargetProject : previousProject; const renderedNextProject = projectCarouselDirection > 0 && carouselTargetProject ? carouselTargetProject : nextProject; + const projectSwitcherVisible = shouldShowProjectSwitcher( + showActivityRailProjectSwitcher, + openFoldersInNewWindow, + ); const switchToProject = useFileSystemStore((state) => state.switchToProject); const isSwitchingProject = useFileSystemStore((state) => state.isSwitchingProject); const handleSidebarViewChange = (view: typeof activeSidebarView) => { @@ -607,7 +612,7 @@ export const SidebarActivityRail = memo(({ expanded = false }: SidebarActivityRa > {isBoundaryPanel ? null : ( <> - {showActivityRailProjectSwitcher ? ( + {projectSwitcherVisible ? ( { + test("hides the activity-bar switcher when projects open in new windows", () => { + expect(shouldShowProjectSwitcher(true, true)).toBe(false); + }); + + test("shows the activity-bar switcher when in-window switching is enabled", () => { + expect(shouldShowProjectSwitcher(true, false)).toBe(true); + }); + + test("respects the user's project switcher visibility setting", () => { + expect(shouldShowProjectSwitcher(false, false)).toBe(false); + expect(shouldShowProjectSwitcher(false, true)).toBe(false); + }); +}); diff --git a/windows/tauri/src/features/layout/utils/project-switcher.ts b/windows/tauri/src/features/layout/utils/project-switcher.ts new file mode 100644 index 000000000..71e948b2f --- /dev/null +++ b/windows/tauri/src/features/layout/utils/project-switcher.ts @@ -0,0 +1,6 @@ +export function shouldShowProjectSwitcher( + showProjectSwitcher: boolean, + openFoldersInNewWindow: boolean, +) { + return showProjectSwitcher && !openFoldersInNewWindow; +}