Skip to content

Feature request: add a project to a workspace from the Projects grid via a right-click menu #708

Open

Description

@ybw0014

Short description

Add a project to a workspace from the Projects grid through a right-click menu (Add to workspace ▸ <workspace>), so the project side can reach the membership it already displays.

What problem does this solve?

A project's workspace is visible from the project side but only editable from the workspace side, and the workspace side is a multi-step detour:

  • The Projects grid shows membership read-only. A card renders a 🗂 <name> pill when ProjectCard.workspace_name is set (packages/dashboard/src/components/Projects/ProjectsGrid.tsx:86-92), populated by workspace_name_by_identity (packages/dashboard/src-tauri/src/db.rs:5032-5043).
  • Joining a workspace is only possible inside WorkspacesPanel: click + Add member (WorkspacesPanel.tsx:559-572), pick the project from a FilterSelect built by availableProjectsForWorkspace (WorkspacesPanel.tsx:519-531, workspace-staging.ts:138-146), optionally type a display name, click Add (handleStageAddMember, WorkspacesPanel.tsx:135-154). That only stages the change, so it still needs Save changes → applyWorkspaceChanges (WorkspacesPanel.tsx:196-218).
  • So "put this project I am looking at into its workspace" costs: switch to Workspaces → find the target workspace → Add member → locate the project in a name-only dropdown (no search) → Add → Save.
  • Right-clicking a project card does nothing in the app. The card is a plain <button> with only onClick (ProjectsGrid.tsx:70-73), and packages/dashboard/src contains no contextmenu handler at all, so the right-click menu you get is the webview's own (Reload / back / forward).

Proposed solution

Give project cards a context menu with a workspace submenu:

┌──────────────────────────┐
│ Open project             │
│ Add to workspace      ▸  │──┐
└──────────────────────────┘  │
   ┌───────────────────┐      │
   │ 🗂 magic-context  │◀─────┘
   │ 🗂 guizhan-account│
   └───────────────────┘
  • Left-click keeps opening the project detail; only onContextMenu is added to the existing card control.
  • The submenu lists the workspaces from the existing listWorkspaces() (src/lib/api.ts:94). The workspace the project already belongs to is marked rather than offered again.
  • Picking a workspace commits immediately through the existing apply_workspace_changes, with no staging step — there is no workspace form on screen to save. Payload: addMembers: [{ project_path: card.identity, display_name: card.display_name, display_path: card.primary_path }], rename: null, removeMembers: [], setDisplayNames: [], and the workspace's current share_categories passed through unchanged.

No backend change is needed:

  • apply_workspace_changes is differential. Share categories are written only when the normalized value differs from the stored one (packages/dashboard/src-tauri/src/workspaces.rs:743-744), and rename: None performs no rename (workspaces.rs:746-753), so an add-only payload cannot disturb the rest of the workspace.
  • The client already has the membership data it needs: listWorkspaces() returns each workspace's members and share_categories (WorkspaceListItem, src/lib/types.ts:623-630).

Implementation notes:

  • A project can belong to at most one workspace: CREATE UNIQUE INDEX idx_mc_workspace_member_unique ON mc_workspace_members(project_path) (crates/mc-store/src/lib.rs:716-717), and the backend rejects a project that already belongs elsewhere (workspaces.rs:692-701). The submenu should therefore be a single-choice list, and read Move to workspace ▸ (remove + add) when the project already has one.
  • Home-directory projects cannot be members (workspaces.rs:653-657, is_user_home_workspace_member, workspaces.rs:841-860). The submenu should be hidden or disabled for them, or the backend error surfaced. The frontend cannot cheaply decide this itself — the home identity is dir:<md5(canonical_home)[..12]>, and the second check canonicalizes display_path, so this likely needs a flag on ProjectCard.
  • FloatingLayer (src/components/ConfigEditor/FloatingLayer.tsx) already provides a portalled, viewport-aware layer with Esc and outside-click close, and is the natural container for such a menu (it would probably want to move to src/components/shared/).

Alternatives considered

  • A hover button on the card. The card is a <button> element today (ProjectsGrid.tsx:70), so a nested button would be invalid HTML; that option costs a card rework (non-button container plus keyboard semantics) and is a bigger change than adding a context-menu handler.
  • A workspace selector on the project detail page (ProjectDetail.tsx) — the same capability, one navigation deeper.
  • A dedicated add_workspace_member command — unnecessary, because the differential apply_workspace_changes already accepts an add-only payload.

Area

Dashboard

Additional context

  • Observed on the installed dashboard build 0.20.0 (/Applications/Magic Context Dashboard.app); UI references read from master.
  • The project card and the project detail header already show which workspace a project is in; the gap is only the entry point from the project side.

Activity

  1. magic-alfonso commented on Oct 16, 2026

    @magic-alfonso

    Thanks for the thorough write-up. The analysis matches the source, and we'd welcome a PR for this. A few notes so it lands smoothly:

    • Keep it single-choice as you describe: Add to workspace ▸ when the project has no workspace, Move to workspace ▸ (remove + add) when it already has one, and the current workspace marked rather than offered.
    • For home-directory projects, please add a flag on ProjectCard from the backend (reusing is_user_home_workspace_member) and disable the submenu with a short reason, rather than letting the save fail.
    • Moving FloatingLayer to src/components/shared/ is fine. Please keep the menu keyboard-accessible (Esc to close, arrow keys if practical) and check it in the light theme.
    • Commit through the existing apply_workspace_changes with the add-only payload, passing share_categories through unchanged, and refresh the grid afterwards so the pill updates.
    • Please reference the issue as "Refs Feature request: add a project to a workspace from the Projects grid via a right-click menu #708" in the PR description rather than a closing keyword, and expect the automated review bots to comment before we merge.

    Heads-up: workspaces are part of a larger memory redesign we're working on. Standalone installs will keep Magic Context's own workspaces, so this entry point stays useful either way.

  2. added
    design-approvedDesign agreed by a maintainer; a PR referencing this issue can be reviewed
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    design-approvedDesign agreed by a maintainer; a PR referencing this issue can be reviewed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions