feat(sessions): pin folders to the top of the session drawer#36
Open
goyamegh wants to merge 1 commit into
Open
feat(sessions): pin folders to the top of the session drawer#36goyamegh wants to merge 1 commit into
goyamegh wants to merge 1 commit into
Conversation
Folders (cwd groups) in the session drawer can now be pinned via a small pin button in the folder header. Pinned folders sort to the top of the drawer in pin order and stay there across session switches, filter changes, and reloads — so the drawer behaves like a stable spatial map instead of a recency-ordered log. Behaviour: - Each folder header gets a pin/unpin icon button. State is persisted per-device via the existing pi-web-session-ui-state.json round-trip (new `pinnedFolders: string[]` field). - Pinned folders render above unpinned folders in pin order. Unpinned folders keep the existing recency-based order. - A pinned folder whose sessions are hidden by an active marker-color or search filter still keeps its header (and unpin affordance) visible. - A pinned folder with no sessions left renders a small placeholder row so the user can still unpin it. Signed-off-by: goyamegh <goyamegh@amazon.com>
Author
VerificationBranch builds on current typecheckbuildunit tests (tests/api.test.ts — exercises pinnedFolders round-trip) |
There was a problem hiding this comment.
Pull request overview
Adds folder-level pinning to the sessions drawer by persisting a new pinnedFolders array in session UI state and updating the drawer rendering to keep pinned folders stable at the top (including placeholder rows when needed).
Changes:
- Extend session UI state (client + server) with
pinnedFolders, including normalization/dedupe/trim and PATCH round-tripping. - Update session drawer rendering to partition pinned vs unpinned folder groups, add a pin/unpin button in folder headers, and render placeholders for pinned-but-empty folders.
- Add API + E2E tests covering persistence, ordering, and filter interactions.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
server/sessionUiState.ts |
Adds pinnedFolders to the server-side session UI state model, normalization, and PATCH application. |
src/app/types.ts |
Adds pinnedFolders to shared client types/defaults and client-side normalization + legacy read helper. |
src/sessions/sessionDrawer.ts |
Implements folder pin/unpin behavior, pinned ordering, pin button UI, and ghost-row rendering for empty pinned folders. |
src/styles/sessions.css |
Styles the folder pin button and visual separation between pinned and unpinned groups. |
tests/api.test.ts |
Adds coverage for pinnedFolders round-trip, trimming, and deduplication. |
tests/e2e/session-bar.spec.ts |
Adds E2E coverage for pin/unpin + ordering behavior under marker filter changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+367
to
+371
| await page.locator(".sessionColorFilterButton").click(); | ||
| await page.locator(".sessionColorFilterMenuItem.all").click(); | ||
| await page.locator(".sessionColorFilterButton").click({ force: true }); | ||
| // Close any lingering menu by pressing Escape. | ||
| await page.keyboard.press("Escape"); |
Comment on lines
372
to
+377
| if (!elements.sessionDrawer.hidden) renderSessionList(cachedSessions); | ||
| renderSessionBar(); | ||
| updateSessionButtonUnread(); | ||
| updateCurrentSessionPinButton(); | ||
| renderCurrentSessionBucketButton(); | ||
| if (state.pinnedSessions.length > 0 && cachedSessions.length === 0) refreshSessions().catch(() => undefined); | ||
| if ((state.pinnedSessions.length > 0 || state.pinnedFolders.length > 0) && cachedSessions.length === 0) refreshSessions().catch(() => undefined); |
Comment on lines
246
to
+256
| const current = await (await fetch(`${baseUrl}/api/session-ui-state`)).json(); | ||
| expect(current.sessionUiState.selectedMarkerColor).toBe("green"); | ||
| expect(current.sessionUiState.sessionUnreadStates).toEqual([]); | ||
| expect(current.sessionUiState.pinnedFolders).toEqual(["/work/repo-a", "/work/repo-b"]); | ||
|
|
||
| // Reset for downstream tests. | ||
| await fetch(`${baseUrl}/api/session-ui-state`, { | ||
| method: "PATCH", | ||
| headers: { "content-type": "application/json" }, | ||
| body: JSON.stringify({ pinnedFolders: [] }), | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the ability to pin folders (cwd groups) to the top of the session drawer. Each folder header gets a small pin/unpin button; pinned folders sort to the top in pin order and stay there across session switches, filter changes, and reloads — so the drawer behaves like a stable spatial map instead of a recency-ordered log.
Why
With many concurrent sessions across several repos, the recency-ordered drawer constantly reshuffles, making it hard to find the folder you care about. Pinning lets you keep your active repos anchored at the top.
Behaviour
pin).pi-web-session-ui-state.jsonround-trip (newpinnedFolders: string[]field) — same mechanism as pinned sessions and markers, so it survives reloads and syncs through the server.Implementation
server/sessionUiState.ts—pinnedFoldersadded to the state shape, normalizer, and PATCH handler.src/app/types.ts—pinnedFoldersinSessionUiState+AppState, with normalize/legacy-read helpers.src/sessions/sessionDrawer.ts— pin/unpin/toggle helpers, partition-by-pinned render ordering, pin button + ghost-row placeholder.src/styles/sessions.css— pin button + pinned-group separator styles.Tests
tests/api.test.ts— round-tripspinnedFoldersthrough the/api/session-ui-statePATCH (dedupe + trim + reset).tests/e2e/session-bar.spec.ts— e2e coverage for pin/unpin + ordering.Verification output (typecheck / build / unit tests green) posted as a PR comment.