Skip to content

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Feb 18, 2025

Description

This PR includes app sidebar fixes and improvements.

Type of Change

  • Bug fix
  • Improvement

References

[WEB-3422]

Summary by CodeRabbit

  • New Features

    • Streamlined workspace settings with updated preference options.
    • Enhanced sidebar navigation with improved support for a collapsed state and repositioned navigation items.
  • Style

    • Revamped sidebar layout with refined spacing, padding, and scrolling for a more polished look.
    • Improved project list display with better grouping and organization for a consistent user experience.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2025

Walkthrough

This pull request removes the YOUR_WORK enum value from the workspace user preferences and updates navigation constants by shifting the "your-work" item from dynamic to static navigation while removing "active-cycles." Additionally, various sidebar components have been updated. These include adjustments to styling classes, the addition of a new renderInExtendedSidebar property, and changes to the handling of the collapsed state via an isSidebarCollapsed prop. The JSX structure for project list rendering has also been refactored.

Changes

File(s) Change Summary
apiserver/plane/db/models/workspace.py Removed YOUR_WORK enum entry from UserPreferenceKeys in the WorkspaceUserPreference class.
packages/constants/src/workspace.ts Moved "your-work" from dynamic to static navigation; removed "active-cycles" item; updated related navigation links arrays.
web/app/[workspaceSlug]/…/extended-project-sidebar.tsx, web/app/[workspaceSlug]/…/extended-sidebar.tsx Adjusted sidebar UI: removed p-4 class, added sticky class and updated overflow, margin, gap (from gap-0 to gap-0.5), and flex-grow settings; introduced new prop in project list items.
web/ce/components/sidebar/project-navigation-root.tsx, web/core/components/workspace/sidebar/project-navigation.tsx Added the isSidebarCollapsed prop to update collapse behavior in navigation components.
web/ce/components/workspace/sidebar/sidebar-item.tsx Updated static navigation items by replacing "home" with "your-work" and removed conditional rendering of the UpgradeBadge.
web/core/components/workspace/sidebar/projects-list-item.tsx Introduced optional renderInExtendedSidebar prop and adjusted logic for sidebar collapse determination.
web/core/components/workspace/sidebar/projects-list.tsx Refactored JSX structure by grouping project mapping and the conditional "More" button within a single fragment.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant S as Sidebar Container
    participant L as SidebarProjectsListItem
    participant N as ProjectNavigationRoot
    participant PN as ProjectNavigation

    U->>S: Open sidebar
    S->>L: Render list item (with renderInExtendedSidebar flag)
    L->>N: Pass isSidebarCollapsed state
    N->>PN: Render navigation based on collapse state
    PN-->>S: Display updated sidebar UI
Loading

Possibly related PRs

Suggested labels

🐛bug, 🌐frontend, 🌟improvement, 🧹chore

Suggested reviewers

  • sriramveeraghanta
  • gurusainath

Poem

I’m a rabbit hopping through lines of code,
Skipping enums where old keys erode.
With collapsing sidebars and a smooth interface,
Every change dances, leaving a joyful trace.
My carrot-like hops bring order anew—
Happy coding and cheers from my burrow to you!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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 (4)
web/core/components/workspace/sidebar/projects-list.tsx (2)

247-247: Extract magic number as a constant.

The number 7 in slice(0, 7) should be extracted as a named constant at the top of the file for better maintainability and reusability.

+const MAX_VISIBLE_PROJECTS = 7;
 // ...
-{joinedProjects.slice(0, 7).map((projectId, index) => (
+{joinedProjects.slice(0, MAX_VISIBLE_PROJECTS).map((projectId, index) => (

274-274: Use translation for "More" text.

The hardcoded "More" text should use the translation system for consistency with i18n.

-{!sidebarCollapsed && <span>More</span>}
+{!sidebarCollapsed && <span>{t("more")}</span>}
web/core/components/workspace/sidebar/project-navigation.tsx (1)

36-41: Consider memoizing the toggleSidebar callback.

Since toggleSidebar is used in an event handler, consider memoizing it with useCallback to prevent unnecessary re-renders.

-  const { toggleSidebar } = useAppTheme();
+  const { toggleSidebar: rawToggleSidebar } = useAppTheme();
+  const toggleSidebar = useCallback(() => rawToggleSidebar(), [rawToggleSidebar]);
web/app/[workspaceSlug]/(projects)/extended-project-sidebar.tsx (1)

99-108: Consider adding ARIA attributes for better accessibility.

The sidebar implementation could benefit from ARIA attributes to improve screen reader support.

 <div
   ref={extendedProjectSidebarRef}
+  role="complementary"
+  aria-label="Extended Project Sidebar"
   className={cn(
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a49d899 and f12fbec.

📒 Files selected for processing (9)
  • apiserver/plane/db/models/workspace.py (0 hunks)
  • packages/constants/src/workspace.ts (2 hunks)
  • web/app/[workspaceSlug]/(projects)/extended-project-sidebar.tsx (4 hunks)
  • web/app/[workspaceSlug]/(projects)/extended-sidebar.tsx (1 hunks)
  • web/ce/components/sidebar/project-navigation-root.tsx (1 hunks)
  • web/ce/components/workspace/sidebar/sidebar-item.tsx (1 hunks)
  • web/core/components/workspace/sidebar/project-navigation.tsx (1 hunks)
  • web/core/components/workspace/sidebar/projects-list-item.tsx (3 hunks)
  • web/core/components/workspace/sidebar/projects-list.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • apiserver/plane/db/models/workspace.py
✅ Files skipped from review due to trivial changes (1)
  • web/app/[workspaceSlug]/(projects)/extended-sidebar.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (11)
web/core/components/workspace/sidebar/projects-list.tsx (1)

246-278: LGTM! Clean and well-structured rendering logic.

The changes improve the organization of the project list rendering by:

  • Properly grouping related elements within a fragment
  • Implementing responsive design for collapsed state
  • Adding clear conditional logic for the "More" button
web/ce/components/sidebar/project-navigation-root.tsx (1)

7-18: LGTM! Clean implementation of the sidebar collapsed state.

The addition of the isSidebarCollapsed prop and its propagation through the component is well-structured and follows React best practices.

web/ce/components/workspace/sidebar/sidebar-item.tsx (1)

45-45:

Details

❓ Verification inconclusive

Verify navigation behavior with updated static items.

The change from "home" to "your-work" in static items could affect navigation paths. Please ensure that:

  1. All navigation paths are updated accordingly
  2. No broken links are introduced
  3. User experience remains consistent

🏁 Script executed:

#!/bin/bash
# Search for any remaining references to "home" in navigation
rg -A 5 "home.*href" 

# Search for "your-work" navigation implementation
rg -A 5 "your-work.*href"

Length of output: 1231


Ensure consistent navigation paths post static items update.

The current static items array now includes both "home" and "your-work", yet our search shows that the "home" link is still referenced (e.g., in web/app/workspace-invitations/page.tsx as “Continue to home” with href="/"). Please verify that all navigation components have been updated as intended—whether to retire "home" or reconcile its coexistence with "your-work"—so that no broken links or confusing navigation patterns exist. A manual review of the navigation paths across the codebase is recommended.

web/core/components/workspace/sidebar/project-navigation.tsx (1)

29-34: LGTM! Props interface updated correctly.

The addition of isSidebarCollapsed to TProjectItemsProps is well-documented and properly typed.

web/app/[workspaceSlug]/(projects)/extended-project-sidebar.tsx (1)

138-152: LGTM! Improved scroll behavior implementation.

The addition of overflow control and custom scrollbar styling enhances the user experience while maintaining functionality.

packages/constants/src/workspace.ts (2)

301-306: LGTM! The "your-work" item is properly configured in static navigation.

The configuration includes:

  • Correct key and translation key
  • Appropriate href path
  • Proper access roles limited to admin and member

323-323: LGTM! The "your-work" item is properly added to static navigation links.

The item is correctly referenced from the static navigation items record.

web/core/components/workspace/sidebar/projects-list-item.tsx (4)

46-46: LGTM! The new prop is well-defined.

The renderInExtendedSidebar optional boolean property is clearly named and its purpose is self-evident.


50-59: LGTM! Props destructuring is properly implemented.

The destructuring includes:

  • All required props
  • Default value for renderInExtendedSidebar
  • Clean formatting

101-101: LGTM! Sidebar collapse logic is properly updated.

The condition sidebarCollapsed && !renderInExtendedSidebar ensures the sidebar only collapses when not rendering in extended mode.


404-408: LGTM! ProjectNavigationRoot props are properly updated.

The component now receives:

  • Correct workspaceSlug and projectId values
  • Properly typed isSidebarCollapsed prop derived from the updated collapse logic

@sriramveeraghanta sriramveeraghanta merged commit 1478e66 into preview Feb 18, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-app-sidebar branch February 18, 2025 12:44
@coderabbitai coderabbitai bot mentioned this pull request Mar 19, 2025
6 tasks
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.

4 participants