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

Updated card order in card menu #1445

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Updated card order in card menu #1445

wants to merge 2 commits into from

Conversation

sanne-san
Copy link
Member

No ref

  • Updated the order to reflect frequency of use

No ref
- Updated the order to reflect frequency of use
Copy link

coderabbitai bot commented Feb 12, 2025

Walkthrough

The pull request updates the priority values in the static kgMenu configurations across multiple node classes within the packages/koenig-lexical directory. Adjustments have been made to the priority properties for the BookmarkNode, ButtonNode, CallToActionNode, CalloutNode, EmailCtaNode, EmailNode, GalleryNode, HeaderNode, HorizontalRuleNode, HtmlNode, ImageNode, MarkdownNode, PaywallNode, and SignupNode classes. The CallToActionNode has also had its matches array expanded to include additional keywords. The SignupNode class sees the introduction of a new priority property in its static kgMenu. These modifications solely impact the ordering and matching criteria related to the menu representations of these nodes without altering other aspects of their functionality.

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/koenig-lexical/test/e2e/cards/email-card.test.js

Oops! Something went wrong! :(

ESLint: 8.57.0

ESLint couldn't find the config "react-app" to extend from. Please check that the name of the config is correct.

The config "react-app" was referenced from the config file in "/packages/koenig-lexical/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.


📜 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 bd35e0b and 942c1a8.

📒 Files selected for processing (1)
  • packages/koenig-lexical/test/e2e/cards/email-card.test.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Node 20.11.1
🔇 Additional comments (1)
packages/koenig-lexical/test/e2e/cards/email-card.test.js (1)

5-7: LGTM! More reliable test implementation.

The changes improve test reliability by:

  • Using a more resilient selector strategy (waiting for menu before specific item)
  • Using mouse clicks instead of keyboard navigation
  • Better reflecting real user interactions
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

@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: 2

🧹 Nitpick comments (2)
packages/koenig-lexical/src/nodes/EmailNode.jsx (1)

1-1: Consider reviewing priority assignments for consistency.

While most priority adjustments align with the goal of reflecting usage frequency, some changes (particularly HTML and Email nodes) seem to contradict this pattern. Consider:

  1. Lowering priorities for specialized features (HTML, Email)
  2. Maintaining higher priorities for commonly used features (Bookmark)
  3. Documenting the rationale for priority assignments to ensure maintainability
packages/koenig-lexical/src/nodes/ImageNode.jsx (1)

60-60: Consider adjusting GIF priority for consistency.

The GIF option has a priority of 17, which seems high compared to related image options (Image: 1, Unsplash: 3). Consider lowering the priority to maintain a more logical grouping with other image-related options.

-        priority: 17,
+        priority: 4,
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4455a7d and bd35e0b.

📒 Files selected for processing (14)
  • packages/koenig-lexical/src/nodes/BookmarkNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/ButtonNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/CallToActionNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/CalloutNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/EmailCtaNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/EmailNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/GalleryNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/HeaderNode.jsx (2 hunks)
  • packages/koenig-lexical/src/nodes/HorizontalRuleNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/HtmlNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/ImageNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/MarkdownNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/PaywallNode.jsx (1 hunks)
  • packages/koenig-lexical/src/nodes/SignupNode.jsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/koenig-lexical/src/nodes/GalleryNode.jsx
🧰 Additional context used
🧠 Learnings (1)
packages/koenig-lexical/src/nodes/CallToActionNode.jsx (1)
Learnt from: ronaldlangeveld
PR: TryGhost/Koenig#1437
File: packages/koenig-lexical/src/nodes/CallToActionNodeComponent.jsx:0-0
Timestamp: 2025-02-06T04:48:22.660Z
Learning: In the CallToActionNodeComponent of Koenig, only the main content editor (htmlEditor) should be set as editable in the useEffect hook. The sponsor label editor's (sponsorLabelHtmlEditor) editability is handled separately as it's an optional feature.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Node 20.11.1
🔇 Additional comments (11)
packages/koenig-lexical/src/nodes/PaywallNode.jsx (1)

17-17: LGTM: Priority adjustment reflects usage patterns.

The decrease in priority from 9 to 6 aligns with the goal of organizing cards based on frequency of use.

packages/koenig-lexical/src/nodes/HorizontalRuleNode.jsx (1)

17-17: LGTM: Divider prioritized appropriately.

Moving the divider to priority 2 makes sense as it's a commonly used basic element for content organization.

packages/koenig-lexical/src/nodes/ButtonNode.jsx (1)

17-17: LGTM: Button accessibility improved.

The priority increase from 10 to 3 improves accessibility for this commonly used interactive element.

packages/koenig-lexical/src/nodes/MarkdownNode.jsx (1)

18-18: LGTM: Markdown editor properly deprioritized.

Moving markdown editing to priority 19 better reflects its specialized nature and less frequent usage compared to basic content elements.

packages/koenig-lexical/src/nodes/CalloutNode.jsx (1)

24-24: LGTM! Priority adjustment aligns with usage patterns.

The moderate decrease in priority (11 → 9) seems appropriate for a feature that's commonly used for highlighting information but not as frequently as basic content types.

packages/koenig-lexical/src/nodes/BookmarkNode.jsx (1)

25-25: LGTM! Priority adjustment reflects common usage.

The decrease in priority (6 → 4) appropriately positions the bookmark card higher in the menu, reflecting its frequent use for embedding links.

packages/koenig-lexical/src/nodes/EmailCtaNode.jsx (1)

25-25: LGTM! Priority change aligns with usage patterns.

The priority adjustment from 8 to 7 aligns with the PR objective of updating card order based on frequency of use.

packages/koenig-lexical/src/nodes/CallToActionNode.jsx (1)

24-25: LGTM! Enhanced discoverability with expanded matches.

The changes improve the component in two ways:

  1. Priority adjustment aligns with EmailCtaNode, reflecting similar importance.
  2. Additional keywords in matches array make the CTA card more discoverable.
packages/koenig-lexical/src/nodes/SignupNode.jsx (1)

29-29: LGTM! Priority value appropriate for conversion component.

The priority of 10 is well-chosen as it places the signup card after basic content components but before utility components, reflecting its importance in conversion while acknowledging it's not used as frequently as core content cards.

packages/koenig-lexical/src/nodes/HeaderNode.jsx (2)

31-31: LGTM! Priority adjustment for Header1 (v1) menu entry.

The priority change from 17 to 11 aligns with the PR objective of reordering cards based on usage frequency.


46-46: LGTM! Priority adjustment for Header (v2) menu entry.

The priority change from 17 to 11 aligns with the PR objective of reordering cards based on usage frequency. Having the same priority as Header1 ensures both header options appear together in the menu.

@@ -15,7 +15,7 @@ export class HtmlNode extends BaseHtmlNode {
Icon: HtmlCardIcon,
insertCommand: INSERT_HTML_COMMAND,
matches: ['html'],
priority: 3,
priority: 18,
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Consider lowering the priority value for HTML card.

The significant increase in priority (3 → 18) seems to contradict the PR's objective of ordering cards by frequency of use. HTML editing is typically a more specialized feature used less frequently than basic content types.

Let's analyze the usage patterns to validate this assumption:


🏁 Script executed:

#!/bin/bash
# Search for HTML card usage patterns in the codebase
echo "Searching for HTML card usage..."
rg -l "HtmlNode|INSERT_HTML_COMMAND" --type js --type jsx

# Search for other card usages for comparison
echo -e "\nSearching for basic card usages..."
rg -l "ButtonNode|ImageNode|HeaderNode" --type js --type jsx

Length of output: 338


I'll generate a revised script that explicitly targets .js and .jsx files using file globs rather than relying on file type detection. This should help us gather the actual usage data for HTML card features as compared to basic card usages.

Please run this revised script so we can verify how frequently the HTML card is used relative to other cards.


🏁 Script executed:

#!/bin/bash
# Searching for HTML card usage patterns with file glob for .js and .jsx files
echo "Searching for HTML card usage..."
rg -l "HtmlNode|INSERT_HTML_COMMAND" -g "*.js" -g "*.jsx"

# Searching for basic card usages with file glob for .js and .jsx files
echo -e "\nSearching for basic card usages..."
rg -l "ButtonNode|ImageNode|HeaderNode" -g "*.js" -g "*.jsx"

Length of output: 2694


HTML Card Priority Mismatch: Lower Priority Value Recommended

  • The usage search shows that HTML card–related code (e.g. HtmlNode) appears in far fewer files than basic card types (e.g. ButtonNode, ImageNode, HeaderNode), supporting the notion that HTML is less frequently used.
  • Given the PR’s objective to order cards by frequency of use, raising the priority from 3 to 18 for the HTML card is counterintuitive.
  • It would be more appropriate to use a lower priority value for the HTML card so that frequently-used cards (like button, image, or header cards) take precedence.

@@ -22,7 +22,7 @@ export class EmailNode extends BaseEmailNode {
Icon: EmailCardIcon,
insertCommand: INSERT_EMAIL_COMMAND,
matches: ['email content', 'only email'],
priority: 7,
priority: 8,
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Consider maintaining or lowering the priority for email content.

The increase in priority (7 → 8) for email-specific content seems inconsistent with the goal of ordering by frequency of use, as this is a specialized feature typically used less often than general content types.

Let's analyze the usage patterns:


🏁 Script executed:

#!/bin/bash
# Search for email content usage patterns
echo "Searching for email content usage..."
rg -l "EmailNode|INSERT_EMAIL_COMMAND" --type js --type jsx

# Search for general content types for comparison
echo -e "\nSearching for general content type usage..."
rg -l "ButtonNode|ImageNode|HeaderNode" --type js --type jsx

Length of output: 366


I'll now run an updated shell script that restricts the search to *.jsx files using the -g "*.jsx" flag:


🏁 Script executed:

#!/bin/bash
echo "Searching for email content usage..."
rg -l "EmailNode|INSERT_EMAIL_COMMAND" -g "*.jsx"

echo -e "\nSearching for general content type usage..."
rg -l "ButtonNode|ImageNode|HeaderNode" -g "*.jsx"

Length of output: 1188


Action Required: Reevaluate the EmailNode Priority Increment

The evidence shows that email-specific components (referenced in 3 files) are considerably less frequent than general content types (referenced in 13 files). Given that email content is a specialized feature, increasing its priority from 7 to 8 may inadvertently elevate its ordering over more commonly used content. Please consider maintaining the original priority or lowering it to better reflect its lower usage frequency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant