Skip to content

[WIKI-319] chore: remove bottom border when toolbar is hidden#6943

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
style/sticky-toolbar
Apr 17, 2025
Merged

[WIKI-319] chore: remove bottom border when toolbar is hidden#6943
sriramveeraghanta merged 2 commits intopreviewfrom
style/sticky-toolbar

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Apr 17, 2025

Description

This PR removes the unnecessary bottom border from the editor toolbar when toolbar is hidden

Type of Change

  • Improvement (change that would cause existing functionality to not work as expected)

Media

Before After
image image

Summary by CodeRabbit

  • New Features

    • Toolbar visibility in the editor is now dynamically controlled based on page settings, allowing it to be hidden when the sticky toolbar is disabled.
  • Style

    • Toolbar appearance and transitions have been improved for smoother show/hide effects and better visual consistency.
  • Bug Fixes

    • Toolbar is now properly hidden and non-interactive when disabled, preventing unintended interactions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 17, 2025

Walkthrough

The changes introduce a new boolean prop, isHidden, to the PageToolbar component to centralize and simplify toolbar visibility logic. The visibility state is now determined by the isStickyToolbarEnabled flag from a custom hook and whether the page content is editable. This prop is passed from both the mobile and desktop toolbar root components. The PageToolbar component uses this prop to conditionally apply CSS classes, controlling its opacity and pointer events for smooth show/hide transitions. Some border styling logic was also adjusted in the toolbar root.

Changes

File(s) Change Summary
web/core/components/pages/editor/toolbar/mobile-root.tsx Imports usePageFilters, retrieves isStickyToolbarEnabled, and passes isHidden prop to PageToolbar.
web/core/components/pages/editor/toolbar/root.tsx Adds shouldHideToolbar logic, passes isHidden to PageToolbar, and adjusts toolbar border styling.
web/core/components/pages/editor/toolbar/toolbar.tsx Extends PageToolbar props with isHidden; applies conditional CSS classes for hiding/showing the toolbar.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PageEditorToolbarRoot
    participant usePageFilters
    participant PageToolbar

    User->>PageEditorToolbarRoot: Render editor page
    PageEditorToolbarRoot->>usePageFilters: Get isStickyToolbarEnabled
    PageEditorToolbarRoot->>PageToolbar: Pass isHidden prop
    PageToolbar->>PageToolbar: Apply CSS classes based on isHidden
Loading

Poem

🐇
A toolbar now that hides with grace,
Controlled by props within its place.
Sticky flags and filters blend,
To smoothly show or softly end.
With borders trimmed and logic neat,
The editor’s toolbar feels complete!

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.
✨ 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.

@aaryan610 aaryan610 changed the title [WIKI-319] chore: remove border when toolbar is hidden [WIKI-319] chore: remove bottom border when toolbar is hidden Apr 17, 2025
@makeplane
Copy link

makeplane bot commented Apr 17, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce40df and d5fc7ff.

📒 Files selected for processing (3)
  • web/core/components/pages/editor/toolbar/mobile-root.tsx (2 hunks)
  • web/core/components/pages/editor/toolbar/root.tsx (1 hunks)
  • web/core/components/pages/editor/toolbar/toolbar.tsx (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
web/core/components/pages/editor/toolbar/mobile-root.tsx (1)
web/core/hooks/use-page-filters.ts (1)
  • usePageFilters (21-116)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
web/core/components/pages/editor/toolbar/mobile-root.tsx (1)

8-8: Implementation looks good!

Correctly imports and uses the usePageFilters hook to access the isStickyToolbarEnabled flag, which is then passed to the PageToolbar component as the isHidden prop. This change aligns with the PR objective of controlling toolbar visibility and its border.

Also applies to: 25-25, 33-33

web/core/components/pages/editor/toolbar/toolbar.tsx (2)

18-18: Good implementation of the isHidden prop

The addition of the isHidden prop to the Props type and its proper destructuring in the component function body is clean and follows best practices.

Also applies to: 67-69


101-108: Well-implemented transition effect for toolbar visibility

The conditional styling with opacity and pointer-events provides a smooth transition when showing/hiding the toolbar. Using pointer-events-none with opacity-0 is a good approach as it ensures hidden elements don't capture clicks while allowing for a smooth transition effect.

web/core/components/pages/editor/toolbar/root.tsx (2)

29-29: Good derived state for toolbar visibility

Creating a derived shouldHideToolbar value that combines both conditions (sticky toolbar status and content editability) is a clean approach that makes the code more readable and maintainable.


46-48: Good simplification of conditional rendering

The conditional rendering logic for the PageToolbar has been simplified and now correctly passes the isHidden prop based on the derived shouldHideToolbar value. This is a cleaner approach than having multiple conditions in the JSX.

Comment on lines +37 to 41
"hidden md:flex items-center relative min-h-[52px] page-toolbar-content px-page-x border-b border-transparent transition-all duration-200 ease-in-out",
{
"wide-layout": isFullWidth,
"border-custom-border-200": true,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Issue with border styling logic

The border is set to transparent by default but then border-custom-border-200 is applied unconditionally with "border-custom-border-200": true. This means the border will always be visible regardless of whether the toolbar is hidden or not, which contradicts the PR objective of removing the border when the toolbar is hidden.

The border visibility should be conditional on the toolbar visibility state. Apply this fix:

"hidden md:flex items-center relative min-h-[52px] page-toolbar-content px-page-x border-b border-transparent transition-all duration-200 ease-in-out",
{
  "wide-layout": isFullWidth,
-  "border-custom-border-200": true,
+  "border-custom-border-200": !shouldHideToolbar,
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"hidden md:flex items-center relative min-h-[52px] page-toolbar-content px-page-x border-b border-transparent transition-all duration-200 ease-in-out",
{
"wide-layout": isFullWidth,
"border-custom-border-200": true,
}
"hidden md:flex items-center relative min-h-[52px] page-toolbar-content px-page-x border-b border-transparent transition-all duration-200 ease-in-out",
{
"wide-layout": isFullWidth,
"border-custom-border-200": !shouldHideToolbar,
}

@sriramveeraghanta sriramveeraghanta merged commit fa87ff1 into preview Apr 17, 2025
4 of 5 checks passed
@sriramveeraghanta sriramveeraghanta deleted the style/sticky-toolbar branch April 17, 2025 11:43
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* chore: remove border when toolbar is hidden

* chore: add stricter conditions
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.

2 participants