Conversation
…egistration - Updated block meta for duration, price, single supplement, tagline, and travel styles blocks to include descriptions, icons, keywords, and examples. - Refactored index.js files for duration, price, single supplement, tagline, and travel styles blocks to register block variations with improved attributes and examples. - Added support for translations using the __() function for block titles and content. - Improved inner block structures for better layout and presentation in the editor.
|
Caution Review failedThe pull request is closed. Warning CodeRabbit GitHub Action detectedThe repository is using both CodeRabbit Pro and CodeRabbit Open Source (via GitHub Actions), which is not recommended as it may lead to duplicate comments and extra noise. Please remove the CodeRabbit GitHub Action. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Note
|
| Cohort / File(s) | Summary |
|---|---|
Block manifests src/blocks/duration/block.json, src/blocks/price/block.json, src/blocks/single-supplement-wrapper/block.json, src/blocks/tagline/block.json, src/blocks/travel-styles/block.json |
Enriched block.json metadata (textdomain, description, icon, keywords), normalized titles, and replaced minimal examples with richer example objects containing attributes, innerBlocks, nested layouts and preview content. |
Block registration modules (guarded/conditional) src/blocks/duration/index.js, src/blocks/price/index.js, src/blocks/single-supplement-wrapper/index.js, src/blocks/tagline/index.js, src/blocks/travel-styles/index.js |
Replace unconditional registerBlockVariation with guarded registerXVariation functions; add i18n (__) usage; add isActive predicates comparing top-level className; move to nested innerBlocks (including lsx-tour-operator/icons block and post-meta bindings); provide example preview configs; defer registration via conditional utility. |
Adjusted existing variations isActive src/blocks/booking-validity/index.js, src/blocks/departs-from/index.js, src/blocks/ends-in/index.js, src/blocks/group-size/index.js, src/blocks/included/index.js, src/blocks/not-included/index.js |
Update isActive predicates to compare blockAttributes.className === variationAttributes.className (use top-level className instead of nested metadata.className). |
Conditional registration utility src/js/conditional-block-registration.js |
New factory createConditionalRegistration(config) plus wrappers registerForPostTypes, registerForTemplates, registerForPostTypesAndTemplates. Validates config, checks editor context (post type / template slug supporting string or RegExp), subscribes/retries via wp.data.subscribe until criteria match or timeout, and logs errors. |
Docs docs/block-development/conditional-block-registration.md |
New documentation describing API, usage examples, migration guidance, slug matching rules, error handling and testing guidance for conditional registration. |
Build config webpack.config.js |
Added resolve.alias @utils -> src/js/ to simplify imports. |
Changelog changelog.md |
Added entry noting extraction of conditional block registration into its own module. |
Sequence Diagram(s)
sequenceDiagram
participant Block as Block module (index.js)
participant Util as ConditionalRegistration
participant WPData as wp.data
participant Registry as wp.blocks
Block->>Util: registerForPostTypesAndTemplates(criteria, registerXVariation)
Util->>WPData: select('core/editor').getCurrentPostType()/getEditedPostSlug()
WPData-->>Util: context (may be undefined)
alt Context matches
Util->>Registry: invoke registerXVariation() → registerBlockVariation
Registry-->>Util: registered
else Context not ready
Util->>WPData: subscribe(callback)
WPData-->>Util: state changed
Util->>WPData: re-check criteria
alt Now matches
Util->>Registry: registerXVariation() and unsubscribe
Registry-->>Util: registered
else Timeout / no match
Util-->>Block: log error / stop
end
end
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
- Areas needing extra attention:
src/js/conditional-block-registration.js— matching logic for string vs RegExp slugs, subscribe/unsubscribe lifecycle, retry/timeout behavior, and error handling.- Each modified
src/blocks/*/index.js— correctness ofisActivepredicates, i18n usage, innerBlocks nesting (icons block and post-meta bindings), and example payload shapes. webpack.config.js— alias correctness and any import path changes that rely on@utils.
Possibly related issues
- Block Audit: additional-info, banking, climate, cuisine, dress, electricity, health, transport (Destination post type meta & icons integration) #691 — Related: implements conditional registration and icons integration expected for context-restricted blocks.
- Block Audit: review-related-accommodation, review-related-destination, review-related-tour, tour-related-accommodation, tour-related-destination, accommodation-related-tour (Review system & cross-referencing blocks) #694 — Related: provides context-aware availability and richer block metadata and examples that this PR enables.
Possibly related PRs
- PR
#645— Strongly related: similar guarded, post-type/template-aware block registration pattern and variation changes. - PR
#547— Related at code level: introduces/registers thelsx-tour-operator/iconsblock used by the updated innerBlocks. - PR
#667— Related: applies conditional registration pattern and metadata standardization to many of the same blocks.
Suggested labels
comp:block-variations, comp:block-editor, comp:block-json, comp:block-supports, comp:block-inserter
Suggested reviewers
- ZaredRogers
Pre-merge checks and finishing touches
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly summarizes the main enhancement: comprehensive metadata, icon integration, and conditional registration for tour blocks. |
| Description check | ✅ Passed | The PR description includes summary, key changes, files modified, scope, technical implementation, testing notes, and related issues, generally following the template structure despite non-standard YAML front matter. |
| Linked Issues check | ✅ Passed | The PR implements all core coding objectives from issue #690: Block API v3 metadata compliance, icon integration via centralized system, conditional registration for tour contexts, and example configurations. |
| Out of Scope Changes check | ✅ Passed | All changes are directly aligned with issue #690 objectives; the webpack.config.js alias addition and conditional-block-registration.js utility are supporting infrastructure for the main block enhancements. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
📜 Recent review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (22)
build/blocks/booking-validity/index.asset.phpis excluded by!build/**build/blocks/booking-validity/index.jsis excluded by!build/**build/blocks/departs-from/index.asset.phpis excluded by!build/**build/blocks/departs-from/index.jsis excluded by!build/**build/blocks/duration/index.asset.phpis excluded by!build/**build/blocks/duration/index.jsis excluded by!build/**build/blocks/ends-in/index.asset.phpis excluded by!build/**build/blocks/ends-in/index.jsis excluded by!build/**build/blocks/group-size/index.asset.phpis excluded by!build/**build/blocks/group-size/index.jsis excluded by!build/**build/blocks/included/index.asset.phpis excluded by!build/**build/blocks/included/index.jsis excluded by!build/**build/blocks/not-included/index.asset.phpis excluded by!build/**build/blocks/not-included/index.jsis excluded by!build/**build/blocks/price/index.asset.phpis excluded by!build/**build/blocks/price/index.jsis excluded by!build/**build/blocks/single-supplement-wrapper/index.asset.phpis excluded by!build/**build/blocks/single-supplement-wrapper/index.jsis excluded by!build/**build/blocks/tagline/index.asset.phpis excluded by!build/**build/blocks/tagline/index.jsis excluded by!build/**build/blocks/travel-styles/index.asset.phpis excluded by!build/**build/blocks/travel-styles/index.jsis excluded by!build/**
📒 Files selected for processing (11)
src/blocks/booking-validity/index.js(1 hunks)src/blocks/departs-from/index.js(1 hunks)src/blocks/duration/index.js(1 hunks)src/blocks/ends-in/index.js(1 hunks)src/blocks/group-size/index.js(1 hunks)src/blocks/included/index.js(1 hunks)src/blocks/not-included/index.js(1 hunks)src/blocks/price/index.js(1 hunks)src/blocks/single-supplement-wrapper/index.js(1 hunks)src/blocks/tagline/index.js(1 hunks)src/blocks/travel-styles/index.js(1 hunks)
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
There was a problem hiding this comment.
Files selected (5)
- src/blocks/duration/index.js (1)
- src/blocks/price/index.js (1)
- src/blocks/single-supplement-wrapper/index.js (1)
- src/blocks/tagline/index.js (1)
- src/blocks/travel-styles/index.js (1)
Files ignored due to filter (10)
- build/blocks/duration/block.json
- build/blocks/price/block.json
- build/blocks/single-supplement-wrapper/block.json
- build/blocks/tagline/block.json
- build/blocks/travel-styles/block.json
- src/blocks/duration/block.json
- src/blocks/price/block.json
- src/blocks/single-supplement-wrapper/block.json
- src/blocks/tagline/block.json
- src/blocks/travel-styles/block.json
Files not summarized due to errors (5)
- src/blocks/single-supplement-wrapper/index.js (nothing obtained from openai)
- src/blocks/travel-styles/index.js (nothing obtained from openai)
- src/blocks/duration/index.js (nothing obtained from openai)
- src/blocks/tagline/index.js (nothing obtained from openai)
- src/blocks/price/index.js (nothing obtained from openai)
Files not reviewed due to errors (5)
- src/blocks/price/index.js (no response)
- src/blocks/single-supplement-wrapper/index.js (no response)
- src/blocks/tagline/index.js (no response)
- src/blocks/travel-styles/index.js (no response)
- src/blocks/duration/index.js (no response)
Review comments generated (0)
- Review: 0
- LGTM: 0
Tips
Chat with
CodeRabbit Bot (@coderabbitai)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitaiin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignoreanywhere in the PR description to pause further reviews from the bot.
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (5)
src/blocks/tagline/block.json (1)
9-18: Add accessibility guidance to the description.Line 9 updates the block description but still misses the required editor-facing accessibility guidance noted in our manifest guidelines. Please extend the description to tell editors how to keep the tagline concise and meaningful for assistive tech users. Based on coding guidelines.
src/blocks/single-supplement-wrapper/block.json (1)
9-18: Include accessibility guidance in the block description.Line 9’s copy still omits any instructions for editors on presenting the single supplement charge accessibly (e.g. plain text labels for screen readers). Please extend the description accordingly so we comply with the manifest accessibility guideline. Based on coding guidelines.
src/blocks/duration/block.json (1)
9-18: Document accessibility expectations in the description.Line 9 adds a richer blurb but does not mention how editors should present duration info for assistive technologies. Please expand the text so it clearly instructs editors to keep the wording screen-reader friendly, per our block.json accessibility requirement. Based on coding guidelines.
src/blocks/travel-styles/index.js (1)
142-142: Document or extract the magic timeout value.The 100ms delay is hard-coded without explanation. If this value is critical for allowing the editor to initialise, document it. If it's reusable across blocks, extract it as a named constant.
+ // Allow editor to initialise before checking post type. + const EDITOR_INIT_DELAY = 100; + // Try initial registration with a small delay - setTimeout(() => { + setTimeout(() => {src/blocks/price/index.js (1)
57-57: Ensure consistent spacing in translated strings.Line 57 uses
'From:'(no space after colon) whilst line 114 uses'From: '(with space). Maintain consistent formatting for the same label.If the space is intentional for the example, consider documenting it. Otherwise, standardise:
- content: '<strong>' + __('From:', 'tour-operator') + '</strong>', + content: '<strong>' + __('From: ', 'tour-operator') + '</strong>',Also applies to: 114-114
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (92)
build/admin-rtl.cssis excluded by!build/**build/admin-script.asset.phpis excluded by!build/**build/blocks/accommodation-related-accommodation/index.asset.phpis excluded by!build/**build/blocks/accommodation-related-destination/index.asset.phpis excluded by!build/**build/blocks/accommodation-related-tour/index.asset.phpis excluded by!build/**build/blocks/accommodation-type/index.asset.phpis excluded by!build/**build/blocks/additional-info/index.asset.phpis excluded by!build/**build/blocks/banking/index.asset.phpis excluded by!build/**build/blocks/banner-cover/index.asset.phpis excluded by!build/**build/blocks/best-time-to-visit/index.asset.phpis excluded by!build/**build/blocks/booking-validity/index.asset.phpis excluded by!build/**build/blocks/checkin-time/index.asset.phpis excluded by!build/**build/blocks/checkout-time/index.asset.phpis excluded by!build/**build/blocks/climate/index.asset.phpis excluded by!build/**build/blocks/cuisine/index.asset.phpis excluded by!build/**build/blocks/day-by-day/index.asset.phpis excluded by!build/**build/blocks/departs-from/index.asset.phpis excluded by!build/**build/blocks/destination-to-accommodation/index.asset.phpis excluded by!build/**build/blocks/dress/index.asset.phpis excluded by!build/**build/blocks/duration/block.jsonis excluded by!build/**build/blocks/duration/index.asset.phpis excluded by!build/**build/blocks/duration/index.jsis excluded by!build/**build/blocks/electricity/index.asset.phpis excluded by!build/**build/blocks/ends-in/index.asset.phpis excluded by!build/**build/blocks/facilities/index.asset.phpis excluded by!build/**build/blocks/facts-country-wrapper/index.asset.phpis excluded by!build/**build/blocks/facts-regions-wrapper/index.asset.phpis excluded by!build/**build/blocks/featured-accommodation/index.asset.phpis excluded by!build/**build/blocks/featured-destinations/index.asset.phpis excluded by!build/**build/blocks/featured-tours/index.asset.phpis excluded by!build/**build/blocks/gallery/index.asset.phpis excluded by!build/**build/blocks/google-map/index.asset.phpis excluded by!build/**build/blocks/group-size/index.asset.phpis excluded by!build/**build/blocks/health/index.asset.phpis excluded by!build/**build/blocks/icons/index.asset.phpis excluded by!build/**build/blocks/icons/style-index-rtl.cssis excluded by!build/**build/blocks/included/index.asset.phpis excluded by!build/**build/blocks/itinerary/index.asset.phpis excluded by!build/**build/blocks/lsx-destination-to-tour/index.asset.phpis excluded by!build/**build/blocks/minimum-child-age/index.asset.phpis excluded by!build/**build/blocks/modal-button/index.asset.phpis excluded by!build/**build/blocks/more-link/index.asset.phpis excluded by!build/**build/blocks/not-included/index.asset.phpis excluded by!build/**build/blocks/number-of-rooms/index.asset.phpis excluded by!build/**build/blocks/permalink-button/index.asset.phpis excluded by!build/**build/blocks/price-include-exclude/index.asset.phpis excluded by!build/**build/blocks/price/block.jsonis excluded by!build/**build/blocks/price/index.asset.phpis excluded by!build/**build/blocks/price/index.jsis excluded by!build/**build/blocks/rating/index.asset.phpis excluded by!build/**build/blocks/regions/index.asset.phpis excluded by!build/**build/blocks/related-regions/index.asset.phpis excluded by!build/**build/blocks/review-related-accommodation/index.asset.phpis excluded by!build/**build/blocks/review-related-destination/index.asset.phpis excluded by!build/**build/blocks/review-related-tour/index.asset.phpis excluded by!build/**build/blocks/safety/index.asset.phpis excluded by!build/**build/blocks/single-supplement-wrapper/block.jsonis excluded by!build/**build/blocks/single-supplement-wrapper/index.asset.phpis excluded by!build/**build/blocks/single-supplement-wrapper/index.jsis excluded by!build/**build/blocks/special-interests/index.asset.phpis excluded by!build/**build/blocks/spoken-languages/index.asset.phpis excluded by!build/**build/blocks/sticky-menu/index.asset.phpis excluded by!build/**build/blocks/sticky-menu/sticky-menu-editor-extension.asset.phpis excluded by!build/**build/blocks/sticky-menu/style-index-rtl.cssis excluded by!build/**build/blocks/sticky-menu/view.asset.phpis excluded by!build/**build/blocks/suggested-visitor-types/index.asset.phpis excluded by!build/**build/blocks/tagline/block.jsonis excluded by!build/**build/blocks/tagline/index.asset.phpis excluded by!build/**build/blocks/tagline/index.jsis excluded by!build/**build/blocks/tour-related-accommodation/index.asset.phpis excluded by!build/**build/blocks/tour-related-destination/index.asset.phpis excluded by!build/**build/blocks/tour-related-tour/index.asset.phpis excluded by!build/**build/blocks/transport/index.asset.phpis excluded by!build/**build/blocks/travel-styles/block.jsonis excluded by!build/**build/blocks/travel-styles/index.asset.phpis excluded by!build/**build/blocks/travel-styles/index.jsis excluded by!build/**build/blocks/unit-rooms/index.asset.phpis excluded by!build/**build/blocks/units/index.asset.phpis excluded by!build/**build/blocks/videos/index.asset.phpis excluded by!build/**build/blocks/visa/index.asset.phpis excluded by!build/**build/blocks/wetu-map/index.asset.phpis excluded by!build/**build/custom.asset.phpis excluded by!build/**build/general.asset.phpis excluded by!build/**build/linked-cover.asset.phpis excluded by!build/**build/maps.asset.phpis excluded by!build/**build/metabox-structure.asset.phpis excluded by!build/**build/metaboxes-rtl.cssis excluded by!build/**build/modals.asset.phpis excluded by!build/**build/scporder.asset.phpis excluded by!build/**build/slider-query.asset.phpis excluded by!build/**build/slotfills.asset.phpis excluded by!build/**build/style-rtl.cssis excluded by!build/**
📒 Files selected for processing (10)
src/blocks/duration/block.json(1 hunks)src/blocks/duration/index.js(1 hunks)src/blocks/price/block.json(1 hunks)src/blocks/price/index.js(1 hunks)src/blocks/single-supplement-wrapper/block.json(1 hunks)src/blocks/single-supplement-wrapper/index.js(1 hunks)src/blocks/tagline/block.json(1 hunks)src/blocks/tagline/index.js(1 hunks)src/blocks/travel-styles/block.json(1 hunks)src/blocks/travel-styles/index.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
src/**/*.{js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use @wordpress/eslint-plugin for JavaScript linting
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
src/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{js,jsx,ts,tsx}: Use useBlockProps() in block edit/save components when applicable
Use the text domaintour-operatorfor JS i18n calls
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
{assets,src}/**/*
📄 CodeRabbit inference engine (.github/instructions/block-theme-structure.instructions.md)
Keep SCSS/JS/images source assets in assets/ or src/
Files:
src/blocks/travel-styles/index.jssrc/blocks/duration/block.jsonsrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/single-supplement-wrapper/block.jsonsrc/blocks/travel-styles/block.jsonsrc/blocks/price/index.jssrc/blocks/tagline/block.jsonsrc/blocks/price/block.jsonsrc/blocks/duration/index.js
**/*.{js,ts}
📄 CodeRabbit inference engine (.github/instructions/javascript-react.instructions.md)
**/*.{js,ts}: Use const or let instead of var for variable declarations
Use default parameters for function arguments where appropriate
Use @wordpress/api-fetch (optionally with addQueryArgs) for REST API requests
Register blocks via registerBlockType using block metadata (imported from block.json), and localize title/description/keywords
Use wp.media for media selection in custom components/utilities when needed
Create and register custom data stores with @wordpress/data (createReduxStore + register), and structure actions/selectors clearly
Initialize frontend interactivity after DOMContentLoaded and implement ARIA attributes for toggles (aria-controls, aria-expanded)
Handle AJAX form submissions with fetch, proper loading states, and user notices; restore UI state in finally
Implement accessibility utilities like focus trapping and polite screen reader announcements for dynamic content
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.github/instructions/javascript-react.instructions.md)
**/*.{js,ts,jsx,tsx}: Prefer arrow functions for callbacks and inline handlers
Use object/array destructuring for cleaner code
Use template literals for string interpolation
Use async/await for promise handling with try/catch for errors
Use WordPress i18n APIs (__/_n/sprintf) with a consistent textdomain for all user-facing strings; include translator comments where needed
Use @wordpress/data dispatch/select for interacting with WP data stores (e.g., core/notices, core/editor)
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/instructions/js-ts.instructions.md)
**/*.{ts,tsx,js,jsx}: Debounce user inputs to prevent excessive processing
Avoid blocking the UI thread (prefer async/non-blocking operations)
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{js,mjs,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/performance.instructions.md)
Defer non-critical JavaScript and avoid synchronous blocking operations
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{php,js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/review.instructions.md)
Internationalize user‑facing strings using WordPress i18n APIs
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{css,js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/reviews.instructions.md)
Minimize CSS/JS payload size
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/reviews.instructions.md)
Lazy-load code and resources where possible
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{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 and @wordpress/eslint-plugin rules.
- Ensure the code is well-documented with proper JSDoc comments.
- 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.
- Follow WordPress JavaScript coding standards and use WordPress script localization.
- Use WordPress script dependencies and enqueue properly.
- Ensure React/JSX best practices for blocks and modern JavaScript/TypeScript patterns.
- Implement proper error handling and loading states.
- Use WordPress components and design system where applicable.
- For Tour Operator: Focus on tour booking interfaces, search functionality, and tour display components.
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
src/blocks/**/*.{js,jsx,ts,tsx}
⚙️ CodeRabbit configuration file
src/blocks/**/*.{js,jsx,ts,tsx}: - Follow WordPress JavaScript coding standards and @wordpress/scripts configuration.
- Use WordPress components from @wordpress/components and design system.
- Implement proper React/JSX patterns for WordPress blocks.
- Ensure proper WordPress script dependencies and localization.
- Use WordPress data store patterns with @wordpress/data.
- Implement proper error boundaries and loading states.
- Follow modern JavaScript/TypeScript patterns with proper typing.
- Ensure accessibility in interactive block components.
- Use WordPress block editor APIs correctly (useBlockProps, InspectorControls, etc.).
- Implement proper block validation and save/edit functionality.
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
src/**/block.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/block.json: Prefer block.json with server-side registration for blocks (avoid ad‑hoc registration)
Use the block namespacelsx-toin block names
Files:
src/blocks/duration/block.jsonsrc/blocks/single-supplement-wrapper/block.jsonsrc/blocks/travel-styles/block.jsonsrc/blocks/tagline/block.jsonsrc/blocks/price/block.json
**/block.json
📄 CodeRabbit inference engine (.github/instructions/accessibility.instructions.md)
**/block.json: Provide meaningful block titles, descriptions, and keywords in block.json
Include editor-specific accessibility guidance in block descriptions (block.json)
Include accessibility considerations in block registration (e.g., supports, attributes)
**/block.json: In block.json, include required fields: name, title, description, category, keywords, and supports
Ensure accessible metadata in block.json: use clear, descriptive title and description
Provide reasonable default values for attributes in block.json
Use usesInnerBlocks in block.json only when the block actually contains InnerBlocks
Define block variations in block.json to provide common starting points
Ensure i18n and RTL safety for user-facing strings in block.json (including variations)
Files:
src/blocks/duration/block.jsonsrc/blocks/single-supplement-wrapper/block.jsonsrc/blocks/travel-styles/block.jsonsrc/blocks/tagline/block.jsonsrc/blocks/price/block.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: review
- GitHub Check: Summary
🔇 Additional comments (2)
src/blocks/travel-styles/block.json (1)
1-70: LGTM! Comprehensive block metadata.The block.json enhancements follow WordPress Block API v3 standards with appropriate textdomain, description, icon, keywords, and a detailed example configuration for editor previews.
src/blocks/price/block.json (1)
1-34: LGTM! Well-structured block metadata.The price block metadata follows Block API v3 standards with appropriate textdomain, description, icon, keywords, and example configuration.
There was a problem hiding this comment.
Pull Request Overview
This PR enhances tour-related blocks with Block API v3 compliance, centralized icon integration, and conditional registration logic. The changes focus on five tour blocks (travel styles, duration, single supplement, price, and tagline) with comprehensive metadata updates and improved user experience.
Key Changes
- Block API v3 metadata standardization with descriptions, keywords, and examples
- Centralized icon system integration replacing hardcoded image paths
- Conditional registration for tour-context awareness in editor
Reviewed Changes
Copilot reviewed 102 out of 102 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/blocks/travel-styles/index.js | Added conditional registration logic and icon system integration with internationalization |
| src/blocks/travel-styles/block.json | Enhanced with comprehensive metadata, keywords, and example configuration |
| src/blocks/duration/index.js | Implemented conditional registration with centralized icon system |
| src/blocks/duration/block.json | Added Block API v3 metadata with descriptions and keywords |
| src/blocks/single-supplement-wrapper/index.js | Refactored with tour-context detection and icon integration |
| src/blocks/single-supplement-wrapper/block.json | Updated with comprehensive metadata and example configuration |
| src/blocks/price/index.js | Enhanced with conditional registration and centralized icons |
| src/blocks/price/block.json | Added API v3 compliance with detailed examples |
| src/blocks/tagline/index.js | Implemented conditional registration and improved layout |
| src/blocks/tagline/block.json | Enhanced metadata with keywords and examples |
| build/* | Compiled assets with updated dependencies and version hashes |
…er maintainability
…edwp/tour-operator into refactor/tour-blocks-meta-icons
There was a problem hiding this comment.
Files selected (5)
- src/blocks/duration/index.js (1)
- src/blocks/price/index.js (1)
- src/blocks/single-supplement-wrapper/index.js (1)
- src/blocks/tagline/index.js (1)
- src/blocks/travel-styles/index.js (1)
Files ignored due to filter (2)
- build/blocks/price/block.json
- src/blocks/price/block.json
Files not summarized due to errors (5)
- src/blocks/price/index.js (nothing obtained from openai)
- src/blocks/duration/index.js (nothing obtained from openai)
- src/blocks/travel-styles/index.js (nothing obtained from openai)
- src/blocks/tagline/index.js (nothing obtained from openai)
- src/blocks/single-supplement-wrapper/index.js (nothing obtained from openai)
Files not reviewed due to errors (5)
- src/blocks/duration/index.js (no response)
- src/blocks/single-supplement-wrapper/index.js (no response)
- src/blocks/price/index.js (no response)
- src/blocks/tagline/index.js (no response)
- src/blocks/travel-styles/index.js (no response)
Review comments generated (0)
- Review: 0
- LGTM: 0
Tips
Chat with
CodeRabbit Bot (@coderabbitai)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitaiin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignoreanywhere in the PR description to pause further reviews from the bot.
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (2)
src/blocks/single-supplement-wrapper/index.js (1)
22-24: Fix the isActive comparator to match the correct attribute path.The variation defines
classNameatattributes.className(line 29), notmetadata.className. The current comparison will always fail.Apply this diff:
isActive: (blockAttributes, variationAttributes) => { - return blockAttributes.metadata?.className === variationAttributes.metadata?.className; + return blockAttributes.className === variationAttributes.attributes?.className; },src/blocks/tagline/index.js (1)
21-23: Fix the isActive comparator to match the correct attribute path.The variation defines
classNameatattributes.className(line 37), notmetadata.className. The current comparison will always fail becausevariationAttributes.metadata?.classNameis undefined.Apply this diff:
isActive: (blockAttributes, variationAttributes) => { - return blockAttributes.metadata?.className === variationAttributes.metadata?.className; + return blockAttributes.className === variationAttributes.attributes?.className; },
🧹 Nitpick comments (9)
src/blocks/travel-styles/index.js (2)
1-116: Add JSDoc documentation with @SInCE tags.Per the coding guidelines, all functions and modules require JSDoc comments with
@sincetags indicating the next plugin version. Add a module-level JSDoc block describing the file's purpose and function-level JSDoc forregisterTravelStylesVariation.As per coding guidelines.
50-50: Consider using template literals for improved readability.The string concatenation using
+operators could be replaced with template literals for cleaner, more maintainable code.Example for line 50:
- content: '<strong>' + __('Travel Styles:', 'tour-operator') + '</strong>', + content: `<strong>${__('Travel Styles:', 'tour-operator')}</strong>`,Also applies to: 98-98
src/blocks/price/index.js (2)
1-132: Add JSDoc documentation with @SInCE tags.Per the coding guidelines, all functions and modules require JSDoc comments with
@sincetags. Add module-level and function-level JSDoc forregisterPriceVariation.As per coding guidelines.
55-55: Consider using template literals and standardise spacing.The string concatenation could use template literals for better readability. Also note the spacing inconsistency: line 55 has no space after the colon, whilst line 112 includes a space.
Example for line 55:
- content: '<strong>' + __('From:', 'tour-operator') + '</strong>', + content: `<strong>${__('From:', 'tour-operator')}</strong>`,Also applies to: 112-112
src/blocks/tagline/index.js (1)
1-64: Add JSDoc documentation with @SInCE tags.Per the coding guidelines, all functions and modules require JSDoc comments with
@sincetags. Add module-level and function-level JSDoc forregisterTaglineVariation.As per coding guidelines.
src/blocks/single-supplement-wrapper/index.js (2)
1-128: Add JSDoc documentation with @SInCE tags.Per the coding guidelines, all functions and modules require JSDoc comments with
@sincetags. Add module-level and function-level JSDoc forregisterSingleSupplementVariation.As per coding guidelines.
56-56: Consider using template literals and standardise spacing.The string concatenation could use template literals for better readability. Also note the spacing inconsistency: line 56 has no space after the colon, whilst line 110 includes a space.
Example for line 56:
- content: '<strong>' + __('Single supplement:', 'tour-operator') + '</strong>', + content: `<strong>${__('Single supplement:', 'tour-operator')}</strong>`,Also applies to: 110-110
src/blocks/duration/index.js (2)
1-148: Add JSDoc documentation with @SInCE tags.Per the coding guidelines, all functions and modules require JSDoc comments with
@sincetags. Add module-level and function-level JSDoc forregisterDurationVariation.As per coding guidelines.
55-55: Consider using template literals and standardise spacing.The string concatenation could use template literals for better readability. Also note the spacing inconsistency: line 55 has no space after the colon, whilst line 128 includes a space.
Example for line 55:
- content: '<strong>' + __('Duration:', 'tour-operator') + '</strong>', + content: `<strong>${__('Duration:', 'tour-operator')}</strong>`,Also applies to: 128-128
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (165)
build/admin-rtl.cssis excluded by!build/**build/admin-script.asset.phpis excluded by!build/**build/admin-script.jsis excluded by!build/**build/admin.cssis excluded by!build/**build/blocks/accommodation-related-accommodation/index.asset.phpis excluded by!build/**build/blocks/accommodation-related-accommodation/index.jsis excluded by!build/**build/blocks/accommodation-related-destination/index.asset.phpis excluded by!build/**build/blocks/accommodation-related-destination/index.jsis excluded by!build/**build/blocks/accommodation-related-tour/index.asset.phpis excluded by!build/**build/blocks/accommodation-related-tour/index.jsis excluded by!build/**build/blocks/accommodation-type/index.asset.phpis excluded by!build/**build/blocks/accommodation-type/index.jsis excluded by!build/**build/blocks/additional-info/index.asset.phpis excluded by!build/**build/blocks/additional-info/index.jsis excluded by!build/**build/blocks/banking/index.asset.phpis excluded by!build/**build/blocks/banking/index.jsis excluded by!build/**build/blocks/banner-cover/index.asset.phpis excluded by!build/**build/blocks/banner-cover/index.jsis excluded by!build/**build/blocks/best-time-to-visit/index.asset.phpis excluded by!build/**build/blocks/best-time-to-visit/index.jsis excluded by!build/**build/blocks/booking-validity/index.asset.phpis excluded by!build/**build/blocks/booking-validity/index.jsis excluded by!build/**build/blocks/checkin-time/index.asset.phpis excluded by!build/**build/blocks/checkin-time/index.jsis excluded by!build/**build/blocks/checkout-time/index.asset.phpis excluded by!build/**build/blocks/checkout-time/index.jsis excluded by!build/**build/blocks/climate/index.asset.phpis excluded by!build/**build/blocks/climate/index.jsis excluded by!build/**build/blocks/cuisine/index.asset.phpis excluded by!build/**build/blocks/cuisine/index.jsis excluded by!build/**build/blocks/day-by-day/index.asset.phpis excluded by!build/**build/blocks/day-by-day/index.jsis excluded by!build/**build/blocks/departs-from/index.asset.phpis excluded by!build/**build/blocks/departs-from/index.jsis excluded by!build/**build/blocks/destination-to-accommodation/index.asset.phpis excluded by!build/**build/blocks/destination-to-accommodation/index.jsis excluded by!build/**build/blocks/dress/index.asset.phpis excluded by!build/**build/blocks/dress/index.jsis excluded by!build/**build/blocks/duration/index.asset.phpis excluded by!build/**build/blocks/duration/index.jsis excluded by!build/**build/blocks/electricity/index.asset.phpis excluded by!build/**build/blocks/electricity/index.jsis excluded by!build/**build/blocks/ends-in/index.asset.phpis excluded by!build/**build/blocks/ends-in/index.jsis excluded by!build/**build/blocks/facilities/index.asset.phpis excluded by!build/**build/blocks/facilities/index.jsis excluded by!build/**build/blocks/facts-country-wrapper/index.asset.phpis excluded by!build/**build/blocks/facts-country-wrapper/index.jsis excluded by!build/**build/blocks/facts-regions-wrapper/index.asset.phpis excluded by!build/**build/blocks/facts-regions-wrapper/index.jsis excluded by!build/**build/blocks/featured-accommodation/index.asset.phpis excluded by!build/**build/blocks/featured-accommodation/index.jsis excluded by!build/**build/blocks/featured-destinations/index.asset.phpis excluded by!build/**build/blocks/featured-destinations/index.jsis excluded by!build/**build/blocks/featured-tours/index.asset.phpis excluded by!build/**build/blocks/featured-tours/index.jsis excluded by!build/**build/blocks/gallery/index.asset.phpis excluded by!build/**build/blocks/gallery/index.jsis excluded by!build/**build/blocks/google-map/index.asset.phpis excluded by!build/**build/blocks/google-map/index.jsis excluded by!build/**build/blocks/group-size/index.asset.phpis excluded by!build/**build/blocks/group-size/index.jsis excluded by!build/**build/blocks/health/index.asset.phpis excluded by!build/**build/blocks/health/index.jsis excluded by!build/**build/blocks/icons/index.asset.phpis excluded by!build/**build/blocks/icons/index.jsis excluded by!build/**build/blocks/icons/style-index-rtl.cssis excluded by!build/**build/blocks/icons/style-index.cssis excluded by!build/**build/blocks/included/index.asset.phpis excluded by!build/**build/blocks/included/index.jsis excluded by!build/**build/blocks/itinerary/index.asset.phpis excluded by!build/**build/blocks/itinerary/index.jsis excluded by!build/**build/blocks/lsx-destination-to-tour/index.asset.phpis excluded by!build/**build/blocks/lsx-destination-to-tour/index.jsis excluded by!build/**build/blocks/minimum-child-age/index.asset.phpis excluded by!build/**build/blocks/minimum-child-age/index.jsis excluded by!build/**build/blocks/modal-button/index.asset.phpis excluded by!build/**build/blocks/modal-button/index.jsis excluded by!build/**build/blocks/more-link/index.asset.phpis excluded by!build/**build/blocks/more-link/index.jsis excluded by!build/**build/blocks/not-included/index.asset.phpis excluded by!build/**build/blocks/not-included/index.jsis excluded by!build/**build/blocks/number-of-rooms/index.asset.phpis excluded by!build/**build/blocks/number-of-rooms/index.jsis excluded by!build/**build/blocks/permalink-button/index.asset.phpis excluded by!build/**build/blocks/permalink-button/index.jsis excluded by!build/**build/blocks/price-include-exclude/index.asset.phpis excluded by!build/**build/blocks/price-include-exclude/index.jsis excluded by!build/**build/blocks/price/block.jsonis excluded by!build/**build/blocks/price/index.asset.phpis excluded by!build/**build/blocks/price/index.jsis excluded by!build/**build/blocks/rating/index.asset.phpis excluded by!build/**build/blocks/rating/index.jsis excluded by!build/**build/blocks/regions/index.asset.phpis excluded by!build/**build/blocks/regions/index.jsis excluded by!build/**build/blocks/related-regions/index.asset.phpis excluded by!build/**build/blocks/related-regions/index.jsis excluded by!build/**build/blocks/review-related-accommodation/index.asset.phpis excluded by!build/**build/blocks/review-related-accommodation/index.jsis excluded by!build/**build/blocks/review-related-destination/index.asset.phpis excluded by!build/**build/blocks/review-related-destination/index.jsis excluded by!build/**build/blocks/review-related-tour/index.asset.phpis excluded by!build/**build/blocks/review-related-tour/index.jsis excluded by!build/**build/blocks/safety/index.asset.phpis excluded by!build/**build/blocks/safety/index.jsis excluded by!build/**build/blocks/single-supplement-wrapper/index.asset.phpis excluded by!build/**build/blocks/single-supplement-wrapper/index.jsis excluded by!build/**build/blocks/special-interests/index.asset.phpis excluded by!build/**build/blocks/special-interests/index.jsis excluded by!build/**build/blocks/spoken-languages/index.asset.phpis excluded by!build/**build/blocks/spoken-languages/index.jsis excluded by!build/**build/blocks/sticky-menu/index.asset.phpis excluded by!build/**build/blocks/sticky-menu/index.jsis excluded by!build/**build/blocks/sticky-menu/sticky-menu-editor-extension.asset.phpis excluded by!build/**build/blocks/sticky-menu/sticky-menu-editor-extension.jsis excluded by!build/**build/blocks/sticky-menu/style-index-rtl.cssis excluded by!build/**build/blocks/sticky-menu/style-index.cssis excluded by!build/**build/blocks/sticky-menu/view.asset.phpis excluded by!build/**build/blocks/sticky-menu/view.jsis excluded by!build/**build/blocks/suggested-visitor-types/index.asset.phpis excluded by!build/**build/blocks/suggested-visitor-types/index.jsis excluded by!build/**build/blocks/tagline/index.asset.phpis excluded by!build/**build/blocks/tagline/index.jsis excluded by!build/**build/blocks/tour-related-accommodation/index.asset.phpis excluded by!build/**build/blocks/tour-related-accommodation/index.jsis excluded by!build/**build/blocks/tour-related-destination/index.asset.phpis excluded by!build/**build/blocks/tour-related-destination/index.jsis excluded by!build/**build/blocks/tour-related-tour/index.asset.phpis excluded by!build/**build/blocks/tour-related-tour/index.jsis excluded by!build/**build/blocks/transport/index.asset.phpis excluded by!build/**build/blocks/transport/index.jsis excluded by!build/**build/blocks/travel-styles/index.asset.phpis excluded by!build/**build/blocks/travel-styles/index.jsis excluded by!build/**build/blocks/unit-rooms/index.asset.phpis excluded by!build/**build/blocks/unit-rooms/index.jsis excluded by!build/**build/blocks/units/index.asset.phpis excluded by!build/**build/blocks/units/index.jsis excluded by!build/**build/blocks/videos/index.asset.phpis excluded by!build/**build/blocks/videos/index.jsis excluded by!build/**build/blocks/visa/index.asset.phpis excluded by!build/**build/blocks/visa/index.jsis excluded by!build/**build/blocks/wetu-map/index.asset.phpis excluded by!build/**build/blocks/wetu-map/index.jsis excluded by!build/**build/custom.asset.phpis excluded by!build/**build/custom.jsis excluded by!build/**build/general.asset.phpis excluded by!build/**build/general.jsis excluded by!build/**build/linked-cover.asset.phpis excluded by!build/**build/linked-cover.jsis excluded by!build/**build/maps.asset.phpis excluded by!build/**build/maps.jsis excluded by!build/**build/metabox-structure.asset.phpis excluded by!build/**build/metabox-structure.jsis excluded by!build/**build/metaboxes-rtl.cssis excluded by!build/**build/metaboxes.cssis excluded by!build/**build/modals.asset.phpis excluded by!build/**build/modals.jsis excluded by!build/**build/scporder.asset.phpis excluded by!build/**build/scporder.jsis excluded by!build/**build/slider-query.asset.phpis excluded by!build/**build/slider-query.jsis excluded by!build/**build/slotfills.asset.phpis excluded by!build/**build/slotfills.jsis excluded by!build/**build/style-rtl.cssis excluded by!build/**build/style.cssis excluded by!build/**
📒 Files selected for processing (6)
src/blocks/duration/index.js(1 hunks)src/blocks/price/block.json(1 hunks)src/blocks/price/index.js(1 hunks)src/blocks/single-supplement-wrapper/index.js(1 hunks)src/blocks/tagline/index.js(1 hunks)src/blocks/travel-styles/index.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/blocks/price/block.json
🧰 Additional context used
📓 Path-based instructions (12)
src/**/*.{js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use @wordpress/eslint-plugin for JavaScript linting
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
src/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{js,jsx,ts,tsx}: Use useBlockProps() in block edit/save components when applicable
Use the text domaintour-operatorfor JS i18n calls
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
{assets,src}/**/*
📄 CodeRabbit inference engine (.github/instructions/block-theme-structure.instructions.md)
Keep SCSS/JS/images source assets in assets/ or src/
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{js,ts}
📄 CodeRabbit inference engine (.github/instructions/javascript-react.instructions.md)
**/*.{js,ts}: Use const or let instead of var for variable declarations
Use default parameters for function arguments where appropriate
Use @wordpress/api-fetch (optionally with addQueryArgs) for REST API requests
Register blocks via registerBlockType using block metadata (imported from block.json), and localize title/description/keywords
Use wp.media for media selection in custom components/utilities when needed
Create and register custom data stores with @wordpress/data (createReduxStore + register), and structure actions/selectors clearly
Initialize frontend interactivity after DOMContentLoaded and implement ARIA attributes for toggles (aria-controls, aria-expanded)
Handle AJAX form submissions with fetch, proper loading states, and user notices; restore UI state in finally
Implement accessibility utilities like focus trapping and polite screen reader announcements for dynamic content
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.github/instructions/javascript-react.instructions.md)
**/*.{js,ts,jsx,tsx}: Prefer arrow functions for callbacks and inline handlers
Use object/array destructuring for cleaner code
Use template literals for string interpolation
Use async/await for promise handling with try/catch for errors
Use WordPress i18n APIs (__/_n/sprintf) with a consistent textdomain for all user-facing strings; include translator comments where needed
Use @wordpress/data dispatch/select for interacting with WP data stores (e.g., core/notices, core/editor)
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/instructions/js-ts.instructions.md)
**/*.{ts,tsx,js,jsx}: Debounce user inputs to prevent excessive processing
Avoid blocking the UI thread (prefer async/non-blocking operations)
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{js,mjs,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/performance.instructions.md)
Defer non-critical JavaScript and avoid synchronous blocking operations
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{php,js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/review.instructions.md)
Internationalize user‑facing strings using WordPress i18n APIs
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{css,js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/reviews.instructions.md)
Minimize CSS/JS payload size
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/reviews.instructions.md)
Lazy-load code and resources where possible
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
**/*.{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 and @wordpress/eslint-plugin rules.
- Ensure the code is well-documented with proper JSDoc comments.
- 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.
- Follow WordPress JavaScript coding standards and use WordPress script localization.
- Use WordPress script dependencies and enqueue properly.
- Ensure React/JSX best practices for blocks and modern JavaScript/TypeScript patterns.
- Implement proper error handling and loading states.
- Use WordPress components and design system where applicable.
- For Tour Operator: Focus on tour booking interfaces, search functionality, and tour display components.
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
src/blocks/**/*.{js,jsx,ts,tsx}
⚙️ CodeRabbit configuration file
src/blocks/**/*.{js,jsx,ts,tsx}: - Follow WordPress JavaScript coding standards and @wordpress/scripts configuration.
- Use WordPress components from @wordpress/components and design system.
- Implement proper React/JSX patterns for WordPress blocks.
- Ensure proper WordPress script dependencies and localization.
- Use WordPress data store patterns with @wordpress/data.
- Implement proper error boundaries and loading states.
- Follow modern JavaScript/TypeScript patterns with proper typing.
- Ensure accessibility in interactive block components.
- Use WordPress block editor APIs correctly (useBlockProps, InspectorControls, etc.).
- Implement proper block validation and save/edit functionality.
Files:
src/blocks/travel-styles/index.jssrc/blocks/tagline/index.jssrc/blocks/single-supplement-wrapper/index.jssrc/blocks/price/index.jssrc/blocks/duration/index.js
🧬 Code graph analysis (5)
src/blocks/travel-styles/index.js (2)
src/js/conditional-block-registration.js (2)
wp(32-32)registerForPostTypesAndTemplates(170-177)src/blocks/duration/index.js (1)
conditionalRegister(141-145)
src/blocks/tagline/index.js (2)
src/js/conditional-block-registration.js (1)
registerForPostTypesAndTemplates(170-177)src/blocks/duration/index.js (1)
conditionalRegister(141-145)
src/blocks/single-supplement-wrapper/index.js (5)
src/js/conditional-block-registration.js (2)
wp(32-32)registerForPostTypesAndTemplates(170-177)src/blocks/duration/index.js (1)
conditionalRegister(141-145)src/blocks/price/index.js (1)
conditionalRegister(125-129)src/blocks/tagline/index.js (1)
conditionalRegister(57-61)src/blocks/travel-styles/index.js (1)
conditionalRegister(109-113)
src/blocks/price/index.js (1)
src/js/conditional-block-registration.js (2)
wp(32-32)registerForPostTypesAndTemplates(170-177)
src/blocks/duration/index.js (5)
src/js/conditional-block-registration.js (2)
wp(32-32)registerForPostTypesAndTemplates(170-177)src/blocks/price/index.js (1)
conditionalRegister(125-129)src/blocks/single-supplement-wrapper/index.js (1)
conditionalRegister(121-125)src/blocks/tagline/index.js (1)
conditionalRegister(57-61)src/blocks/travel-styles/index.js (1)
conditionalRegister(109-113)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: review
- GitHub Check: Summary
| isActive: (blockAttributes, variationAttributes) => { | ||
| return blockAttributes.metadata?.className === variationAttributes.metadata?.className; | ||
| }, |
There was a problem hiding this comment.
Fix the isActive comparator to match the correct attribute path.
The variation defines className at attributes.className (line 28), not metadata.className. The current comparison will always fail because variationAttributes.metadata?.className is undefined.
Apply this diff:
isActive: (blockAttributes, variationAttributes) => {
- return blockAttributes.metadata?.className === variationAttributes.metadata?.className;
+ return blockAttributes.className === variationAttributes.attributes?.className;
},🤖 Prompt for AI Agents
In src/blocks/duration/index.js around lines 21 to 23, the isActive comparator
is checking variationAttributes.metadata?.className but the variation defines
className under variationAttributes.attributes.className; change the comparator
to compare blockAttributes.metadata?.className ===
variationAttributes.attributes?.className (use optional chaining for safety:
variationAttributes?.attributes?.className) so the comparison uses the correct
attribute path.
| isActive: (blockAttributes, variationAttributes) => { | ||
| return blockAttributes.metadata?.className === variationAttributes.metadata?.className; | ||
| }, |
There was a problem hiding this comment.
Fix the isActive comparator to match the correct attribute path.
The variation defines className at attributes.className (line 32), not metadata.className. The current comparison will always fail.
Apply this diff:
isActive: (blockAttributes, variationAttributes) => {
- return blockAttributes.metadata?.className === variationAttributes.metadata?.className;
+ return blockAttributes.className === variationAttributes.attributes?.className;
},🤖 Prompt for AI Agents
In src/blocks/price/index.js around lines 20-22, the isActive comparator is
comparing variationAttributes.metadata.className but the variation actually
defines className at variationAttributes.attributes.className; update the
comparator so it compares the same paths (e.g.,
blockAttributes.metadata?.className ===
variationAttributes.attributes?.className) to correctly detect active
variations.
| isActive: (blockAttributes, variationAttributes) => { | ||
| return blockAttributes.metadata?.className === variationAttributes.metadata?.className; | ||
| }, |
There was a problem hiding this comment.
Fix the isActive comparator to match the correct attribute path.
The variation defines className at attributes.className (line 27), not metadata.className. The current comparison will always fail because variationAttributes.metadata?.className is undefined.
Apply this diff to fix the comparator:
isActive: (blockAttributes, variationAttributes) => {
- return blockAttributes.metadata?.className === variationAttributes.metadata?.className;
+ return blockAttributes.className === variationAttributes.attributes?.className;
},🤖 Prompt for AI Agents
In src/blocks/travel-styles/index.js around lines 20 to 22, the isActive
comparator is checking metadata.className on both sides but the variation stores
className under attributes.className; update the comparator to compare
blockAttributes.attributes?.className ===
variationAttributes.attributes?.className instead of metadata paths so the check
correctly matches the defined attribute path.
There was a problem hiding this comment.
Files selected (11)
- src/blocks/booking-validity/index.js (1)
- src/blocks/departs-from/index.js (1)
- src/blocks/duration/index.js (1)
- src/blocks/ends-in/index.js (1)
- src/blocks/group-size/index.js (1)
- src/blocks/included/index.js (1)
- src/blocks/not-included/index.js (1)
- src/blocks/price/index.js (1)
- src/blocks/single-supplement-wrapper/index.js (1)
- src/blocks/tagline/index.js (1)
- src/blocks/travel-styles/index.js (1)
Files not summarized due to errors (11)
- src/blocks/group-size/index.js (nothing obtained from openai)
- src/blocks/included/index.js (nothing obtained from openai)
- src/blocks/departs-from/index.js (nothing obtained from openai)
- src/blocks/ends-in/index.js (nothing obtained from openai)
- src/blocks/booking-validity/index.js (nothing obtained from openai)
- src/blocks/duration/index.js (nothing obtained from openai)
- src/blocks/single-supplement-wrapper/index.js (nothing obtained from openai)
- src/blocks/tagline/index.js (nothing obtained from openai)
- src/blocks/not-included/index.js (nothing obtained from openai)
- src/blocks/travel-styles/index.js (nothing obtained from openai)
- src/blocks/price/index.js (nothing obtained from openai)
Files not reviewed due to errors (11)
- src/blocks/duration/index.js (no response)
- src/blocks/included/index.js (no response)
- src/blocks/ends-in/index.js (no response)
- src/blocks/booking-validity/index.js (no response)
- src/blocks/departs-from/index.js (no response)
- src/blocks/group-size/index.js (no response)
- src/blocks/not-included/index.js (no response)
- src/blocks/travel-styles/index.js (no response)
- src/blocks/single-supplement-wrapper/index.js (no response)
- src/blocks/tagline/index.js (no response)
- src/blocks/price/index.js (no response)
Review comments generated (0)
- Review: 0
- LGTM: 0
Tips
Chat with
CodeRabbit Bot (@coderabbitai)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitaiin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignoreanywhere in the PR description to pause further reviews from the bot.

pr: '#691'
related_issues: '#690'
blocks:
post_types:
author: '@tibibuzdu'
labels: ['enhancement', 'blocks', 'frontend']
Summary
This PR implements GitHub issue #690 by enhancing tour-related blocks with comprehensive Block API v3 metadata standardization, centralized icon integration, and conditional registration logic. The changes focus on tour-specific blocks (travel styles, duration, supplement information, pricing, and taglines) while ensuring consistent user experience and proper Block Editor integration.
The conditional registration logic was extracted into a separate js file for a better developer experience and easier maintainability.
Key Changes
• Block API v3 Compliance: Enhanced metadata with comprehensive descriptions, keywords, and examples
• Icon System Integration: Replaced hardcoded icons with centralized
lsx-tour-operator/iconssystem• Conditional Registration: Implemented tour-context awareness for appropriate block visibility
• Enhanced Block Metadata: Added detailed descriptions, keywords, and comprehensive example configurations
• Improved User Experience: Applied consistent formatting and proper localization throughout
• Code Standardization: Refactored registration logic with better error handling and readiness checks
Files Modified
src/blocks/travel-styles/block.json- Enhanced with full API v3 metadata and comprehensive supportssrc/blocks/travel-styles/index.js- Improved with conditional registration and icon integrationsrc/blocks/duration/block.json- Standardized metadata with enhanced descriptions and examplessrc/blocks/duration/index.js- Added conditional registration and icon system integrationsrc/blocks/single-supplement-wrapper/block.json- Comprehensive metadata with supports object and keywordssrc/blocks/single-supplement-wrapper/index.js- Enhanced registration with tour-context detectionsrc/blocks/price/block.json- API v3 compliance with detailed example configurationssrc/blocks/price/index.js- Improved with centralized icon system and meta bindingsrc/blocks/tagline/block.json- Enhanced metadata and comprehensive supportssrc/blocks/tagline/index.js- Standardized with icon integration and improved layoutScope
✅ PHP
✅ JS/Blocks
block.jsonupdates with descriptions and keywords✅ Styles
⏳ Tests
✅ Docs
Technical Implementation
Enhanced Block Metadata Structure
{ "apiVersion": 3, "description": "Displays the travel styles for the tour, showing the type of tour experience offered.", "keywords": ["travel", "styles", "tour", "type", "category", "experience"], "example": { "attributes": { /* Comprehensive example data */ } } }Icon System Integration
Conditional Registration Logic
Meta Binding Implementation
Testing Notes
Related Issues
Closes #690
Summary by CodeRabbit
New Features
Refactor
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores