Skip to content

Conversation

@acicovic
Copy link
Collaborator

@acicovic acicovic commented Oct 10, 2025

Description

With this PR, we're adding a "Boost Engagement" button (bottom right in the screenshot) that opens Engagement Boost for the post being edited. Engagement Boost opens in a new tab in order to avoid potential data loss accidents.

The button appears only when all of these occur simultaneously:

  1. We're able to get a valid post ID for the post.
  2. The user has rights to use Engagement Boost.
  3. The post is published or of a status that has been defined as trackable through the wp_parsely_trackable_statuses filter.

Motivation and context

Closes #3401.

How has this been tested?

Tested manually, existing tests pass.

Screenshots

image

Summary by CodeRabbit

  • New Features

    • Added a “Boost Engagement” button in the Editor’s Sidebar Tools tab for eligible posts. Opens the Parsely dashboard engagement-boost page for the current post in a new tab. Visible when the post is trackable (e.g., published) and the feature is available to the user.
  • Style

    • Updated sidebar styles to align and space the new “Boost Engagement” button consistently with existing UI.

@acicovic acicovic added this to the 3.22.0 milestone Oct 10, 2025
@acicovic acicovic self-assigned this Oct 10, 2025
@acicovic acicovic added the Changelog: Added PR to be added under the changelog's "Added" section label Oct 10, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • build/content-helper/editor-sidebar.asset.php is excluded by !build/**
  • build/content-helper/editor-sidebar.js is excluded by !build/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Adds a conditionally rendered "Boost Engagement" button to the Parse.ly editor sidebar tools tab (based on postId, post status, and TrafficBoost permission) and a scoped CSS rule for .components-button.boost-engagement to control layout; the button opens the Parse.ly engagement-boost dashboard in a new tab.

Changes

Cohort / File(s) Summary
Sidebar tools tab UI logic
src/content-helper/editor-sidebar/tabs/sidebar-tools-tab.tsx
Imports Button, Icon, and select; reads postId and postStatus from the editor store; derives isPostTrackable from window.wpParselyTrackableStatuses (default ['publish']); conditionally renders a "Boost Engagement" Button (with external icon) when postId > 0, post is trackable, and permissions.TrafficBoost; clicking opens the engagement-boost dashboard URL in a new tab.
Sidebar styling
src/content-helper/editor-sidebar/editor-sidebar.scss
Adds scoped styles for .components-button.boost-engagement (display:flex, centered content, margin via var(--grid-unit-15)) under .wp-parsely-content-helper .wp-parsely-sidebar-tabs .components-tab-panel__tabs.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Editor as WP Block Editor
    participant Sidebar as SidebarToolsTab
    participant Store as WP Data Store (editor)
    participant Button as Boost Engagement Button
    participant Browser as Browser Tab
    participant Dashboard as Parse.ly Dashboard

    User->>Editor: Open post editor
    Editor->>Sidebar: Mount sidebar tools tab
    Sidebar->>Store: getCurrentPostId(), getEditedPostAttribute('status')
    Sidebar->>Sidebar: compute isPostTrackable (status ∈ trackableStatuses)
    alt postId>0 ∧ isPostTrackable ∧ permissions.TrafficBoost
        Sidebar->>User: Render "Boost Engagement" button
        User->>Button: Click
        Button->>Browser: window.open(engagement-boost URL, _blank)
        Browser->>Dashboard: Navigate to engagement boost page
    else
        Sidebar->>User: Button hidden
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Feature: PCH, Feature: Traffic Boost

Suggested reviewers

  • alecgeatches

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly identifies the main change by specifying the PCI sidebar component and the addition of the Engagement Boost button, making it clear and directly related to the changeset.
Linked Issues Check ✅ Passed The changes implement the requested Engagement Boost link by conditionally rendering a “Boost Engagement” button in the sidebar only when the post is published or otherwise trackable, the user has permission, and a valid post ID exists, and opening the dashboard in a new tab, thus satisfying issue #3401’s requirements.
Out of Scope Changes Check ✅ Passed All modifications are confined to adding the new Engagement Boost button’s styling and conditional rendering logic, without unrelated code changes or modifications outside the scope of issue #3401.
Description Check ✅ Passed The pull request description follows the repository template by including the required sections: Description, Motivation and context with issue linkage, Testing procedures, and Screenshots, and each section is adequately filled with relevant details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@acicovic acicovic marked this pull request as ready for review October 10, 2025 16:13
@acicovic acicovic requested a review from a team as a code owner October 10, 2025 16:13
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 (1)
src/content-helper/editor-sidebar/tabs/sidebar-tools-tab.tsx (1)

138-149: Consider adding aria-hidden to the icon for improved accessibility.

The button implementation correctly uses rel="noopener" for security and properly internationalizes the text. The conditional rendering logic appropriately checks post ID, trackability, and permissions before displaying the button.

Consider adding aria-hidden="true" to the icon to prevent screen readers from announcing it separately:

-					<Icon icon={ external } size={ 18 } className="parsely-external-link-icon" />
+					<Icon icon={ external } size={ 18 } className="parsely-external-link-icon" aria-hidden="true" />
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67ec325 and cfc3aff.

⛔ Files ignored due to path filters (4)
  • build/content-helper/editor-sidebar-rtl.css is excluded by !build/**
  • build/content-helper/editor-sidebar.asset.php is excluded by !build/**
  • build/content-helper/editor-sidebar.css is excluded by !build/**
  • build/content-helper/editor-sidebar.js is excluded by !build/**
📒 Files selected for processing (2)
  • src/content-helper/editor-sidebar/editor-sidebar.scss (1 hunks)
  • src/content-helper/editor-sidebar/tabs/sidebar-tools-tab.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,ts,tsx,jsx}

⚙️ CodeRabbit configuration file

**/*.{js,ts,tsx,jsx}: "Perform a detailed review of the provided code with following key aspects in mind:

  • Review the code to ensure it is well-structured and adheres to best practices.
  • Verify compliance with WordPress coding standards.
  • Ensure the code is well-documented.
  • Check for security vulnerabilities and confirm the code is secure.
  • Optimize the code for performance, removing any unnecessary elements.
  • Validate JSDoc comments for accuracy, currency, and adherence to WordPress coding standards.
  • Ensure each line comment concludes with a period.
  • Confirm every JSDoc comment includes a @SInCE tag indicating the next version of the plugin to include the code.
  • Guarantee compatibility with the latest version of WordPress, avoiding deprecated functions or features."

Files:

  • src/content-helper/editor-sidebar/tabs/sidebar-tools-tab.tsx
**/*.{css,scss}

⚙️ CodeRabbit configuration file

**/*.{css,scss}: "Perform a detailed review of the provided code with following key aspects in mind:

  • Review the SCSS code to ensure it is well-structured and adheres to best practices.
  • Convert dimensions greater than or equal to 3px to rem units using the to_rem function.
  • Utilize variables for sizes and colors defined in src/content-helper/common/css/variables.scss instead of hardcoding values."

Files:

  • src/content-helper/editor-sidebar/editor-sidebar.scss
🧠 Learnings (1)
📚 Learning: 2024-10-09T07:53:49.520Z
Learnt from: acicovic
PR: Parsely/wp-parsely#2811
File: src/content-helper/editor-sidebar/tabs/sidebar-tools-tab.tsx:5-5
Timestamp: 2024-10-09T07:53:49.520Z
Learning: `PostTypeSupportCheck` should be imported from `wordpress/editor`, following the official WordPress documentation.

Applied to files:

  • src/content-helper/editor-sidebar/tabs/sidebar-tools-tab.tsx
🔇 Additional comments (2)
src/content-helper/editor-sidebar/editor-sidebar.scss (1)

108-112: LGTM!

The styling correctly uses CSS variables for spacing and follows the existing patterns in the file. The flex layout with centered content is appropriate for the button placement.

src/content-helper/editor-sidebar/tabs/sidebar-tools-tab.tsx (1)

4-4: LGTM!

The new imports are correctly sourced from WordPress packages and align with the component's requirements.

Also applies to: 11-12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: Added PR to be added under the changelog's "Added" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PCI Engagement Boost: Add a link to the Parse.ly sidebar menu

2 participants