feat(desktop): add Create/Import project to v2 workspace picker

Merged
KI
6mo ago
+296-155
  • Add "Create new project" and "Import project" entries to the v2 ProjectPickerPill in the New Workspace modal; wired to the same flows used by the sidebar Add Repository button.
  • Move v2 sidebar Add Repository button next to New Workspace; rename dropdown items to "Create new project" / "Import project".
  • Refactor: openNewProject() and folderImport.start() now return promises (resolved by the modal/flow) instead of callbacks crossing a zustand store; consumers await and react in normal React flow.
  • Extract useFinalizeProjectSetup() and useHostProjectIds (with exported queryKey) into renderer/react-query/projects/. After a project is created/imported the cached host project list is invalidated so needsSetup re-evaluates correctly.

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes


Summary by cubic

Added “Create new project” and “Import project” to the v2 workspace picker and aligned the sidebar menu. Actions stay visible under the list, new/imported projects auto-select, setup status refreshes instantly, and the modal avoids init glitches while org context loads.

  • New Features

    • Added “Create new project” and “Import project” to the v2 ProjectPickerPill; pinned below the scrolling list (max height 280px) and wired to existing flows.
    • Moved the v2 sidebar Add Repository button next to New Workspace; renamed to “Create new project” / “Import project”.
    • Picker import flow now toasts “Project imported and selected.”
  • Refactors

    • openNewProject() now returns a promise with single-in-flight semantics; folderImport.start() returns a promise with the setup result.
    • Introduced useFinalizeProjectSetup to update the sidebar and invalidate hostProjectListQueryKey so needsSetup re-evaluates immediately.
    • Extracted useHostProjectIds (exports hostProjectListQueryKey) and now logs host fetch errors.
    • New Workspace modal waits for org context before initializing and avoids reselecting after the initial pick.
    • Standardized on a shared ProjectSetupResult and removed an extra error wrapper in the import hook.

Summary by CodeRabbit

  • New Features

    • Modals and project pickers: "Create new project" and "Import project" now return the created/imported project to callers; modal open returns a Promise-resolvable result.
  • Improvements

    • Consolidated post‑creation/import finalization so sidebar updates and toasts are applied consistently.
    • Centralized host-project ID fetching for more reliable project lists in pickers and dialogs.
    • Sidebar header and import dropdown layout refined.
  • Bug Fixes

    • Prevents accidental reselection when new projects appear after a modal opens.