Skip to content

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Mar 26, 2025

Description

This PR includes various improvements on Pages for a better user experience-

  1. Updated the editor width for better readability in normal and full width.
  2. Added scrollbar to page content.
  3. Updated the UI of the Table of Content with a more minimilistic one.
  4. Added enough white-spaces on all the edges for better readibilty.

Type of Change

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

Screenshots and Media (if applicable)

Before After
Screen.Recording.2025-03-26.at.19.30.10.mov
Screen.Recording.2025-03-26.at.19.59.49.mov

Summary by CodeRabbit

  • New Features

    • Introduced flexible display settings for wide layouts and title width customizations.
    • Added an optional outline display for content sections.
  • Refactor

    • Streamlined layout components by removing deprecated states and simplifying prop usage.
    • Revised component structures to improve responsiveness and maintainability.
  • Style

    • Updated visual styling for improved spacing, transitions, and theming.
    • Adjusted messaging in upgrade prompts for clearer communication.
  • Chores

    • Adopted helper utilities for consistent class management and simplified error handling.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces multiple enhancements across the editor and page components. Key changes involve the adoption of a utility function for class name management and conditional application of layout classes based on the display configuration. Several components have been updated to accept additional styling props while redundant props and components have been removed. Minor adjustments in error handling and CSS rules also occur. Overall, the modifications update styling, layout control, and type definitions to support a new wide layout configuration without altering core functionality.

Changes

Files Change Summary
packages/editor/.../document/collaborative-editor.tsx, packages/editor/.../document/loader.tsx, packages/editor/.../document/page-renderer.tsx, packages/editor/.../document/read-only-editor.tsx Introduced and applied the cn utility for improved class name management; added conditional variables (e.g., blockWidthClassName and "document-editor") for responsive styling; updated component signatures to accept new styling props.
packages/editor/.../editor-container.tsx, packages/editor/.../constants/config.ts, packages/editor/.../types/config.ts Added a new wideLayout configuration—defaulting to false—and a conditional "wide-layout" class to adjust layouts in editor components.
packages/editor/.../helpers/common.ts Simplified error handling in isValidHttpUrl by removing the unused error variable in the catch block.
packages/editor/.../styles/editor.css, packages/editor/.../styles/variables.css Updated CSS rules by adding !important to the .ProseMirror outline; introduced new CSS variables for colors, font styles, and layout dimensions for light/dark themes.
web/ce/.../embed/issue-embed-upgrade-card.tsx Refined layout class assignments and updated text messaging to focus on “issues” instead of “work items”.
web/core/components/pages/editor/editor-body.tsx,
web/core/components/pages/editor/header/extra-options.tsx,
web/core/components/pages/editor/header/mobile-root.tsx,
web/core/components/pages/editor/header/root.tsx,
web/core/components/pages/editor/page-root.tsx
Removed sidePeekVisible state/props and related logic; simplified header components and restructured the page layout for a streamlined editor interface.
web/core/components/pages/editor/summary/content-browser.tsx,
web/core/components/pages/editor/summary/heading-components.tsx,
web/core/components/pages/editor/summary/index.ts,
web/core/components/pages/editor/summary/popover.tsx
Refactored summary components by adding a new optional showOutline prop, renaming type declarations (e.g., THeadingComponentProps), and removing the export/component related to the popover.
web/core/components/pages/editor/title.tsx,
web/core/components/pages/loaders/page-content-loader.tsx
Enhanced component flexibility by adding a new widthClassName prop for titles and a className prop for page content loaders, with improved class concatenation using cn.
web/core/components/pages/version/editor.tsx Updated imports to include useMember and set wideLayout: true in the display configuration for the version editor component.

Possibly related PRs

  • [PE-147] chore: merge two separate page info popovers into one #6289: The changes in the main PR are related to the modifications in the DocumentContentLoader component, which also involves the use of the cn utility function for managing class names, similar to the updates made in the PageContentLoader component in the retrieved PR.
  • [PE-182] refactor: pages' components and store for scalability #6283: The changes in the main PR are related to the modifications in the DocumentContentLoader and PageContentLoader components, as both introduce the className prop and utilize the cn utility function for managing class names, indicating a direct connection at the code level.
  • [WEB-2293] refactor: version editor #5454: The changes in the main PR are related to the modifications in the PageContentLoader component, specifically the introduction of the className prop and the use of the cn utility function, which aligns with the changes made in the DocumentContentLoader component in the retrieved PR.

Suggested labels

🎨UI / UX, ✍️editor

Suggested reviewers

  • Palanikannan1437
  • SatishGandham
  • rahulramesha

Poem

I’m a little rabbit, hopping with delight,
Changes in the code making the layouts bright.
Classes now dance with a clever new tune,
Wide layouts and themes, a developer’s boon!
Bugs scurry off while the editor sings,
With crisp new styles that bring joyous springs.
Happy hops to a code that’s light and right!


📜 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 f7b754d and 3a782d4.

📒 Files selected for processing (1)
  • packages/editor/src/styles/variables.css (3 hunks)

🪧 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 plan to trigger planning for file edits and PR creation.
  • @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: 1

🧹 Nitpick comments (2)
packages/editor/src/styles/editor.css (1)

11-11: Consider alternatives to !important

While the change ensures the outline property takes precedence, using !important is generally discouraged in CSS as it breaks the natural cascading of styles and can make future maintenance harder.

Consider increasing specificity through more targeted selectors rather than using !important if possible.

packages/editor/src/styles/variables.css (1)

188-193: Container Query for Wide Header Layout (Mid-Range Widths)
The media query using @container page-header-container (min-width: 912px) and (max-width: 1344px) applies a static padding with var(--wide-content-margin) (96px) via an !important rule. While this enforces layout consistency, consider if the use of !important might restrict future styling overrides.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 41447e5 and f7b754d.

📒 Files selected for processing (23)
  • packages/editor/src/core/components/editors/document/collaborative-editor.tsx (2 hunks)
  • packages/editor/src/core/components/editors/document/loader.tsx (1 hunks)
  • packages/editor/src/core/components/editors/document/page-renderer.tsx (1 hunks)
  • packages/editor/src/core/components/editors/document/read-only-editor.tsx (2 hunks)
  • packages/editor/src/core/components/editors/editor-container.tsx (1 hunks)
  • packages/editor/src/core/constants/config.ts (1 hunks)
  • packages/editor/src/core/helpers/common.ts (1 hunks)
  • packages/editor/src/core/types/config.ts (1 hunks)
  • packages/editor/src/styles/editor.css (1 hunks)
  • packages/editor/src/styles/variables.css (3 hunks)
  • web/ce/components/pages/editor/embed/issue-embed-upgrade-card.tsx (1 hunks)
  • web/core/components/pages/editor/editor-body.tsx (4 hunks)
  • web/core/components/pages/editor/header/extra-options.tsx (1 hunks)
  • web/core/components/pages/editor/header/mobile-root.tsx (2 hunks)
  • web/core/components/pages/editor/header/root.tsx (3 hunks)
  • web/core/components/pages/editor/page-root.tsx (1 hunks)
  • web/core/components/pages/editor/summary/content-browser.tsx (2 hunks)
  • web/core/components/pages/editor/summary/heading-components.tsx (1 hunks)
  • web/core/components/pages/editor/summary/index.ts (0 hunks)
  • web/core/components/pages/editor/summary/popover.tsx (0 hunks)
  • web/core/components/pages/editor/title.tsx (4 hunks)
  • web/core/components/pages/loaders/page-content-loader.tsx (2 hunks)
  • web/core/components/pages/version/editor.tsx (2 hunks)
💤 Files with no reviewable changes (2)
  • web/core/components/pages/editor/summary/index.ts
  • web/core/components/pages/editor/summary/popover.tsx
🧰 Additional context used
🧬 Code Definitions (3)
web/core/components/pages/editor/page-root.tsx (1)
web/core/components/pages/editor/header/root.tsx (1)
  • PageEditorHeaderRoot (21-56)
web/core/components/pages/editor/editor-body.tsx (3)
web/core/components/pages/loaders/page-content-loader.tsx (1)
  • PageContentLoader (11-85)
web/core/components/pages/editor/summary/content-browser.tsx (1)
  • PageContentBrowser (13-65)
web/core/components/pages/editor/title.tsx (1)
  • PageEditorTitle (23-89)
web/core/components/pages/editor/header/root.tsx (3)
web/core/store/pages/project-page.ts (1)
  • isContentEditable (167-177)
web/core/components/pages/editor/header/extra-options.tsx (1)
  • PageExtraOptions (30-103)
web/core/components/pages/editor/header/mobile-root.tsx (1)
  • PageEditorMobileHeaderRoot (17-32)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (59)
packages/editor/src/core/types/config.ts (1)

32-32: LGTM: Added optional wideLayout property

The addition of the optional wideLayout boolean property to the TDisplayConfig type is clean and consistent with the existing type structure. This change properly supports the PR objective of improving page layout and width configuration.

packages/editor/src/core/constants/config.ts (1)

8-8: LGTM: Default value for wideLayout is appropriate

Setting the default value to false for the new wideLayout property is a good choice as it maintains backward compatibility with existing implementations while allowing opt-in for the enhanced layout.

packages/editor/src/core/components/editors/editor-container.tsx (1)

77-77: LGTM: Conditional class implementation for wide layout

The conditional application of the "wide-layout" class using the cn utility function is clean and effective. This approach properly integrates the new layout configuration option with the component's styling.

packages/editor/src/core/helpers/common.ts (1)

52-52: Clean code improvement: Simplified catch block

Good cleanup by removing the unused error variable from the catch block. This makes the code more concise while maintaining the same functionality.

packages/editor/src/core/components/editors/document/read-only-editor.tsx (2)

4-4: Added utility for class name management

Good addition of the cn utility import from @plane/utils. This will help with more flexible and maintainable class name handling.


84-84: Enhanced styling with document-editor class

The addition of the "document-editor" class to the editor container aligns with the PR objective of improving the editor width and layout. Using the cn utility creates a clean way to combine existing classes with the new one.

packages/editor/src/core/components/editors/document/collaborative-editor.tsx (4)

4-4: Added utility for class name management

Good addition of the cn utility import from @plane/utils. This will help with more flexible and maintainable class name handling.


78-80: Improved editor width configuration

This change directly implements the PR objective of adjusting editor width for better readability in both normal and full-width modes. The implementation uses:

  • A default max width of 720px
  • An increased max width of 1152px when wide layout is enabled
  • Smooth transitions between states

This is a well-structured approach that will enhance the user experience.


82-82: Applied consistent styling to loader component

Good enhancement to ensure the DocumentContentLoader maintains the same width constraints as the main editor. This creates a more consistent visual experience during loading states.


90-90: Enhanced styling with document-editor class

The addition of the "document-editor" class to the editor container aligns with the PR objective of improving the editor width and layout. Using the cn utility creates a clean way to combine existing classes with the new one.

web/core/components/pages/editor/header/extra-options.tsx (1)

72-72: Layout adjustment: Removed justify-end class

Removing the justify-end class changes how the page options are positioned within their container. This appears to be part of the broader layout improvements mentioned in the PR objectives.

Please verify that this alignment change doesn't negatively impact the header's appearance, particularly on smaller screen sizes where space might be more constrained.

packages/editor/src/core/components/editors/document/page-renderer.tsx (1)

135-135: Improved spacing with removal of negative margin.

Removing the -mx-5 class eliminates the negative horizontal margins, which aligns with the PR objective of enhancing whitespace around the edges for better readability. This change maintains the component's width with w-full while ensuring proper spacing.

web/core/components/pages/editor/page-root.tsx (1)

106-106: Clean simplification of component props.

The removal of the sidePeekVisible prop simplifies the component's interface and aligns with the broader changes to streamline the UI across related components. This change contributes to the more minimalist design approach mentioned in the PR objectives.

web/core/components/pages/editor/summary/content-browser.tsx (3)

10-10: Good addition of optional prop for enhanced customization.

Adding the optional showOutline prop with proper TypeScript typing enhances component flexibility while maintaining backward compatibility.


14-14: Well-implemented prop with appropriate default value.

The destructuring with default value false ensures backward compatibility for existing usages of the component.


41-62: Effective implementation of minimalist outline view.

The conditional rendering based on the showOutline prop successfully implements the PR objective of revamping the Table of Contents with a minimalist design. The varying widths based on heading levels create a clear visual hierarchy, and the component maintains consistent key generation across both rendering paths.

packages/editor/src/core/components/editors/document/loader.tsx (4)

1-3: Well-structured imports with utility function for class management.

Adding the cn utility import from @plane/utils is a good practice for managing conditional class names.


5-7: Good TypeScript typing for enhanced component flexibility.

Adding a properly typed interface with an optional className prop follows best practices and improves component reusability.


9-11: Clean component signature with proper props destructuring.

The updated component signature and props destructuring make the component more maintainable and easier to understand.


13-13: Flexible styling with proper class composition.

Using the cn utility to combine the base class with any provided className enhances styling flexibility. The removal of fixed padding (px-5) in favor of size-full allows parent components to control the spacing, supporting the PR's layout improvement objectives.

web/core/components/pages/editor/title.tsx (5)

20-20: Good addition of the widthClassName prop

Adding this property to control width styling is a clean approach that supports the PR's goal of improving editor readability in different width modes.


30-33: Improved naming and class structure

Renaming to titleFontClassName better represents its purpose and removing bg-transparent helps separate styling concerns.


36-36: Enhanced container styling

The updated container class with py-3 and page-title-container improves spacing and makes selector targeting more semantic.


41-41: Good use of width control

Applying the widthClassName to the read-only title ensures consistent width control across different states.


51-85: Improved structure for editable title

Wrapping the TextArea in a div with width control creates better structural consistency between read-only and editable states, which improves maintainability.

web/ce/components/pages/editor/embed/issue-embed-upgrade-card.tsx (2)

11-11: Improved responsive layout

The updated class list with flex layout properties and responsive utilities (max-md:flex-wrap) enhances the card's appearance across different screen sizes.


17-22: Simplified structure and improved terminology

The streamlined structure with proper flex alignment and the text change from "work items" to "issues" improves clarity and consistency in terminology throughout the application.

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

11-11: Clean import organization

Moving useMember from comments to active imports improves code organization while maintaining the functionality.


49-49: Support for wide layout

Setting wideLayout: true in the display configuration directly supports the PR's goal of improving readability in full-width mode.

web/core/components/pages/editor/header/root.tsx (4)

4-4: Simplified imports

The updated imports line maintains necessary component references while removing unused ones.


22-22: Removed unnecessary props

Removing the sidePeek-related props simplifies the component API, making it easier to maintain and understand.


33-50: Improved header structure and responsiveness

The new page-header-container structure with conditional styling based on isFullWidth provides better support for different layout modes. The flex layout with proper justification improves the component's visual balance.


52-52: Simplified mobile header props

The component now passes only the necessary props to the mobile header component, improving the clarity of the parent-child relationship.

web/core/components/pages/editor/header/mobile-root.tsx (1)

5-5: Code simplification and prop cleanup.

The component has been simplified by removing the sidePeekVisible and setSidePeekVisible props, which aligns with the broader refactoring efforts across the application. These props were likely used for controlling the visibility of the page summary popover, which has been removed from this component.

Also applies to: 11-15, 18-18

web/core/components/pages/editor/editor-body.tsx (7)

14-15: Good use of utility imports.

The updated imports bring in the cn utility from @plane/utils for class name management and ERowVariant for layout control, which improves the component's flexibility.


91-93: Enhanced display configuration with isFullWidth.

Adding wideLayout: isFullWidth to the display configuration properly ties the editor's layout to the application's state. Make sure to include isFullWidth in the dependency array to ensure the memo is properly updated when the width changes.


153-158: Well-structured class management with the cn utility.

Good use of the cn utility to create a responsive block width class that adapts based on the isFullWidth state. The max-width values (720px for normal, 1152px for wide) provide appropriate reading widths for different screen sizes.


160-160: Improved loader with dynamic width class.

Passing the blockWidthClassName to the PageContentLoader ensures consistent width behavior between the loading state and the loaded editor.


163-180: Elegant Table of Contents implementation.

The new Table of Contents implementation is well-structured with:

  1. A minimalist outline view by default
  2. An expanded view on hover with full content
  3. Proper scrolling behavior with max-h-[70vh] and scrollbar styling
  4. Smooth transitions with transition-all duration-300

This approach improves the user experience by providing quick navigation without occupying too much screen space.


181-187: Proper title styling with consistent width.

Passing the blockWidthClassName to the PageEditorTitle component ensures the title follows the same width constraints as the content, maintaining a consistent layout.


188-217: Well-structured editor with proper layout configuration.

The CollaborativeDocumentEditorWithRef implementation is well organized with all necessary props for functionality and styling. The component now properly receives the displayConfig with the wideLayout property to control its width.

web/core/components/pages/loaders/page-content-loader.tsx (3)

3-9: Improved component flexibility with props type.

Adding a Props type with an optional className prop improves the component's flexibility and type safety. The cn utility import will help with class name management.


11-15: Proper class composition with the cn utility.

The component now properly accepts and applies the className prop using the cn utility, allowing parent components to customize its appearance while maintaining default styles.


41-82: Modernized layout with improved structure.

The content layout has been updated with:

  1. Modern Tailwind utilities like size-full instead of explicit width/height
  2. Proper padding with pt-[64px] to match the editor layout
  3. Improved nesting structure for loader items
  4. Consistent spacing and alignment

These changes improve the visual fidelity of the loading state to match the actual editor.

web/core/components/pages/editor/summary/heading-components.tsx (2)

1-4: Improved type declarations with proper exports.

Using import type for IMarking and exporting the renamed THeadingComponentProps improves type safety and allows other modules to reuse these types.


9-17: Enhanced heading buttons with smooth transitions.

Adding the transition-colors class to all heading buttons provides a smoother hover experience when users interact with the Table of Contents. This is a subtle but valuable UX improvement.

Also applies to: 19-27, 29-37

packages/editor/src/styles/variables.css (13)

1-19: Clean Declaration of Global CSS Variables
The :root block clearly defines text colors and layout dimensions (such as normal and wide content widths/margins). This will help maintain a consistent design system across the application.


21-31: Well-Scoped Theme Background Colors
The background color variables for both light and dark themes are defined in dedicated blocks. The values appear cohesive; however, please verify that these colors meet the required accessibility contrast ratios.


44-47: Consistent Font Size and Placeholder Styling
The introduction of the --color-placeholder variable in the .editor-container is a nice touch to keep placeholder text styling flexible. Ensure that --color-text-100 is defined elsewhere so that the fallback is reliable.


48-90: Responsive Font Sizing and Line Heights Configurations
The two modifier classes for font sizes and line heights (.large-font and .small-font) are thorough and allow for flexible typography scaling. No adjustments needed here unless future design tweaks require further refinements.


94-100: Default Font Style Variable Set
The new declaration of --font-style: "Inter", sans-serif; reinforces a consistent visual identity across the editor. Just ensure that the "Inter" font is loaded or provided as a fallback where needed.


151-152: Clear Section Delimitation
The comment marking the end of the font size and style section keeps the CSS organized.


153-167: Robust Header Container Layout Configuration
The container query for #page-header-container leverages custom properties and the new container naming strategy. The dynamic adjustment of --header-width based on the layout mode and calculated padding (using calc(((100% - var(--header-width)) / 2) - 10px)) is well thought out.


169-172: Straightforward Content Container Setup
The configuration for #page-content-container is succinct and effectively sets the container’s name and type.


174-186: Adaptive Document Editor Width
The .editor-container.document-editor block correctly sets the --editor-content-width for normal and wide layouts and applies it to the .ProseMirror element. This ensures that the main content is centered and respects the design’s responsive constraints.


203-208: Appropriate Padding for Small Header Containers
For containers with a maximum width of 760px, using var(--normal-content-margin) ensures a consistent 20px padding, as expected from the comment.


211-218: Balanced Content Container Padding for Mid-Sized Screens
The container query for #page-content-container for screens between 912px and 1344px correctly applies the wide layout margins, ensuring that the content remains proportionate on larger displays.


220-227: Responsive Adjustments for Smaller Content Containers
For container widths below 912px, the use of var(--normal-content-margin) for both left and right paddings yields a balanced layout, complementing the overall design approach.


229-240: Optimized Layout for Narrow Normal Mode
The final container query for widths below 760px not only standardizes padding using var(--normal-content-margin) but also hides the .page-summary-container, which is a considerate design adjustment for limited screen space.

@sriramveeraghanta sriramveeraghanta merged commit a25cd42 into preview Mar 26, 2025
3 of 5 checks passed
@sriramveeraghanta sriramveeraghanta deleted the style/document-editor-width branch March 26, 2025 15:40
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.

4 participants