Skip to content

[WEB-2373] chore: add favorites option inside a page#5512

Merged
SatishGandham merged 1 commit intopreviewfrom
chore/pages-favorites
Sep 5, 2024
Merged

[WEB-2373] chore: add favorites option inside a page#5512
SatishGandham merged 1 commit intopreviewfrom
chore/pages-favorites

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Sep 4, 2024

Improvements:

A page can now be marked as favorite/removed from inside the page details as well.

Media:

Screen.Recording.2024-09-04.at.14.36.13.mov

Plane issue: WEB-2373

Summary by CodeRabbit

  • New Features

    • Introduced a favorite handling feature, allowing users to add or remove pages from their favorites.
    • Updated UI to conditionally render a favorite star based on user permissions and page status.
  • Bug Fixes

    • Simplified state management by removing unnecessary dependencies, improving component performance and clarity.
  • Refactor

    • Enhanced the Page class to manage user permissions for favoriting pages, streamlining control flow.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 4, 2024

Walkthrough

The changes involve the removal of the GPT Assistant functionality from the PageExtraOptions component, replaced by a feature allowing users to favorite pages. The BlockItemAction component no longer depends on project data and updates its favorite functionality based on user permissions. Additionally, a new property, canCurrentUserFavoritePage, was added to the IPage interface and Page class to manage user interactions regarding favoriting pages.

Changes

Files Change Summary
web/core/components/pages/editor/header/extra-options.tsx
web/core/components/pages/list/block-item-action.tsx
The PageExtraOptions component removes GPT Assistant functionality, introducing a favorite handling feature. The BlockItemAction component eliminates project dependencies and updates favorite rendering logic based on user permissions.
web/core/store/pages/page.ts A new boolean property, canCurrentUserFavoritePage, was added to the IPage interface and Page class, allowing for user permission management related to favoriting pages.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PageExtraOptions
    participant BlockItemAction
    participant Page

    User->>PageExtraOptions: Request to favorite a page
    PageExtraOptions->>Page: Check if user can favorite
    Page-->>PageExtraOptions: Return canCurrentUserFavoritePage
    PageExtraOptions->>User: Update UI with FavoriteStar
    User->>BlockItemAction: Click FavoriteStar
    BlockItemAction->>Page: Add/Remove from favorites
    Page-->>BlockItemAction: Confirm action
    BlockItemAction->>User: Update UI
Loading

Poem

🐰
In a world of pages, bright and new,
A favorite star shines just for you.
No more GPT to lend a hand,
Just click the star, and take a stand!
With every click, your choice is clear,
Favorite a page, spread the cheer!


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 747905a and 6b8585f.

Files selected for processing (3)
  • web/core/components/pages/editor/header/extra-options.tsx (3 hunks)
  • web/core/components/pages/list/block-item-action.tsx (3 hunks)
  • web/core/store/pages/page.ts (3 hunks)
Additional comments not posted (12)
web/core/components/pages/list/block-item-action.tsx (4)

13-13: LGTM!

The code change is approved.


28-36: LGTM!

The code changes are approved.


41-59: LGTM!

The code changes are approved.


Line range hint 84-93: LGTM!

The code changes are approved.

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

4-4: LGTM!

The code changes are approved.

Also applies to: 8-8


30-38: LGTM!

The code changes are approved.


42-59: LGTM!

The code changes are approved.


93-94: LGTM!

The code changes are approved.


Line range hint 97-101: LGTM!

The code changes are approved.

web/core/store/pages/page.ts (3)

27-27: LGTM!

The addition of the canCurrentUserFavoritePage property to the IPage interface is approved.


137-137: LGTM!

The addition of the canCurrentUserFavoritePage computed property to the Page class is approved.


260-266: LGTM!

The implementation of the canCurrentUserFavoritePage getter is approved. It correctly checks the user's project role against the EUserProjectRoles.MEMBER threshold to determine if the user can favorite the page.

@SatishGandham SatishGandham merged commit dbecf5c into preview Sep 5, 2024
@SatishGandham SatishGandham deleted the chore/pages-favorites branch September 5, 2024 07:48
@coderabbitai coderabbitai bot mentioned this pull request Feb 19, 2025
1 task
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