Skip to content

[WEB-3872]chore: header switcher enhancements#6935

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
chore-switcher_enahancement
Apr 17, 2025
Merged

[WEB-3872]chore: header switcher enhancements#6935
sriramveeraghanta merged 2 commits intopreviewfrom
chore-switcher_enahancement

Conversation

@vamsikrishnamathala
Copy link
Member

@vamsikrishnamathala vamsikrishnamathala commented Apr 15, 2025

Description

This PR includes - icon alignments and size fixes for header, fix for closing dropdown on switch.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

WEB-3872

Summary by CodeRabbit

  • New Features

    • Introduced a unified Page Access Icon that visually indicates page access status and archive state.
  • Improvements

    • Dropdown switchers for cycles, modules, pages, and views now use direct selection to navigate, replacing link-wrapped labels for a smoother experience.
    • Enhanced alignment and spacing in headers and sidebar toggle buttons for improved UI consistency.
    • Adjusted quick action button sizes for better visual balance.
  • Bug Fixes

    • Removed unused code and redundant components to streamline the interface.

* fix: switcher close on click
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 15, 2025

Walkthrough

This set of changes refactors the header components for cycles, modules, pages, and views within the project detail area of the application. The update removes the use of inline link wrappers in dropdown switchers, replacing them with programmatic navigation via router push in the dropdown's onChange handler. Several unused imports, local icon logic, and redundant components are removed. Styling adjustments are made for alignment and sizing. Additionally, a new PageAccessIcon component is introduced and exported for centralized icon rendering based on page access state.

Changes

File(s) Change Summary
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx Removed CycleDropdownOption component, eliminated link wrappers in cycle switcher, updated onChange to use router navigation, adjusted styling, removed unused imports and variables.
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx
Removed link wrappers in module/view switchers, updated onChange to use router navigation, adjusted quick action button size, updated item alignment styling.
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx Removed local icon logic and unused imports, replaced with imported PageAccessIcon, removed link wrappers in switcher, updated onChange to use router navigation.
web/core/components/common/index.ts Added export for new page-access-icon component.
web/core/components/common/page-access-icon.tsx Introduced new PageAccessIcon component to render icons based on page state.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Dropdown
    participant Router

    User->>Dropdown: Selects an option (cycle/module/page/view)
    Dropdown->>Router: Calls router.push(selectedOption.url)
    Router-->>User: Navigates to selected page
Loading

Possibly related PRs

  • makeplane/plane#6903: Refactors dropdown option components and updates header navigation logic in a similar manner for different headers.
  • makeplane/plane#6875: Refactors CycleIssuesHeader to use CustomSearchSelect and structured switcher options with navigation logic, closely related to the cycle switcher changes here.

Suggested labels

🌐frontend

Suggested reviewers

  • prateekshourya29
  • sriramveeraghanta

Poem

A dropdown once wrapped in a link,
Now navigates with a router’s wink.
Icons are tidy, the code is neat,
Quick actions sized to a pixel-perfect beat.
With headers refined and logic anew,
This bunny hops forward—cheers to the crew! 🐇✨

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 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 0e1ebff and a48cf68.

📒 Files selected for processing (6)
  • web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx (7 hunks)
  • web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx (4 hunks)
  • web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx (3 hunks)
  • web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx (4 hunks)
  • web/core/components/common/index.ts (1 hunks)
  • web/core/components/common/page-access-icon.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
web/core/components/common/page-access-icon.tsx (1)
packages/types/src/pages.d.ts (1)
  • TPage (4-24)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx (2)
web/core/components/common/switcher-label.tsx (1)
  • SwitcherLabel (13-27)
web/core/store/router.store.ts (2)
  • workspaceSlug (69-71)
  • projectId (85-87)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx (2)
web/core/components/common/switcher-label.tsx (1)
  • SwitcherLabel (13-27)
web/core/store/router.store.ts (2)
  • workspaceSlug (69-71)
  • projectId (85-87)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx (2)
web/core/components/common/switcher-label.tsx (1)
  • SwitcherLabel (13-27)
web/core/store/router.store.ts (2)
  • workspaceSlug (69-71)
  • projectId (85-87)
🔇 Additional comments (24)
web/core/components/common/index.ts (1)

10-10: Export statement for new PageAccessIcon component looks good.

The addition of this export makes the new PageAccessIcon component available for import from the common components index file.

web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx (5)

151-152: Good removal of unnecessary Link wrapper.

The SwitcherLabel is now rendered directly as content, which is cleaner and aligns with the dropdown switcher enhancement goal.


216-218: Excellent implementation of programmatic navigation.

The onChange handler now properly uses router.push to navigate to the selected module, which ensures the dropdown menu closes properly after selection - addressing one of the key objectives of this PR.


224-224: Improved header item alignment.

Adding the items-center class to Header.RightItem helps with consistent vertical alignment of the header components.


299-299: Better padding for sidebar toggle.

Increasing the padding from p-1 to p-1.5 improves the clickable area and visual appearance of the sidebar toggle button.


309-309: Consistent icon sizing.

Updating the custom class to use size-[26px] instead of size-6 provides more precise control over the icon dimensions and maintains consistency with other header components.

web/core/components/common/page-access-icon.tsx (1)

1-15: Well-structured new component for page access indicators.

This component nicely encapsulates the logic for displaying different icons based on page access state. The conditional rendering is clean and appropriate. The consistent sizing and styling of the icons (h-2.5 w-2.5) ensures visual harmony.

One minor suggestion for future improvement might be to extract the icon styling to a shared constant since it's repeated three times, but this is perfectly fine as is.

web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx (4)

46-46: Good addition of router hook for programmatic navigation.

Adding the useAppRouter hook import and instantiating the router enables the programmatic navigation implemented later in the component.

Also applies to: 54-54


158-159: Clean removal of unnecessary Link wrapper.

Directly rendering the SwitcherLabel component without a Link wrapper simplifies the code and enables the programmatic navigation approach.


185-187: Excellent implementation of programmatic navigation.

The onChange handler now properly uses router.push to navigate to the selected view, which ensures the dropdown menu closes properly after selection - addressing one of the key objectives of this PR.


273-273: Consistent icon sizing across components.

Updating the customClassName to use size-[26px] instead of size-6 for the ViewQuickActions component ensures consistent sizing with other similar components throughout the application.

web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx (6)

4-4: Import cleanup looks good.

The removal of unused icon imports and keeping only the necessary FileText import helps clean up the code.


10-10: Centralized icon component adoption is a good practice.

Using the centralized PageAccessIcon component simplifies icon management across the application and promotes reusability.


17-17: Good addition of useAppRouter import.

This import is necessary for the refactored navigation approach with programmatic routing.


29-30: Good refactor to use router directly.

Using the useAppRouter hook instead of nested Link components simplifies the navigation logic.


51-51: Clean component usage without wrapper.

Using the SwitcherLabel component directly without wrapping it in a Link makes the code cleaner and matches the new navigation approach.


102-104: Improved navigation handling.

The programmatic navigation using router.push is a cleaner approach than using nested Link components. This ensures that the dropdown menu properly closes after navigation occurs.

web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx (7)

8-8: Good cleanup of unused imports.

Removing unused icon imports keeps the code clean and improves maintainability.


28-28: Import organization looks good.

The imports are well organized and only include what's necessary for the component.


155-155: Simplified switcher content rendering.

Removing the Link wrapper around SwitcherLabel simplifies the component structure and aligns with the new navigation approach.


205-207: Improved navigation handling.

Adding programmatic navigation with router.push ensures that the dropdown menu properly closes after navigation occurs, which was a key goal of this PR.


232-232: Improved alignment with className addition.

Adding className="items-center" to the Header.RightItem helps ensure consistent vertical alignment of the header elements.


301-301: Better padding for sidebar toggle button.

Increasing the padding from p-1 to p-1.5 provides a better touch target and visual appearance for the sidebar toggle button.


311-311: Consistent sizing for quick actions.

Changing from size-6 to size-[26px] ensures consistent sizing across components and improves the overall UI alignment.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
  • @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.

@makeplane
Copy link

makeplane bot commented Apr 15, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@vamsikrishnamathala vamsikrishnamathala marked this pull request as ready for review April 16, 2025 07:39
@sriramveeraghanta sriramveeraghanta merged commit 55eea1a into preview Apr 17, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-switcher_enahancement branch April 17, 2025 11:45
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* * chore: alignment and size for header
* fix: switcher close on click

* chore: moved acces icon component to components
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