| author | |
| committer | |
| log | 5c286cab8b87fa5055533c54721cca52ec32050d |
| tree | 94003d24e9959d67c005e7d91c8af369512e2217 |
| parent | 75ca0d4fa41a4b5a85a6aa852dad813fbcbb94db |
- remove mobile-width gating from sidebar project picker behavior
- simplify picker logic/tests to depend only on Electron runtime3 files changed, 5 insertions(+), 16 deletions(-)
apps/web/src/components/Sidebar.logic.test.ts+4-11| ... | ... | @@ -2,30 +2,23 @@ import { describe, expect, it } from "vitest"; |
| 2 | 2 | import { shouldOpenProjectFolderPickerImmediately } from "./Sidebar.logic"; |
| 3 | 3 | |
| 4 | 4 | describe("shouldOpenProjectFolderPickerImmediately", () => { |
| 5 | it("opens the folder picker immediately in Electron on desktop", () => { | |
| 5 | it("opens the folder picker immediately in Electron", () => { | |
| 6 | 6 | expect( |
| 7 | 7 | shouldOpenProjectFolderPickerImmediately({ |
| 8 | 8 | isElectron: true, |
| 9 | isMobile: false, | |
| 10 | 9 | }), |
| 11 | 10 | ).toBe(true); |
| 12 | 11 | }); |
| 13 | 12 | |
| 14 | it("keeps manual project entry on mobile Electron layouts", () => { | |
| 13 | it("still opens the folder picker immediately for mobile-width Electron layouts", () => { | |
| 15 | 14 | expect( |
| 16 | 15 | shouldOpenProjectFolderPickerImmediately({ |
| 17 | 16 | isElectron: true, |
| 18 | isMobile: true, | |
| 19 | 17 | }), |
| 20 | ).toBe(false); | |
| 18 | ).toBe(true); | |
| 21 | 19 | }); |
| 22 | 20 | |
| 23 | 21 | it("keeps manual project entry outside Electron", () => { |
| 24 | expect( | |
| 25 | shouldOpenProjectFolderPickerImmediately({ | |
| 26 | isElectron: false, | |
| 27 | isMobile: false, | |
| 28 | }), | |
| 29 | ).toBe(false); | |
| 22 | expect(shouldOpenProjectFolderPickerImmediately({ isElectron: false })).toBe(false); | |
| 30 | 23 | }); |
| 31 | 24 | }); |
apps/web/src/components/Sidebar.logic.ts+1-2| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | export function shouldOpenProjectFolderPickerImmediately(input: { |
| 2 | 2 | isElectron: boolean; |
| 3 | isMobile: boolean; | |
| 4 | 3 | }): boolean { |
| 5 | return input.isElectron && !input.isMobile; | |
| 4 | return input.isElectron; | |
| 6 | 5 | } |
apps/web/src/components/Sidebar.tsx-3| ... | ... | @@ -32,7 +32,6 @@ import { type Thread } from "../types"; |
| 32 | 32 | import { derivePendingApprovals } from "../session-logic"; |
| 33 | 33 | import { gitRemoveWorktreeMutationOptions, gitStatusQueryOptions } from "../lib/gitReactQuery"; |
| 34 | 34 | import { serverConfigQueryOptions } from "../lib/serverReactQuery"; |
| 35 | import { useMediaQuery } from "../hooks/useMediaQuery"; | |
| 36 | 35 | import { readNativeApi } from "../nativeApi"; |
| 37 | 36 | import { type DraftThreadEnvMode, useComposerDraftStore } from "../composerDraftStore"; |
| 38 | 37 | import { selectThreadTerminalState, useTerminalStateStore } from "../terminalStateStore"; |
| ... | ... | @@ -268,7 +267,6 @@ function ProjectFavicon({ cwd }: { cwd: string }) { |
| 268 | 267 | } |
| 269 | 268 | |
| 270 | 269 | export default function Sidebar() { |
| 271 | const isMobile = useMediaQuery("(max-width: 767px)"); | |
| 272 | 270 | const projects = useStore((store) => store.projects); |
| 273 | 271 | const threads = useStore((store) => store.threads); |
| 274 | 272 | const markThreadUnread = useStore((store) => store.markThreadUnread); |
| ... | ... | @@ -317,7 +315,6 @@ export default function Sidebar() { |
| 317 | 315 | const [desktopUpdateState, setDesktopUpdateState] = useState<DesktopUpdateState | null>(null); |
| 318 | 316 | const shouldBrowseForProjectImmediately = shouldOpenProjectFolderPickerImmediately({ |
| 319 | 317 | isElectron, |
| 320 | isMobile, | |
| 321 | 318 | }); |
| 322 | 319 | const shouldShowProjectPathEntry = addingProject && !shouldBrowseForProjectImmediately; |
| 323 | 320 | const pendingApprovalByThreadId = useMemo(() => { |