Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -607,7 +612,7 @@ export const SidebarActivityRail = memo(({ expanded = false }: SidebarActivityRa
>
{isBoundaryPanel ? null : (
<>
{showActivityRailProjectSwitcher ? (
{projectSwitcherVisible ? (
<SidebarProjectSwitcher
expanded={expanded}
project={project}
Expand Down
17 changes: 17 additions & 0 deletions windows/tauri/src/features/layout/utils/project-switcher.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { describe, expect, test } from "bun:test";
import { shouldShowProjectSwitcher } from "./project-switcher";

describe("project switcher visibility", () => {
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);
});
});
6 changes: 6 additions & 0 deletions windows/tauri/src/features/layout/utils/project-switcher.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function shouldShowProjectSwitcher(
showProjectSwitcher: boolean,
openFoldersInNewWindow: boolean,
) {
return showProjectSwitcher && !openFoldersInNewWindow;
}
Loading