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

Enhance/plugin header section redesign #2461

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

osmansufy
Copy link
Contributor

@osmansufy osmansufy commented Dec 2, 2024

All Submissions:

  • My code follow the WordPress' coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s) (optional)
  • I've included developer documentation (optional)
  • I've added proper labels to this pull request

Changes proposed in this Pull Request:

Related Pull Request(s)

  • Full PR Link

Closes

  • Closes #

How to test the changes in this Pull Request:

  • Steps or issue link

Changelog entry

Title

Detailed Description of the pull request. What was previous behaviour
and what will be changed in this PR.

Before Changes

Describe the issue before changes with screenshots(s).

After Changes

Describe the issue after changes with screenshot(s).

Feature Video (optional)

Link of detailed video if this PR is for a feature.

PR Self Review Checklist:

  • Code is not following code style guidelines
  • Bad naming: make sure you would understand your code if you read it a few months from now.
  • KISS: Keep it simple, Sweetie (not stupid!).
  • DRY: Don't Repeat Yourself.
  • Code that is not readable: too many nested 'if's are a bad sign.
  • Performance issues
  • Complicated constructions that need refactoring or comments: code should almost always be self-explanatory.
  • Grammar errors.

FOR PR REVIEWER ONLY:

As a reviewer, your feedback should be focused on the idea, not the person. Seek to understand, be respectful, and focus on constructive dialog.

As a contributor, your responsibility is to learn from suggestions and iterate your pull request should it be needed based on feedback. Seek to collaborate and produce the best possible contribution to the greater whole.

  • Correct — Does the change do what it’s supposed to? ie: code 100% fulfilling the requirements?
  • Secure — Would a nefarious party find some way to exploit this change? ie: everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities?
  • Readable — Will your future self be able to understand this change months down the road?
  • Elegant — Does the change fit aesthetically within the overall style and architecture?

Summary by CodeRabbit

  • New Features

    • Enhanced admin header layout with improved organization for logo and version display.
    • Introduced an upgrade button for users without the Pro version.
    • Added a new SVG icon for the Dokan Pro Award.
  • Style

    • Updated styling for the admin header, including padding, margins, and responsive adjustments.
    • New styles for version tags and the upgrade button to enhance visual presentation.

@osmansufy osmansufy self-assigned this Dec 2, 2024
Copy link
Contributor

coderabbitai bot commented Dec 2, 2024

Walkthrough

The changes include modifications to the styling of the admin header in admin.less, restructuring of the HTML layout in templates/admin-header.php, and the introduction of a new SVG icon in templates/svg-icons/pro-award.php. The CSS updates enhance the visual presentation and responsiveness of the admin header, while the HTML changes improve the organization of the logo and version display, including conditional rendering for the Pro version and an upgrade button. The new SVG file provides an icon for the Dokan Pro Award.

Changes

File Change Summary
assets/src/less/admin.less Adjusted styles for .dokan-admin-header, added new nested classes, and introduced responsive styles.
templates/admin-header.php Restructured HTML layout for the admin header, added conditional rendering for Pro version, and improved organization.
templates/svg-icons/pro-award.php Created a new SVG icon for the Dokan Pro Award with defined dimensions and rendering properties.

Possibly related PRs

Suggested labels

QA approved, :+1: Dev Review Done, Upcoming Release

Suggested reviewers

  • shohag121
  • mrabbani

🐇 In the admin header, a change so bright,
With logos and tags, it’s a wonderful sight!
Pro version now shows, with a button to upgrade,
A new SVG icon, for the awards we’ve made!
Hopping through code, with style and flair,
Our admin’s now ready, with love and with care! 🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1999c48 and 649abf0.

📒 Files selected for processing (1)
  • templates/svg-icons/pro-award.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • templates/svg-icons/pro-award.php

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.

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: 4

🧹 Outside diff range and nitpick comments (2)
templates/admin-header.php (1)

45-56: Escape output for safety

While the href attribute is correctly escaped using esc_url, it's good practice to also escape the Upgrade text inside the anchor tag, even if it's plain text, to prevent any potential issues.

Apply this minor suggestion:

<a target="_blank" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
-    Upgrade
+    <?php echo esc_html( 'Upgrade' ); ?>
    <?php
    dokan_get_template_part(
        'svg-icons/pro-award', null,
        [
            'width' => 20,
            'height' => 20,
        ]
    );
    ?>
</a>
assets/src/less/admin.less (1)

7-10: Consistent use of units in CSS properties

In the declaration box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.06);, the first value 0px can be simplified to 0 since zero values do not require units.

Apply this minor improvement:

-box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.06);
+box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f6b2f86 and 84ab3ba.

📒 Files selected for processing (3)
  • assets/src/less/admin.less (6 hunks)
  • templates/admin-header.php (2 hunks)
  • templates/svg-icons/pro-award.php (1 hunks)
🔇 Additional comments (1)
assets/src/less/admin.less (1)

271-293: Check for mobile responsiveness

The responsive styles added within the media query ensure the admin header adapts to smaller screens. Please verify that these changes render correctly on various mobile devices and screen sizes.

Please test the responsive layout on devices with widths up to 782px to ensure the header elements display as intended.

<div class="dokan-admin-logo-wrap">
<!-- Logo Section -->
<div class="dokan-admin-header-logo">
<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSEST . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Typo in constant name 'DOKAN_PLUGIN_ASSEST'

It appears that the constant DOKAN_PLUGIN_ASSEST may be misspelled. It should likely be DOKAN_PLUGIN_ASSETS to correctly reference the assets directory.

Please apply the following fix:

-<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSEST . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>
+<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSETS . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSEST . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>
<img src="<?php echo esc_url( DOKAN_PLUGIN_ASSETS . '/images/dokan-logo.png' ); ?>" alt="Dokan Logo"/>


<?php
// Show Pro version if installed
if ( dokan()->is_pro_exists() && dokan_pro()->license->is_valid() ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential method call on null object

In the condition if ( dokan()->is_pro_exists() && dokan_pro()->license->is_valid() ), there is a possibility that dokan_pro() may return null if the Pro plugin is not installed. This could lead to a fatal error when attempting to access the license property.

Consider updating the condition to ensure that dokan_pro() returns a valid object before accessing its properties:

-if ( dokan()->is_pro_exists() && dokan_pro()->license->is_valid() ) {
+if ( dokan()->is_pro_exists() && dokan_pro() && dokan_pro()->license->is_valid() ) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if ( dokan()->is_pro_exists() && dokan_pro()->license->is_valid() ) {
if ( dokan()->is_pro_exists() && dokan_pro() && dokan_pro()->license->is_valid() ) {

Comment on lines +8 to +9
$width = $args['width'] ?? 20;
$height = $args['height'] ?? 20;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Initialize $args to prevent undefined variable notice

To prevent a potential undefined variable notice when $args is not provided, it's recommended to initialize $args before using it.

Apply this fix:

<?php
+$args = isset( $args ) ? $args : [];
$width = $args['width'] ?? 20;
$height = $args['height'] ?? 20;
?>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$width = $args['width'] ?? 20;
$height = $args['height'] ?? 20;
<?php
$args = isset( $args ) ? $args : [];
$width = $args['width'] ?? 20;
$height = $args['height'] ?? 20;
?>

Comment on lines 11 to 13
<svg width="<?php echo $width; ?>" height="<?php echo $height; ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.17566 3.52563C7.30278 3.45067 7.44772 3.41113 7.59529 3.41113C7.74291 3.41113 7.8878 3.45067 8.01497 3.52563C8.14197 3.60052 8.24662 3.70803 8.31809 3.837M8.3183 3.8374L9.83426 6.57021C9.83488 6.57112 9.83578 6.57182 9.83686 6.57215C9.83802 6.57253 9.8393 6.57248 9.84041 6.57203C9.84037 6.57207 9.84045 6.57203 9.84041 6.57203L12.4523 5.41061L12.4537 5.41C12.5947 5.34793 12.7502 5.3265 12.9027 5.34814C13.0552 5.36976 13.1986 5.43359 13.3168 5.53241C13.435 5.63123 13.5231 5.76111 13.5714 5.9074C13.6195 6.05328 13.626 6.20966 13.5902 6.35905C13.59 6.35942 13.59 6.35984 13.5899 6.36025L12.2728 11.9539C12.2465 12.0618 12.1989 12.1634 12.1327 12.2527C12.0665 12.3419 11.9831 12.417 11.8874 12.4734C11.7917 12.5299 11.6857 12.5666 11.5756 12.5814C11.4654 12.5962 11.3535 12.5887 11.2463 12.5595L11.2447 12.5591C8.85502 11.8974 6.33044 11.8974 3.94075 12.5591L3.93913 12.5595C3.83194 12.5887 3.71997 12.5962 3.60986 12.5814C3.49974 12.5666 3.3937 12.5299 3.29802 12.4734C3.20233 12.417 3.11892 12.3419 3.05273 12.2527C2.98654 12.1634 2.9389 12.0618 2.91264 11.9539L2.91183 11.9505L1.60073 6.36025C1.60061 6.35971 1.60048 6.35918 1.60036 6.35868C1.56461 6.20941 1.57115 6.05316 1.61923 5.9074C1.66748 5.76111 1.75567 5.63123 1.87382 5.53241C1.99197 5.43359 2.13539 5.36976 2.2879 5.34814C2.4404 5.32651 2.59591 5.34793 2.73688 5.41L2.73827 5.41061L5.35005 6.57199C5.35001 6.57195 5.35009 6.57199 5.35005 6.57199C5.35116 6.57244 5.35257 6.57253 5.35377 6.57215C5.3548 6.57182 5.35571 6.57112 5.35633 6.57021L6.87253 3.837C6.94397 3.70803 7.04862 3.60052 7.17566 3.52563M6.07438 6.97923C5.97249 7.15783 5.80802 7.29235 5.61277 7.3568C5.41747 7.42125 5.20528 7.41109 5.01707 7.32821L5.0157 7.32759L2.40393 6.16624L2.40457 6.16888L3.71559 11.7589C3.71577 11.7594 3.71603 11.7599 3.71638 11.7604C3.71664 11.7607 3.71696 11.7611 3.71732 11.7614C3.7175 11.7615 3.71769 11.7616 3.7179 11.7618C3.7185 11.7621 3.71916 11.7623 3.71983 11.7624C3.72047 11.7625 3.72111 11.7625 3.72173 11.7623C6.25525 11.0611 8.9317 11.0612 11.4652 11.7628L11.3549 12.1609L11.4635 11.7623C11.4642 11.7625 11.4649 11.7625 11.4656 11.7624C11.4663 11.7623 11.4669 11.7621 11.4675 11.7618C11.4681 11.7614 11.4687 11.7609 11.4691 11.7604C11.4693 11.7601 11.4695 11.7597 11.4697 11.7594C11.4697 11.7592 11.4698 11.759 11.4699 11.7588C11.4698 11.7589 11.4699 11.7587 11.4699 11.7588L12.7861 6.16855L12.7867 6.16624L10.1749 7.32759L10.1735 7.32821C9.98534 7.41109 9.77311 7.42125 9.57786 7.3568C9.38256 7.29235 9.21813 7.15783 9.11625 6.97918L9.11381 6.97493L7.59529 4.23743L6.07438 6.97923Z" fill="white"/>
</svg>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Ensure proper escaping of attributes

When outputting variables within HTML attributes, it's important to escape them to prevent security vulnerabilities. In the <svg> tag, the $width and $height attributes should be escaped.

Apply this fix:

-<svg width="<?php echo $width; ?>" height="<?php echo $height; ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<svg width="<?php echo esc_attr( $width ); ?>" height="<?php echo esc_attr( $height ); ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<svg width="<?php echo $width; ?>" height="<?php echo $height; ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.17566 3.52563C7.30278 3.45067 7.44772 3.41113 7.59529 3.41113C7.74291 3.41113 7.8878 3.45067 8.01497 3.52563C8.14197 3.60052 8.24662 3.70803 8.31809 3.837M8.3183 3.8374L9.83426 6.57021C9.83488 6.57112 9.83578 6.57182 9.83686 6.57215C9.83802 6.57253 9.8393 6.57248 9.84041 6.57203C9.84037 6.57207 9.84045 6.57203 9.84041 6.57203L12.4523 5.41061L12.4537 5.41C12.5947 5.34793 12.7502 5.3265 12.9027 5.34814C13.0552 5.36976 13.1986 5.43359 13.3168 5.53241C13.435 5.63123 13.5231 5.76111 13.5714 5.9074C13.6195 6.05328 13.626 6.20966 13.5902 6.35905C13.59 6.35942 13.59 6.35984 13.5899 6.36025L12.2728 11.9539C12.2465 12.0618 12.1989 12.1634 12.1327 12.2527C12.0665 12.3419 11.9831 12.417 11.8874 12.4734C11.7917 12.5299 11.6857 12.5666 11.5756 12.5814C11.4654 12.5962 11.3535 12.5887 11.2463 12.5595L11.2447 12.5591C8.85502 11.8974 6.33044 11.8974 3.94075 12.5591L3.93913 12.5595C3.83194 12.5887 3.71997 12.5962 3.60986 12.5814C3.49974 12.5666 3.3937 12.5299 3.29802 12.4734C3.20233 12.417 3.11892 12.3419 3.05273 12.2527C2.98654 12.1634 2.9389 12.0618 2.91264 11.9539L2.91183 11.9505L1.60073 6.36025C1.60061 6.35971 1.60048 6.35918 1.60036 6.35868C1.56461 6.20941 1.57115 6.05316 1.61923 5.9074C1.66748 5.76111 1.75567 5.63123 1.87382 5.53241C1.99197 5.43359 2.13539 5.36976 2.2879 5.34814C2.4404 5.32651 2.59591 5.34793 2.73688 5.41L2.73827 5.41061L5.35005 6.57199C5.35001 6.57195 5.35009 6.57199 5.35005 6.57199C5.35116 6.57244 5.35257 6.57253 5.35377 6.57215C5.3548 6.57182 5.35571 6.57112 5.35633 6.57021L6.87253 3.837C6.94397 3.70803 7.04862 3.60052 7.17566 3.52563M6.07438 6.97923C5.97249 7.15783 5.80802 7.29235 5.61277 7.3568C5.41747 7.42125 5.20528 7.41109 5.01707 7.32821L5.0157 7.32759L2.40393 6.16624L2.40457 6.16888L3.71559 11.7589C3.71577 11.7594 3.71603 11.7599 3.71638 11.7604C3.71664 11.7607 3.71696 11.7611 3.71732 11.7614C3.7175 11.7615 3.71769 11.7616 3.7179 11.7618C3.7185 11.7621 3.71916 11.7623 3.71983 11.7624C3.72047 11.7625 3.72111 11.7625 3.72173 11.7623C6.25525 11.0611 8.9317 11.0612 11.4652 11.7628L11.3549 12.1609L11.4635 11.7623C11.4642 11.7625 11.4649 11.7625 11.4656 11.7624C11.4663 11.7623 11.4669 11.7621 11.4675 11.7618C11.4681 11.7614 11.4687 11.7609 11.4691 11.7604C11.4693 11.7601 11.4695 11.7597 11.4697 11.7594C11.4697 11.7592 11.4698 11.759 11.4699 11.7588C11.4698 11.7589 11.4699 11.7587 11.4699 11.7588L12.7861 6.16855L12.7867 6.16624L10.1749 7.32759L10.1735 7.32821C9.98534 7.41109 9.77311 7.42125 9.57786 7.3568C9.38256 7.29235 9.21813 7.15783 9.11625 6.97918L9.11381 6.97493L7.59529 4.23743L6.07438 6.97923Z" fill="white"/>
</svg>
<svg width="<?php echo esc_attr( $width ); ?>" height="<?php echo esc_attr( $height ); ?>" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.17566 3.52563C7.30278 3.45067 7.44772 3.41113 7.59529 3.41113C7.74291 3.41113 7.8878 3.45067 8.01497 3.52563C8.14197 3.60052 8.24662 3.70803 8.31809 3.837M8.3183 3.8374L9.83426 6.57021C9.83488 6.57112 9.83578 6.57182 9.83686 6.57215C9.83802 6.57253 9.8393 6.57248 9.84041 6.57203C9.84037 6.57207 9.84045 6.57203 9.84041 6.57203L12.4523 5.41061L12.4537 5.41C12.5947 5.34793 12.7502 5.3265 12.9027 5.34814C13.0552 5.36976 13.1986 5.43359 13.3168 5.53241C13.435 5.63123 13.5231 5.76111 13.5714 5.9074C13.6195 6.05328 13.626 6.20966 13.5902 6.35905C13.59 6.35942 13.59 6.35984 13.5899 6.36025L12.2728 11.9539C12.2465 12.0618 12.1989 12.1634 12.1327 12.2527C12.0665 12.3419 11.9831 12.417 11.8874 12.4734C11.7917 12.5299 11.6857 12.5666 11.5756 12.5814C11.4654 12.5962 11.3535 12.5887 11.2463 12.5595L11.2447 12.5591C8.85502 11.8974 6.33044 11.8974 3.94075 12.5591L3.93913 12.5595C3.83194 12.5887 3.71997 12.5962 3.60986 12.5814C3.49974 12.5666 3.3937 12.5299 3.29802 12.4734C3.20233 12.417 3.11892 12.3419 3.05273 12.2527C2.98654 12.1634 2.9389 12.0618 2.91264 11.9539L2.91183 11.9505L1.60073 6.36025C1.60061 6.35971 1.60048 6.35918 1.60036 6.35868C1.56461 6.20941 1.57115 6.05316 1.61923 5.9074C1.66748 5.76111 1.75567 5.63123 1.87382 5.53241C1.99197 5.43359 2.13539 5.36976 2.2879 5.34814C2.4404 5.32651 2.59591 5.34793 2.73688 5.41L2.73827 5.41061L5.35005 6.57199C5.35001 6.57195 5.35009 6.57199 5.35005 6.57199C5.35116 6.57244 5.35257 6.57253 5.35377 6.57215C5.3548 6.57182 5.35571 6.57112 5.35633 6.57021L6.87253 3.837C6.94397 3.70803 7.04862 3.60052 7.17566 3.52563M6.07438 6.97923C5.97249 7.15783 5.80802 7.29235 5.61277 7.3568C5.41747 7.42125 5.20528 7.41109 5.01707 7.32821L5.0157 7.32759L2.40393 6.16624L2.40457 6.16888L3.71559 11.7589C3.71577 11.7594 3.71603 11.7599 3.71638 11.7604C3.71664 11.7607 3.71696 11.7611 3.71732 11.7614C3.7175 11.7615 3.71769 11.7616 3.7179 11.7618C3.7185 11.7621 3.71916 11.7623 3.71983 11.7624C3.72047 11.7625 3.72111 11.7625 3.72173 11.7623C6.25525 11.0611 8.9317 11.0612 11.4652 11.7628L11.3549 12.1609L11.4635 11.7623C11.4642 11.7625 11.4649 11.7625 11.4656 11.7624C11.4663 11.7623 11.4669 11.7621 11.4675 11.7618C11.4681 11.7614 11.4687 11.7609 11.4691 11.7604C11.4693 11.7601 11.4695 11.7597 11.4697 11.7594C11.4697 11.7592 11.4698 11.759 11.4699 11.7588C11.4698 11.7589 11.4699 11.7587 11.4699 11.7588L12.7861 6.16855L12.7867 6.16624L10.1749 7.32759L10.1735 7.32821C9.98534 7.41109 9.77311 7.42125 9.57786 7.3568C9.38256 7.29235 9.21813 7.15783 9.11625 6.97918L9.11381 6.97493L7.59529 4.23743L6.07438 6.97923Z" fill="white"/>
</svg>

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 and nitpick comments (1)
templates/admin-header.php (1)

27-37: Consider extracting SVG icons to separate files

The SVG icons are embedded directly in the HTML, which makes the template harder to maintain. Consider extracting them to separate files and including them using dokan_get_template_part().

Also applies to: 45-55

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 84ab3ba and cb84768.

📒 Files selected for processing (2)
  • templates/admin-header.php (2 hunks)
  • templates/svg-icons/pro-award.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • templates/svg-icons/pro-award.php
🔇 Additional comments (3)
templates/admin-header.php (3)

7-7: Typo in constant name 'DOKAN_PLUGIN_ASSEST'

The constant name contains a typo: 'ASSEST' should be 'ASSETS'.


Line range hint 1-167: Overall structure looks good!

The template is well-structured with:

  • Proper HTML organization
  • Consistent class naming
  • Good use of escaping functions
  • Clear separation of concerns

22-22: 🛠️ Refactor suggestion

Improve null check in conditional statement

The current condition could be more defensive. While dokan()->is_pro_exists() is checked, accessing dokan_pro()->license could throw an error if dokan_pro() returns null.

Apply this fix:

-if ( dokan()->is_pro_exists() && dokan_pro() && dokan_pro()->license->is_valid() ) {
+if ( dokan()->is_pro_exists() && dokan_pro() && dokan_pro()->license && dokan_pro()->license->is_valid() ) {

Likely invalid or redundant comment.

Comment on lines +43 to +46
$upgrade_url = 'https://dokan.co/wordpress/pricing/';
?>
<a target="_blank" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
Upgrade
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve external link handling

The upgrade URL should be:

  1. Configurable rather than hardcoded
  2. Include proper security attributes for external links

Apply these changes:

-$upgrade_url = 'https://dokan.co/wordpress/pricing/';
+$upgrade_url = apply_filters( 'dokan_admin_upgrade_url', 'https://dokan.co/wordpress/pricing/' );
-<a target="_blank" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
+<a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$upgrade_url = 'https://dokan.co/wordpress/pricing/';
?>
<a target="_blank" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
Upgrade
$upgrade_url = apply_filters( 'dokan_admin_upgrade_url', 'https://dokan.co/wordpress/pricing/' );
?>
<a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $upgrade_url ); ?>" class="upgrade-button">
Upgrade

@osmansufy osmansufy added the Needs: Dev Review It requires a developer review and approval label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Dev Review It requires a developer review and approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant