Skip to content

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Nov 27, 2025

Description

This PR fixes the sidebar toggle button position when the sidebar is collapsed.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • New Features

    • Intelligent sidebar toggle that appears when the sidebar is collapsed and shown conditionally by navigation context.
  • UI Improvements

    • Header updated to a flexible layout with responsive padding when the sidebar is collapsed.
    • Tab navigation left padding reduced for tighter spacing.
    • Content wrapper no longer uses rounded corners for a cleaner edge-to-edge look.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Walkthrough

Adds conditional AppSidebarToggleButton rendering in several headers using theme state and route/navigation preferences, adjusts header padding and navigation spacing, removes rounded corners on a workspace wrapper, and wraps a project layout component with mobx-react's observer.

Changes

Cohort / File(s) Summary
Header: browse workItem
apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx
Read sidebarCollapsed from useAppTheme, add AppSidebarToggleButton when collapsed, apply conditional Header padding via cn, and include toggle alongside TabNavigationRoot.
Project layout (detail)
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/layout.tsx
Component reworked to use local ProjectLayout function and exported as export default observer(ProjectLayout). Reads useAppTheme, conditionally renders AppSidebarToggleButton, and applies conditional Header padding via cn.
Extended app header (CE)
apps/web/ce/components/common/extended-app-header.tsx
Add useParams and useProjectNavigationPreferences; compute shouldShowSidebarToggleButton from route and navigationMode; render AppSidebarToggleButton only when sidebarCollapsed and computed flag are true.
Navigation spacing
apps/web/core/components/navigation/tab-navigation-root.tsx
Removed pl-1.5 (left padding) from outer container to reduce left spacing.
Workspace wrapper styling (CE)
apps/web/ce/components/workspace/content-wrapper.tsx
Removed rounded-lg class from outer wrapper; otherwise preserved existing layout and transitions.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Header as Header component
  participant Theme as useAppTheme (store)
  participant Route as Router (useParams)
  participant Prefs as useProjectNavigationPreferences
  participant Toggle as AppSidebarToggleButton

  Note over Theme,Route: Render-time checks
  Header->>Theme: read sidebarCollapsed
  Header->>Route: read params (projectId, workItem)
  Header->>Prefs: read navigationMode
  alt sidebarCollapsed AND (navigationMode == "accordion" OR no projectId/workItem)
    Header->>Toggle: render AppSidebarToggleButton
    Toggle-->>Header: visible
  else
    Header-->>Toggle: do not render
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review consistency of toggle visibility logic across the three header locations.
  • Verify observer wrapping of ProjectLayout is appropriate and doesn't introduce unnecessary re-renders.
  • Check cn-based className changes and removed padding/rounded classes for layout regressions across breakpoints.
  • Confirm correct imports and no unused imports introduced (mobx-react observer, useParams, preference hooks).

Poem

🐰 I nudged the header, soft and light,
A tiny toggle loves the night.
When sidebars hide, I tap and show —
Hops of code in tidy rows.
Padding trimmed, the view feels right.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'regression: sidebar toggle button position' directly addresses the main change in the PR, which involves fixing the sidebar toggle button's position across multiple components when collapsed.
Description check ✅ Passed The PR description covers the main objective (fixing sidebar toggle button position) and identifies the change type as a bug fix, but lacks screenshots, detailed test scenarios, and references to related issues.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/toggle-sidebar-button

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ebe0df and bbf6eda.

📒 Files selected for processing (1)
  • apps/web/ce/components/workspace/content-wrapper.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,mts,cts}

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

**/*.{ts,tsx,mts,cts}: Use const type parameters for more precise literal inference in TypeScript 5.0+
Use the satisfies operator to validate types without widening them
Leverage inferred type predicates to reduce the need for explicit is return types in filter/check functions
Use NoInfer<T> utility to block inference for specific type arguments when they should be determined by other arguments
Utilize narrowing in switch(true) blocks for control flow analysis (TypeScript 5.3+)
Rely on narrowing from direct boolean comparisons for type guards
Trust preserved narrowing in closures when variables aren't modified after the check (TypeScript 5.4+)
Use constant indices to narrow object/array properties (TypeScript 5.5+)
Use standard ECMAScript decorators (Stage 3) instead of legacy experimentalDecorators
Use using declarations for explicit resource management with Disposable pattern instead of manual cleanup (TypeScript 5.2+)
Use with { type: "json" } for import attributes; avoid deprecated assert syntax (TypeScript 5.3/5.8+)
Use import type explicitly when importing types to ensure they are erased during compilation, respecting verbatimModuleSyntax flag
Use .ts, .mts, .cts extensions in import type statements (TypeScript 5.2+)
Use import type { Type } from "mod" with { "resolution-mode": "import" } for specific module resolution contexts (TypeScript 5.3+)
Use new iterator methods (map, filter, etc.) if targeting modern environments (TypeScript 5.6+)
Utilize new Set methods like union, intersection, etc., when available (TypeScript 5.5+)
Use Object.groupBy / Map.groupBy standard methods for grouping instead of external libraries (TypeScript 5.4+)
Use Promise.withResolvers() for creating promises with exposed resolve/reject functions (TypeScript 5.7+)
Use copying array methods (toSorted, toSpliced, with) for immutable array operations (TypeScript 5.2+)
Avoid accessing instance fields via super in classes (TypeScript 5....

Files:

  • apps/web/ce/components/workspace/content-wrapper.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/web/ce/components/workspace/content-wrapper.tsx (1)

15-15: Outer wrapper rounding removal looks appropriate

Removing rounded-lg from the outer wrapper (Line 15) keeps layout/behavior intact while adjusting the visual chrome, which fits with the surrounding header/sidebar changes. As long as design is aligned on a full-bleed container here, this change is good to go.


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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the sidebar toggle button positioning when the sidebar is collapsed. The fix ensures proper visual alignment by moving the toggle button outside the TabNavigationRoot component and adjusting padding dynamically based on sidebar state.

Key Changes

  • Removed left padding from tab navigation container to prevent misalignment when sidebar is collapsed
  • Added conditional rendering logic to control when the sidebar toggle button appears (only in horizontal navigation mode or outside project/workItem contexts)
  • Repositioned the toggle button to render alongside header components with consistent spacing

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tab-navigation-root.tsx Removed pl-1.5 class to eliminate left padding from the tab navigation container
extended-app-header.tsx Added conditional logic to show toggle button only in accordion mode or when not in project/workItem context
layout.tsx (ProjectLayout) Added toggle button outside Header component with conditional padding on Header based on sidebar state
header.tsx (ProjectWorkItemDetailsHeader) Added toggle button outside Header component with conditional padding on Header based on sidebar state

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx (1)

5-51: Sidebar toggle + dynamic header padding logic looks consistent and preserves previous spacing

Using sidebarCollapsed from the theme store both to render AppSidebarToggleButton and to conditionally apply "pl-1.5" via cn ensures the tabs sit flush against the toggle when collapsed and keep their prior left offset when expanded. The flex wrapper (size-full flex-1) matches the layout header structure, so behavior should be consistent across routes.

If more headers adopt this same pattern, it may be worth extracting a small shared “sidebar-aware header shell” component to avoid markup drift between screens over time. Also, continuing to rely on useParams() here fits the project’s convention that the params prop is only used in page.tsx/layout.tsx files. Based on learnings, this matches the intended routing pattern.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eddf80a and 2ebe0df.

📒 Files selected for processing (4)
  • apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx (3 hunks)
  • apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/layout.tsx (3 hunks)
  • apps/web/ce/components/common/extended-app-header.tsx (1 hunks)
  • apps/web/core/components/navigation/tab-navigation-root.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,mts,cts}

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

**/*.{ts,tsx,mts,cts}: Use const type parameters for more precise literal inference in TypeScript 5.0+
Use the satisfies operator to validate types without widening them
Leverage inferred type predicates to reduce the need for explicit is return types in filter/check functions
Use NoInfer<T> utility to block inference for specific type arguments when they should be determined by other arguments
Utilize narrowing in switch(true) blocks for control flow analysis (TypeScript 5.3+)
Rely on narrowing from direct boolean comparisons for type guards
Trust preserved narrowing in closures when variables aren't modified after the check (TypeScript 5.4+)
Use constant indices to narrow object/array properties (TypeScript 5.5+)
Use standard ECMAScript decorators (Stage 3) instead of legacy experimentalDecorators
Use using declarations for explicit resource management with Disposable pattern instead of manual cleanup (TypeScript 5.2+)
Use with { type: "json" } for import attributes; avoid deprecated assert syntax (TypeScript 5.3/5.8+)
Use import type explicitly when importing types to ensure they are erased during compilation, respecting verbatimModuleSyntax flag
Use .ts, .mts, .cts extensions in import type statements (TypeScript 5.2+)
Use import type { Type } from "mod" with { "resolution-mode": "import" } for specific module resolution contexts (TypeScript 5.3+)
Use new iterator methods (map, filter, etc.) if targeting modern environments (TypeScript 5.6+)
Utilize new Set methods like union, intersection, etc., when available (TypeScript 5.5+)
Use Object.groupBy / Map.groupBy standard methods for grouping instead of external libraries (TypeScript 5.4+)
Use Promise.withResolvers() for creating promises with exposed resolve/reject functions (TypeScript 5.7+)
Use copying array methods (toSorted, toSpliced, with) for immutable array operations (TypeScript 5.2+)
Avoid accessing instance fields via super in classes (TypeScript 5....

Files:

  • apps/web/ce/components/common/extended-app-header.tsx
  • apps/web/core/components/navigation/tab-navigation-root.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/layout.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx
🧠 Learnings (4)
📚 Learning: 2025-10-21T17:22:05.204Z
Learnt from: lifeiscontent
Repo: makeplane/plane PR: 7989
File: apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx:45-46
Timestamp: 2025-10-21T17:22:05.204Z
Learning: In the makeplane/plane repository, the refactor from useParams() to params prop is specifically scoped to page.tsx and layout.tsx files in apps/web/app (Next.js App Router pattern). Other components (hooks, regular client components, utilities) should continue using the useParams() hook as that is the correct pattern for non-route components.

Applied to files:

  • apps/web/ce/components/common/extended-app-header.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/layout.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx
📚 Learning: 2025-10-09T20:42:31.843Z
Learnt from: lifeiscontent
Repo: makeplane/plane PR: 7922
File: apps/admin/app/(all)/(dashboard)/ai/form.tsx:19-19
Timestamp: 2025-10-09T20:42:31.843Z
Learning: In the makeplane/plane repository, React types are globally available through TypeScript configuration. Type annotations like React.FC, React.ReactNode, etc. can be used without explicitly importing the React namespace. The codebase uses the modern JSX transform, so React imports are not required for JSX or type references.

Applied to files:

  • apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx
📚 Learning: 2025-05-14T13:16:23.323Z
Learnt from: vamsikrishnamathala
Repo: makeplane/plane PR: 7061
File: web/core/components/workspace-notifications/root.tsx:18-18
Timestamp: 2025-05-14T13:16:23.323Z
Learning: In the Plane project codebase, the path alias `@/plane-web` resolves to the `ce` directory, making imports like `@/plane-web/hooks/use-notification-preview` correctly resolve to files in `web/ce/hooks/`.

Applied to files:

  • apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx
📚 Learning: 2025-10-09T20:43:07.762Z
Learnt from: lifeiscontent
Repo: makeplane/plane PR: 7922
File: apps/admin/core/components/new-user-popup.tsx:4-6
Timestamp: 2025-10-09T20:43:07.762Z
Learning: The `next-themes` library is React-compatible and can be used outside of Next.js applications. It's not Next.js-specific despite its name.

Applied to files:

  • apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx
🧬 Code graph analysis (3)
apps/web/ce/components/common/extended-app-header.tsx (3)
apps/space/app/compat/next/navigation.ts (1)
  • useParams (34-36)
apps/web/core/hooks/use-navigation-preferences.ts (1)
  • useProjectNavigationPreferences (107-155)
apps/web/core/components/sidebar/sidebar-toggle-button.tsx (1)
  • AppSidebarToggleButton (6-21)
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/layout.tsx (2)
apps/web/core/components/sidebar/sidebar-toggle-button.tsx (1)
  • AppSidebarToggleButton (6-21)
packages/ui/src/header/header.tsx (1)
  • Header (76-76)
apps/web/app/(all)/[workspaceSlug]/(projects)/browse/[workItem]/header.tsx (2)
apps/web/core/components/sidebar/sidebar-toggle-button.tsx (1)
  • AppSidebarToggleButton (6-21)
packages/ui/src/header/header.tsx (1)
  • Header (76-76)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: CodeQL analysis (javascript-typescript)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
apps/web/core/components/navigation/tab-navigation-root.tsx (1)

169-246: Padding removal from tab navigation container aligns with header‑controlled spacing

Dropping the internal pl-1.5 keeps TabNavigationRoot layout-neutral and lets callers (the various headers) own leading padding so the sidebar toggle and tabs align without double indentation. This is a safe, layout-only adjustment.

apps/web/ce/components/common/extended-app-header.tsx (1)

3-26: Derived shouldShowSidebarToggleButton cleanly avoids duplicate toggles

The combination of navigation preferences and route params to compute shouldShowSidebarToggleButton, then gating the button on sidebarCollapsed && shouldShowSidebarToggleButton, nicely keeps the toggle visible for accordion/global views while avoiding a second toggle on horizontal project/work-item screens that now render their own.

Please double-check that the route param names (projectId, workItem) match the React Router path definitions for the views where this header is used so the condition behaves as intended.

apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/layout.tsx (1)

3-52: Observer‑wrapped layout with sidebar toggle + header padding matches the new pattern

Reading sidebarCollapsed via the theme hook and using it both to render AppSidebarToggleButton and to drive Header’s conditional "pl-1.5" keeps the project detail header visually in sync with the work‑item header for collapsed vs expanded sidebar states. Moving the component into a named ProjectLayout function and exporting observer(ProjectLayout) also aligns with the convention of using the params prop (Route.ComponentProps) instead of useParams() specifically in layout.tsx files. Based on learnings, this matches the intended app‑router usage.

It would still be good to run through the affected project detail route to confirm the layout continues to be recognized correctly by the router and that MobX‑driven sidebar state updates re-render as expected.

@sriramveeraghanta sriramveeraghanta merged commit 3974910 into preview Nov 27, 2025
6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix/toggle-sidebar-button branch November 27, 2025 15:23
ClarenceChen0627 pushed a commit to ClarenceChen0627/plane that referenced this pull request Dec 5, 2025
* fix: sidebar toggle button position

* chore: remove border radius
ClarenceChen0627 pushed a commit to ClarenceChen0627/plane that referenced this pull request Dec 5, 2025
* fix: sidebar toggle button position

* chore: remove border radius
ClarenceChen0627 pushed a commit to ClarenceChen0627/plane that referenced this pull request Dec 5, 2025
* fix: sidebar toggle button position

* chore: remove border radius
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants