History

Inline Electron project picker check in Sidebar

- Replace `shouldOpenProjectFolderPickerImmediately` with direct `isElectron` usage - Remove obsolete `Sidebar.logic.ts` and its tests

Julius Marminge committed 8 months ago

Commit ce7b24b1 parent 5c286ca3 files · +1 −33Browse files

Unified · Split

3 files
  1. apps/web/src/components/Sidebar.logic.test.ts +0 −24
  2. apps/web/src/components/Sidebar.logic.ts +0 −5
  3. apps/web/src/components/Sidebar.tsx +1 −4
apps/web/src/components/Sidebar.logic.test.ts+0−24
@@ -1,24 +0,0 @@
1−import { describe, expect, it } from "vitest";
2−import { shouldOpenProjectFolderPickerImmediately } from "./Sidebar.logic";
3−
4−describe("shouldOpenProjectFolderPickerImmediately", () => {
5− it("opens the folder picker immediately in Electron", () => {
6− expect(
7− shouldOpenProjectFolderPickerImmediately({
8− isElectron: true,
9− }),
10− ).toBe(true);
11− });
12−
13− it("still opens the folder picker immediately for mobile-width Electron layouts", () => {
14− expect(
15− shouldOpenProjectFolderPickerImmediately({
16− isElectron: true,
17− }),
18− ).toBe(true);
19− });
20−
21− it("keeps manual project entry outside Electron", () => {
22− expect(shouldOpenProjectFolderPickerImmediately({ isElectron: false })).toBe(false);
23− });
24−});
apps/web/src/components/Sidebar.logic.ts+0−5
@@ -1,5 +0,0 @@
1−export function shouldOpenProjectFolderPickerImmediately(input: {
2− isElectron: boolean;
3−}): boolean {
4− return input.isElectron;
5−}
apps/web/src/components/Sidebar.tsx+1−4
@@ -49,7 +49,6 @@ import { · 48 unmodified lines
4949 } from "./desktopUpdate.logic";
5050 import { Alert, AlertAction, AlertDescription, AlertTitle } from "./ui/alert";
5151 import { Button } from "./ui/button";
52−import { shouldOpenProjectFolderPickerImmediately } from "./Sidebar.logic";
5352 import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible";
5453 import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
5554 import {
@@ -313,9 +312,7 @@ export default function Sidebar() { · 257 unmodified lines
313312 const renamingCommittedRef = useRef(false);
314313 const renamingInputRef = useRef<HTMLInputElement | null>(null);
315314 const [desktopUpdateState, setDesktopUpdateState] = useState<DesktopUpdateState | null>(null);
316− const shouldBrowseForProjectImmediately = shouldOpenProjectFolderPickerImmediately({
317− isElectron,
318− });
315+ const shouldBrowseForProjectImmediately = isElectron;
319316 const shouldShowProjectPathEntry = addingProject && !shouldBrowseForProjectImmediately;
320317 const pendingApprovalByThreadId = useMemo(() => {
321318 const map = new Map<ThreadId, boolean>();