Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-2414] chore: remove modal for creating a page #5561

Merged
merged 2 commits into from
Sep 19, 2024
Merged

Conversation

aaryan610
Copy link
Collaborator

@aaryan610 aaryan610 commented Sep 9, 2024

Improvements:

Now, clicking on the Add page button doesn't open a modal, instead it directly creates a new untitled page and redirects the user to it.

Pressing the shortcut D still opens up the create page modal.

Media:

Screen.Recording.2024-09-09.at.18.40.51.mov

Plane issue: WEB-2414

Summary by CodeRabbit

  • New Features

    • Enhanced page creation process with direct button interaction and loading feedback.
    • Added automatic focus to the title input field in the page editor for improved usability.
  • Bug Fixes

    • Improved error handling during page creation to provide user notifications.

Copy link
Contributor

coderabbitai bot commented Sep 9, 2024

Walkthrough

The pull request enhances the PagesListHeader component by implementing state management for the page creation process, utilizing the useRouter hook for navigation, and replacing the modal-based approach with a direct button interaction. Additionally, the PageEditorTitle component now includes an autoFocus property for the input element, facilitating immediate user interaction upon rendering.

Changes

File Change Summary
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsx Added state management for page creation, including a loading state and navigation upon success.
web/core/components/pages/editor/title.tsx Introduced an autoFocus property to the input element for immediate user interaction.

Possibly related PRs

Suggested labels

🧹chore, 🎨UI / UX

Suggested reviewers

  • SatishGandham
  • pushya22

🐇 In the meadow, changes bloom,
With buttons bright, dispelling gloom.
A title field that greets the eye,
Focused fast, it catches nigh.
Pages created with a swift delight,
Hopping forward, all feels right! 🌼


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7111ff4 and 7634145.

Files selected for processing (1)
  • web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsx (2 hunks)
Additional comments not posted (5)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsx (5)

3-5: LGTM!

The imports are necessary for the component's functionality and look good.


7-10: LGTM!

The imports are necessary for the component's functionality and look good.


16-17: LGTM!

The imports are necessary for the component's functionality and look good.


21-61: Excellent work on improving the page creation process!

The changes in this code segment enhance the user experience by:

  • Introducing a loading state to provide visual feedback during the page creation process.
  • Encapsulating the page creation logic in the handleCreatePage function, which includes setting the loading state, tracking the event, preparing the payload, and handling the asynchronous creation of the page.
  • Redirecting the user to the newly created page upon successful creation.
  • Implementing error handling to display a toast notification in case of failure.

The code follows best practices by using async/await for asynchronous operations and handling errors with a catch block.


93-94: Great job on updating the "Add page" button!

The changes in this code segment improve the user experience by:

  • Replacing the modal-based approach with a direct button interaction that triggers the handleCreatePage function.
  • Dynamically updating the button text based on the isCreatingPage state variable, providing visual feedback to the user during the page creation process.

These changes align with the overall goal of streamlining the page creation process and enhancing the user experience.


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 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 [WEB-2044] chore: remove modal for creating a page [WEB-2414] chore: remove modal for creating a page Sep 9, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8cf1c2d and 7111ff4.

Files selected for processing (2)
  • web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsx (2 hunks)
  • web/core/components/pages/editor/title.tsx (1 hunks)
Additional comments not posted (5)
web/core/components/pages/editor/title.tsx (1)

59-59: Verify the impact of autoFocus on user experience and accessibility.

The addition of the autoFocus property on the TextArea component is a good enhancement for user experience as it allows immediate interaction with the input field. However, please ensure that this change does not negatively impact the overall user experience or accessibility, especially if this component is used multiple times on the same page or within a larger form.

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

21-21: Good use of state management for UI feedback.

The introduction of the isCreatingPage state to manage the UI during the page creation process is a good practice. It enhances user feedback by indicating a loading state, which is crucial for a good user experience.


23-23: Proper use of useRouter for navigation.

The use of the useRouter hook for programmatic navigation after creating a page is correctly implemented. However, ensure that the navigation only occurs after the page creation is confirmed to be successful to avoid any potential issues with premature navigation.


38-58: Well-implemented page creation logic with robust error handling.

The handleCreatePage function is well-structured and effectively manages the page creation process. It includes robust error handling and state management, which are crucial for maintaining a good user experience. However, please verify that the error handling correctly captures all potential issues and that the UI state is appropriately reset in all scenarios, including any edge cases that may not have been considered.


91-92: Effective UI feedback during page creation.

The use of the loading prop on the Button component to indicate the page creation process is an effective way to provide visual feedback to the user. Ensure that this feedback is consistently accurate across all possible states of the page creation process to maintain trust and clarity for the user.

@SatishGandham
Copy link
Collaborator

@aaryan610 , I don't see the modal removal?

@pushya22 pushya22 merged commit a4933b5 into preview Sep 19, 2024
12 of 15 checks passed
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