Skip to content

refactor(app): extract pawwork project/pinned controls from layout.tsx - #1060

Merged
Astro-Han merged 1 commit into
devfrom
claude/layout-nav-pinned
Jun 2, 2026
Merged

refactor(app): extract pawwork project/pinned controls from layout.tsx#1060
Astro-Han merged 1 commit into
devfrom
claude/layout-nav-pinned

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

Pure extraction (layout governance slice 3, refs #1056) of the pawwork project/pinned organization actions out of packages/app/src/pages/layout.tsx into a dedicated controller, packages/app/src/pages/layout/pawwork-project-controls.ts.

What moved (verbatim, no behavior change)

  • Pinned: togglePinnedSession, dragPawworkSession (cross-zone All<->Pinned drag + intra-pinned reorder), movePinnedSessionByOne (menu-driven reorder)
  • Project view: setPawworkSortMode, toggleProjectCollapsed, expandPawworkProjectGroup
  • Project hide/rename: hideProject, unhideProject, handleRenameProject

Exposed as createPawworkProjectControls(input) taking reactive accessors (projects, sessions) plus the layout-owned renameProject / setWorkspaceName as injected deps, and store/setStore/language. All 9 functions are returned and destructured back into layout.tsx with identical names, so every call site (sidebar render props, keyboard-nav navigateSessionByOffset/navigateSessionByUnseen calling expandPawworkProjectGroup, and the navigation helpers calling unhideProject) is byte-unchanged.

dragPawworkSession / movePinnedSessionByOne had a param literally named input; renamed to args to avoid shadowing the controller's input — local rename only, no contract change.

Scope boundary

Navigation wrappers (navigateToSession, navigateToProject, openPawworkHome, syncSessionRoute) stay in layout.tsx: they are thin shells over the already-extracted shellNavigation + projectRoot routing infra and belong with the routing slice (4), not here. Slice 3 narrows to the cohesive project/pinned organization subset (the tracking issue allows order/scope to shift with real dependencies).

Touched files

  • packages/app/src/pages/layout.tsx (+23 / -129; 1704->1598 lines; removed 9 fn defs + 4 now-unused imports: reconcile, resolvePawworkProjectRenameTarget, reorderPawworkPinnedByVisible, unpinPawworkSession)
  • packages/app/src/pages/layout/pawwork-project-controls.ts (new, ~165 lines)

Verification

  • bun turbo typecheck: 8/8 pass
  • cd packages/app && bun test src/pages/layout: 158 pass / 0 fail
  • No DOM/copy/aria/command-id/storage-key/styling change. Underlying helpers (reorderPawworkPinnedByVisible/unpinPawworkSession/resolvePawworkProjectRenameTarget) are unchanged and already unit-tested. Sidebar interaction is identical (same-name destructure, render props unchanged) — relying on CI e2e-artifacts for the rendered sidebar path.

Risk

Low — mechanical extraction. pages/layout.tsx is also touched by open PR #1053 (automation); changed regions do not overlap (this PR: mid-file fn block; #1053: imports + command region + render tail). Per repo owner, #1053 rebases after this merges.

Refs #1056, follow-up to #875.

Summary by CodeRabbit

  • Refactor
    • Reorganized project control logic into a dedicated module for improved code maintainability.

@Astro-Han Astro-Han added P2 Medium priority app Application behavior and product flows ui Design system and user interface task Narrow execution, audit, spike, migration, tracking, or upstream follow-up work tech-debt Supplemental cleanup, maintainability, architecture, test, or quality debt context labels Jun 2, 2026
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 50b6c7c4-8d65-488e-b523-b4365ef9453b

📥 Commits

Reviewing files that changed from the base of the PR and between 4f81a95 and c75ece5.

📒 Files selected for processing (2)
  • packages/app/src/pages/layout.tsx
  • packages/app/src/pages/layout/pawwork-project-controls.ts

📝 Walkthrough

Walkthrough

This PR refactors pawwork sidebar controls by extracting pinned session, project visibility, sorting, and rename handlers from layout.tsx into a new createPawworkProjectControls factory function in a dedicated module, reducing layout.tsx complexity and centralizing control logic.

Changes

Pawwork Project Controls Extraction

Layer / File(s) Summary
New Pawwork controls factory
packages/app/src/pages/layout/pawwork-project-controls.ts
Introduces PawworkProjectControlsInput type and createPawworkProjectControls factory. Implements toggling/dragging/reordering pinned sessions, setting sort mode and project collapse state, hiding/unhiding projects with toast undo, resolving and applying project/workspace renames, and expanding collapsed project groups. Returns object exposing all handlers.
Layout.tsx integration and imports
packages/app/src/pages/layout.tsx
Updates solid-js/store import to remove reconcile, adds session navigation/source modules to Pawwork imports, and replaces inline handler functions with destructured handlers from createPawworkProjectControls.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • Astro-Han/pawwork#1056: PR implements the layout controller split by extracting pawwork project/session handlers into createPawworkProjectControls.

Possibly related PRs

  • Astro-Han/pawwork#810: Both PRs refactor Pawwork sidebar rename handling; this PR centralizes rename logic into the controls factory while the retrieved PR modified rename target resolution via session/project resolvers.

Poem

🐰 A sidebar refactor hops into place,
Handlers extracted at a cleaner pace—
Pinned, sorted, hidden, and renamed with care,
One factory shines where controls once were rare! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main change: extracting pawwork project/pinned controls from layout.tsx into a dedicated module.
Description check ✅ Passed The PR description is comprehensive and covers all required template sections: summary, context, related issue, human review status, review focus, risk notes, and verification steps with actual results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/layout-nav-pinned

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions 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.

Suggested priority: P2 (includes user-path files (packages/app/src/pages/layout.tsx, packages/app/src/pages/layout/pawwork-project-controls.ts)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request refactors the Layout component by extracting several project-related control functions (such as pinning sessions, dragging sessions, collapsing/hiding/renaming projects) into a new helper function createPawworkProjectControls in a separate file. This improves code modularity and readability. There are no review comments, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Astro-Han
Astro-Han merged commit 1c786f3 into dev Jun 2, 2026
37 of 39 checks passed
@Astro-Han
Astro-Han deleted the claude/layout-nav-pinned branch June 2, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows P2 Medium priority task Narrow execution, audit, spike, migration, tracking, or upstream follow-up work tech-debt Supplemental cleanup, maintainability, architecture, test, or quality debt context ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant