Skip to content

Remove Parse.ly Dashboard page from UI#3327

Merged
acicovic merged 1 commit intoadd/traffic-boostfrom
remove/parsely-dashboard-page
May 15, 2025
Merged

Remove Parse.ly Dashboard page from UI#3327
acicovic merged 1 commit intoadd/traffic-boostfrom
remove/parsely-dashboard-page

Conversation

@acicovic
Copy link
Collaborator

@acicovic acicovic commented May 14, 2025

Description

With this PR, we're removing the Parse.ly Dashboard page from the UI. We'll bring it back when we have something to offer there. As this is considered a temporary removal, this isn't a full refactoring removing all related code.

Motivation and context

The Parse.ly Dashboard page didn't have anything to offer.

How has this been tested?

Manually tested the UI.

Summary by CodeRabbit

  • New Features

    • The Traffic Boost submenu is now labeled "Traffic Boost (beta)" and is highlighted by default.
    • Accessing the main dashboard page now automatically redirects to the Traffic Boost (beta) page.
  • Style

    • Updated the Traffic Boost page header to display "Manage Traffic Boost (beta)".
  • Bug Fixes

    • Improved submenu highlighting by making it static and consistent, removing dynamic route-based updates.

@acicovic acicovic added this to the 3.19.0 milestone May 14, 2025
@acicovic acicovic self-assigned this May 14, 2025
@acicovic acicovic added Maintenance & Fixes Ticket/PR related to codebase maintenance tasks Feature: Dashboard Page Ticket/PR related to the Dashboad Page labels May 14, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 14, 2025

📝 Walkthrough

Walkthrough

This change statically highlights the "Traffic Boost (beta)" submenu in the Parse.ly dashboard, removes dynamic submenu link and highlighting logic based on routing, updates the submenu label and slug, and redirects the default dashboard route to "/traffic-boost". The "Traffic Boost" page header is also updated to include "(beta)".

Changes

File(s) Change Summary
src/UI/class-dashboard-page.php Removed the "Dashboard" submenu registration. Updated the "Traffic Boost" submenu: changed its label to "Traffic Boost (beta)" and its slug to 'parsely-dashboard-page'. The main menu registration remains unchanged.
src/content-helper/dashboard-page/dashboard-page.tsx Removed all dynamic submenu link and highlighting logic based on route. Added static DOM manipulation to highlight the "Traffic Boost" submenu. Changed the default "/" route to redirect to "/traffic-boost" using <Navigate>. Removed import and usage of DashboardPage; added import of Navigate.
src/content-helper/dashboard-page/pages/traffic-boost/page-component.tsx Changed the page header title from "Manage Traffic Boost" to "Manage Traffic Boost (beta)". No other changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WP_Admin_Menu
    participant React_App

    User->>WP_Admin_Menu: Opens Parse.ly Dashboard menu
    WP_Admin_Menu->>User: Shows only "Traffic Boost (beta)" submenu (highlighted)
    User->>React_App: Navigates to Dashboard root (/)
    React_App-->>User: Redirects to /traffic-boost
    User->>React_App: Views "Manage Traffic Boost (beta)" page
Loading

Possibly related PRs

Suggested labels

Feature: Traffic Boost

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this 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.

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.

@acicovic acicovic marked this pull request as ready for review May 14, 2025 12:56
@acicovic acicovic requested a review from a team as a code owner May 14, 2025 12:56
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

🔭 Outside diff range comments (1)
src/UI/class-dashboard-page.php (1)

149-166: ⚠️ Potential issue

Duplicate submenu slug may create two identical items.

add_menu_page() automatically generates the first submenu entry whose slug is identical to the top-level slug (parsely-dashboard-page).
Calling add_submenu_page() with that same slug will therefore yield two visually identical “Traffic Boost (beta)” rows (one inserted automatically, one inserted manually).

Either:

  1. Remove the explicit add_submenu_page() call and change the label of the auto-added submenu item via $GLOBALS['submenu'], or
  2. Keep the explicit call but immediately remove_submenu_page( 'parsely-dashboard-page', 'parsely-dashboard-page' ) to suppress the auto-added row.

Example fix (option 1):

-	add_submenu_page(
-		'parsely-dashboard-page',
-		'Parse.ly Traffic Boost',
-		'Traffic Boost (beta)',
-		Parsely::CAPABILITY, // phpcs:ignore WordPress.WP.Capabilities.Undetermined
-		'parsely-dashboard-page',
-		'__return_null'
-	);
+	// Rename the auto-added submenu item created by add_menu_page().
+	global $submenu;
+	if ( isset( $submenu['parsely-dashboard-page'][0] ) ) {
+		$submenu['parsely-dashboard-page'][0][0] = __( 'Traffic Boost (beta)', 'wp-parsely' );
+	}

Duplication negatively affects UX and may break automated UI tests.

🧹 Nitpick comments (4)
src/content-helper/dashboard-page/pages/traffic-boost/page-component.tsx (1)

31-33: Provide translator context for the new “(beta)” suffix.

String changes that add clarifying suffixes can be confusing for translators.
Please prepend a translator comment explaining that “(beta)” should be kept verbatim so it is clear that the feature is in beta.

-				<h1>{ __( 'Manage Traffic Boost (beta)', 'wp-parsely' ) }</h1>
+				{/* translators: Title of the Traffic-Boost page. “(beta)” must stay in English. */}
+				<h1>{ __( 'Manage Traffic Boost (beta)', 'wp-parsely' ) }</h1>

This keeps us aligned with WordPress-i18n best practices and the coding-guideline requirement that comments terminate with a period.

src/UI/class-dashboard-page.php (1)

160-163: Add translator comment for the new menu label.

Same rationale as for the React component: translators need guidance on the “(beta)” token.

/* translators: Admin-menu label – keep “(beta)” in English. */
'Traffic Boost (beta)',
src/content-helper/dashboard-page/dashboard-page.tsx (2)

24-28: Hard-coded submenu selector is brittle and lacks documentation.

  1. The query selector assumes the Traffic-Boost item is always the first submenu entry. If future menu items are re-ordered this highlight will break.
  2. A brief comment with @since would satisfy the coding-guideline requirement and explain the intent.

Suggestion:

-	// Highlight the Traffic Boost menu item under the Parse.ly menu.
-	document.querySelector(
-		'#toplevel_page_parsely-dashboard-page .wp-submenu li.wp-first-item'
-	)?.classList.add( 'current' );
+	// Highlight Traffic-Boost submenu while dashboard is temporarily single-page.
+	// @since 3.20.0.
+	const trafficBoostItem = document.querySelector(
+		'#toplevel_page_parsely-dashboard-page .wp-submenu li.wp-first-item'
+	);
+	trafficBoostItem?.classList.add( 'current' );

For extra resilience, consider selecting by link href or text content rather than positional class.


50-53: Redirect route looks good but add a test for it.

The new <Navigate> ensures users hitting “/” land on Traffic-Boost.
Please add a unit/integration test (e.g., React-Testing-Library) to guard against regressions when routes change again.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ced495 and c060438.

⛔ Files ignored due to path filters (2)
  • build/content-helper/dashboard-page.asset.php is excluded by !build/**
  • build/content-helper/dashboard-page.js is excluded by !build/**
📒 Files selected for processing (3)
  • src/UI/class-dashboard-page.php (1 hunks)
  • src/content-helper/dashboard-page/dashboard-page.tsx (2 hunks)
  • src/content-helper/dashboard-page/pages/traffic-boost/page-component.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.{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 ...

**/*.{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."
  • src/content-helper/dashboard-page/pages/traffic-boost/page-component.tsx
  • src/content-helper/dashboard-page/dashboard-page.tsx
`**/*.{html,php}`: "Perform a detailed review of the provided code with following key aspects in mind: - Review the HTML and PHP code to ensure it is well-structured and adheres ...

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

  • Review the HTML and PHP code to ensure it is well-structured and adheres to best practices.
  • Ensure the code follows WordPress coding standards and is well-documented.
  • Confirm the code is secure and free from vulnerabilities.
  • Optimize the code for performance, removing any unnecessary elements.
  • Validate comments for accuracy, currency, and adherence to WordPress coding standards.
  • Ensure each line comment concludes with a period.
  • Verify code compatibility with the latest version of WordPress, avoiding deprecated functions or features."
  • src/UI/class-dashboard-page.php
🧬 Code Graph Analysis (1)
src/UI/class-dashboard-page.php (1)
src/class-parsely.php (1)
  • Parsely (75-1173)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: E2E against WordPress latest

Copy link
Contributor

@alecgeatches alecgeatches left a comment

Choose a reason for hiding this comment

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

I've tested these changes along with #3328, see the approval there. Good to go from me!

@acicovic acicovic merged commit fee213b into add/traffic-boost May 15, 2025
39 checks passed
@acicovic acicovic deleted the remove/parsely-dashboard-page branch May 15, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature: Dashboard Page Ticket/PR related to the Dashboad Page Maintenance & Fixes Ticket/PR related to codebase maintenance tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants