feat(kimi-web): add manual pin-to-top for sidebar workspaces - #2235
feat(kimi-web): add manual pin-to-top for sidebar workspaces#2235YoshiyukiSakura wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 6f75e2f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this comment.
💡 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".
| return partitionPinnedWorkspaces(sortWorkspacesByRecent(views, lastEditedAt), pinned); | ||
| } | ||
| return sortByWorkspaceOrder(views, workspaceOrder.value); | ||
| return partitionPinnedWorkspaces(sortByWorkspaceOrder(views, workspaceOrder.value), pinned); |
There was a problem hiding this comment.
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 👍 / 👎.
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 helperspartitionPinnedWorkspaces(stable partition — pinned first, each group keeping the current sort mode's order) andreconcilePinnedWorkspaces(drops pins for workspaces that no longer exist; same contract asreconcileWorkspaceOrder).lib/storage.ts: newkimi-web.pinned-workspaceslocalStorage key withloadPinnedWorkspaces/savePinnedWorkspaces, following the existing collapsed/order persistence pattern.useKimiWebClient.ts:pinnedWorkspacesstate loaded at startup;workspacesViewapplies the pin partition after manual/recent sorting; the existing reconcile watcher also prunes stale pins; newtoggleWorkspacePinnedaction.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 (newpinicon, Remixpushpin-line).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
gen-changesetsskill, or this PR needs no changeset. (changeset included: patch for@moonshot-ai/kimi-code)gen-docsskill, 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, andcheck:styleall green.