Skip to content

feat(kimi-web): add manual pin-to-top for sidebar workspaces - #2235

Open
YoshiyukiSakura wants to merge 1 commit into
MoonshotAI:mainfrom
YoshiyukiSakura:feat/kimi-web-pin-workspaces
Open

feat(kimi-web): add manual pin-to-top for sidebar workspaces#2235
YoshiyukiSakura wants to merge 1 commit into
MoonshotAI:mainfrom
YoshiyukiSakura:feat/kimi-web-pin-workspaces

Conversation

@YoshiyukiSakura

Copy link
Copy Markdown

Related Issue

Resolve #2234

Problem

The sidebar workspace list supports drag-to-reorder (manual) and recent-activity sorting, but there is no way to keep frequently-used workspaces permanently at the top. Users with many workspaces have to repeatedly drag their main projects back up, or hunt for them whenever recent mode reshuffles the list.

What changed

A manual pin-to-top toggle for sidebar workspaces, built as a thin view-layer partition on top of the existing sort logic:

  • lib/workspaceOrder.ts: new pure helpers partitionPinnedWorkspaces (stable partition — pinned first, each group keeping the current sort mode's order) and reconcilePinnedWorkspaces (drops pins for workspaces that no longer exist; same contract as reconcileWorkspaceOrder).
  • lib/storage.ts: new kimi-web.pinned-workspaces localStorage key with loadPinnedWorkspaces / savePinnedWorkspaces, following the existing collapsed/order persistence pattern.
  • useKimiWebClient.ts: pinnedWorkspaces state loaded at startup; workspacesView applies the pin partition after manual/recent sorting; the existing reconcile watcher also prunes stale pins; new toggleWorkspacePinned action.
  • Sidebar.vue / WorkspaceGroup.vue / App.vue: "Pin to top" / "Unpin" item in the workspace kebab menu and right-click menu (label flips with state); pinned groups show a small pin icon in the header (new pin icon, Remix pushpin-line).
  • i18n: zh/en locale entries.
  • Tests: 13 new cases covering the partition/reconcile helpers and storage round-trips.

Design notes: pinning is applied strictly after the current sort, so drag-to-reorder and both sort modes behave exactly as before for unpinned workspaces, and pinned workspaces keep their mode-relative order within the pinned group. State is UI-only (localStorage), consistent with how workspace order/collapse state is already handled — no server-side changes.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset. (changeset included: patch for @moonshot-ai/kimi-code)
  • Ran gen-docs skill, or this PR needs no doc update. (no doc update needed — the sidebar workspace features are not covered in the docs site)

Verified: pnpm --filter @moonshot-ai/kimi-web test (666 tests pass), typecheck, and check:style all green.

@changeset-bot

changeset-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6f75e2f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f75e2ff9f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2400 to +2402
return partitionPinnedWorkspaces(sortWorkspacesByRecent(views, lastEditedAt), pinned);
}
return sortByWorkspaceOrder(views, workspaceOrder.value);
return partitionPinnedWorkspaces(sortByWorkspaceOrder(views, workspaceOrder.value), pinned);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Expose pin controls in the mobile workspace switcher

Because pin partitioning is applied to the shared workspacesView, the MobileSwitcherSheet also receives the reordered groups, but only the desktop Sidebar is given the pin state and toggle handler. After pinning on desktop and switching to the mobile layout (or reopening on a narrow viewport), workspaces remain silently pinned with no badge and no way to unpin them. Either wire the pin state/action into the mobile workspace menu or avoid applying pins to that view.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web UI: allow pinning workspaces to the top of the sidebar

1 participant