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 @@
1import { describe, expect, it } from "vitest";
2import { shouldOpenProjectFolderPickerImmediately } from "./Sidebar.logic";
3
4describe("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 @@
1export 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
49} from "./desktopUpdate.logic";49} from "./desktopUpdate.logic";
50import { Alert, AlertAction, AlertDescription, AlertTitle } from "./ui/alert";50import { Alert, AlertAction, AlertDescription, AlertTitle } from "./ui/alert";
51import { Button } from "./ui/button";51import { Button } from "./ui/button";
52import { shouldOpenProjectFolderPickerImmediately } from "./Sidebar.logic";
53import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible";52import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible";
54import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";53import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
55import {54import {
@@ -313,9 +312,7 @@ export default function Sidebar() { · 257 unmodified lines
313 const renamingCommittedRef = useRef(false);312 const renamingCommittedRef = useRef(false);
314 const renamingInputRef = useRef<HTMLInputElement | null>(null);313 const renamingInputRef = useRef<HTMLInputElement | null>(null);
315 const [desktopUpdateState, setDesktopUpdateState] = useState<DesktopUpdateState | null>(null);314 const [desktopUpdateState, setDesktopUpdateState] = useState<DesktopUpdateState | null>(null);
316 const shouldBrowseForProjectImmediately = shouldOpenProjectFolderPickerImmediately({315 const shouldBrowseForProjectImmediately = isElectron;
317 isElectron,
318 });
319 const shouldShowProjectPathEntry = addingProject && !shouldBrowseForProjectImmediately;316 const shouldShowProjectPathEntry = addingProject && !shouldBrowseForProjectImmediately;
320 const pendingApprovalByThreadId = useMemo(() => {317 const pendingApprovalByThreadId = useMemo(() => {
321 const map = new Map<ThreadId, boolean>();318 const map = new Map<ThreadId, boolean>();