Skip to content

Enhance review and cross-reference blocks with comprehensive metadata and conditional registration#764

Merged
krugazul merged 12 commits into2.1-trunkfrom
refactor/694-review-tour-acc-blocks-meta-icons
Nov 18, 2025
Merged

Enhance review and cross-reference blocks with comprehensive metadata and conditional registration#764
krugazul merged 12 commits into2.1-trunkfrom
refactor/694-review-tour-acc-blocks-meta-icons

Conversation

@tibiii
Copy link
Copy Markdown
Contributor

@tibiii tibiii commented Nov 13, 2025


pr: '#694'
blocks:

  • review-related-accommodation
  • review-related-destination
  • review-related-tour
  • tour-related-accommodation
  • tour-related-destination
  • tour-related-tour
  • accommodation-related-tour
  • accommodation-related-destination
  • accommodation-related-accommodation
    post_types:
  • review
  • tour
  • accommodation
  • destination
    author: '@tibibuzdu'
    labels: ['enhancement', 'blocks', 'frontend']

Summary

This PR implements GitHub issue #694 by enhancing review system and cross-referencing blocks with comprehensive Block API v3 metadata standardization, centralized icon integration, and conditional registration logic. The changes focus on relationship blocks (review-related and cross-reference blocks) while ensuring consistent user experience and proper Block Editor integration.

The conditional registration logic utilizes the reusable utility module introduced in PR #697 for better developer experience and easier maintainability across the codebase.

Key Changes

Block API v3 Compliance: Enhanced metadata with comprehensive descriptions, keywords, and examples
Icon System Integration: Replaced hardcoded icons with appropriate Dashicons for consistent visual presentation
Conditional Registration: Implemented context-awareness for appropriate block visibility based on post types
Enhanced Block Metadata: Added detailed descriptions, keywords, and comprehensive example configurations
Improved User Experience: Applied consistent formatting and proper localization throughout
Cross-Reference System: Improved relationship handling between tours, accommodations, destinations, and reviews
Reusable Utilities: Leveraged shared conditional registration system for better maintainability

Files Modified

Scope

✅ PHP

  • No PHP backend changes required for this enhancement

✅ JS/Blocks

  • Block API v3 metadata compliance for all review and cross-reference blocks
  • Comprehensive block.json updates with descriptions and keywords
  • Conditional registration for appropriate post type contexts
  • Icon standardization using appropriate Dashicons
  • Enhanced example configurations for editor previews
  • Proper localization with text domains
  • Reusable conditional registration utility integration

✅ Styles

  • Maintained visual consistency across blocks
  • Supports theme customization through Block Editor
  • Consistent icon usage for related content types

⏳ Tests

  • Block registration tests (future enhancement)
  • Cross-reference relationship validation (future enhancement)

✅ Docs

  • Enhanced block descriptions for user guidance
  • Comprehensive examples in block.json files
  • Improved keywords for block discovery
  • Cross-reference system documentation

Technical Implementation

Enhanced Block Metadata Structure

{
  "apiVersion": 3,
  "description": "Display reviews related to accommodation posts.",
  "keywords": ["reviews", "accommodation", "related", "testimonials"],
  "example": {
    "attributes": {
      "metadata": { "name": "Related Reviews - Accommodation" }
    },
    "innerBlocks": [/* Comprehensive example data */]
  }
}

Conditional Registration System

// Import and use the reusable utility
import { registerForPostTypes } from '@utils/conditional-block-registration.js';

// Register block conditionally for specific post type context
const conditionalRegister = registerForPostTypes(
  ['accommodation'], // Post types
  registerReviewRelatedAccommodationVariation // Registration function
);

wp.domReady(conditionalRegister);

Cross-Reference Block Structure

wp.blocks.registerBlockVariation('core/group', {
  name: 'lsx-tour-operator/review-related-accommodation',
  title: __('Related Reviews - Accommodation', 'tour-operator'),
  description: __('Display reviews related to accommodation posts.', 'tour-operator'),
  icon: 'admin-multisite',
  category: 'lsx-tour-operator',
  keywords: [
    __('reviews', 'tour-operator'),
    __('accommodation', 'tour-operator'),
    __('related', 'tour-operator'),
    __('testimonials', 'tour-operator'),
  ],
  // ... enhanced attributes and innerBlocks configuration
});

Testing Notes

  • All review and cross-reference blocks now register conditionally based on appropriate post type contexts
  • Icon standardization maintains visual consistency across the block library
  • Enhanced descriptions improve block discoverability in the inserter
  • Block metadata follows WordPress Block API v3 standards
  • Localization properly implemented throughout all blocks
  • Conditional registration utility provides consistent pattern across all relationship blocks
  • Examples provide clear usage guidance for content creators
  • Cross-reference relationships properly configured for tour operator workflow

Related Issues

Closes #694

Block Relationships Enhanced

Review System Blocks

  • review-related-accommodation: Shows reviews for accommodations (appears on accommodation posts)
  • review-related-destination: Shows reviews for destinations (appears on destination posts)
  • review-related-tour: Shows reviews for tours (appears on tour posts)

Cross-Reference Blocks

  • tour-related-accommodation: Shows tours related to accommodations (appears on accommodation posts)
  • tour-related-destination: Shows tours related to destinations (appears on destination posts)
  • accommodation-related-tour: Shows accommodations related to tours (appears on tour posts)

Summary by CodeRabbit

  • New Features

    • Enhanced Review Related Accommodation, Destination, and Tour blocks with richer metadata (descriptions, icons, keywords, examples)
    • Enhanced Tour Related Accommodation and Destination blocks with comprehensive metadata
    • Enhanced Accommodation Related Tour block with proper cross-reference functionality
    • Added conditional registration to show blocks only in relevant post type contexts
    • Integrated appropriate Dashicon system for consistent visual presentation
    • Implemented comprehensive example configurations for better editor previews
    • Leveraged reusable conditional registration utility system for maintainability
  • Refactor

    • Improved block registration logic with context-aware conditional display
    • Standardized block metadata following Block API v3 specifications
    • Enhanced localization support throughout all relationship blocks
    • Utilized conditional registration logic from shared utility module
    • Updated cross-reference patterns to use appropriate card templates
  • Documentation

    • Enhanced block descriptions and examples for improved user experience
    • Clear cross-reference relationship mapping for tour operator workflow
    • Consistent implementation patterns for relationship block development

Summary by CodeRabbit

Release Notes

  • New Features

    • Added comprehensive metadata and visual examples for six relationship blocks (Review Related Accommodation/Destination/Tour, Tour Related Accommodation/Destination, Accommodation Related Tour).
    • Introduced context-aware conditional registration for appropriate post type visibility.
    • Enhanced cross-reference system for better tour operator workflow integration.
  • Documentation

    • Enhanced block descriptions, keywords, and editor icons for improved discoverability.
    • Added example block layouts demonstrating typical cross-reference block usage within the editor.
    • Improved relationship mapping between tours, accommodations, destinations, and reviews.

Summary by CodeRabbit

  • New Features

    • Related-content blocks now use dynamic queries and reusable card patterns to display accommodations, tours and reviews in responsive 3-column grids with richer preview examples.
  • Improvements

    • Variations register conditionally for relevant post types/templates; titles, descriptions, icons, keywords and editor strings are i18n-ready.
    • Default query perPage set to 6; headings centred and layout separators refined for clearer editor previews.

- Enhanced the index.js files for each block to register variations conditionally based on post types.
- Improved localization by wrapping strings with __() for translation readiness.
- Changed the order of queries in review-related blocks to descending for more recent reviews.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 13, 2025

Caution

Review failed

The pull request is closed.

Warning

CodeRabbit GitHub Action detected

The 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) detected

CodeRabbit 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

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'commands', 'linked_issues', 'plugin_context'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • 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

Walkthrough

Block manifests were enriched with public metadata, examples and i18n-ready strings; index.js modules were refactored from immediate wp.domReady registration to named registerXVariation functions and conditional, post-type–aware registration (registerForPostTypes / variants), added isActive predicates, and converted static templates to query/pattern-driven Query Loops.

Changes

Cohort / File(s) Summary
Accommodation-related - Tour
src/blocks/accommodation-related-tour/block.json, src/blocks/accommodation-related-tour/index.js
Manifest updated (title → "Related Accommodations", description, icon, keywords, example). Example restructured to wide/constrained groups and a core/query for postType:"accommodation" (perPage:6, orderBy:title, order:asc). Inner content now core/post-template using pattern lsx-tour-operator/accommodation-card in a 3-column grid. index.js refactored to registerAccommodationRelatedTourVariation, conditional registration for tour, isActive added.
Accommodation-related - Accommodation / Destination
src/blocks/accommodation-related-accommodation/block.json, src/blocks/accommodation-related-accommodation/index.js, src/blocks/accommodation-related-destination/block.json, src/blocks/accommodation-related-destination/index.js
Titles/metadata and examples adjusted; icons/keywords tweaked. index.js modules moved to named register functions, use registerForPostTypes / templates for conditional registration (accommodation/destination), inner templates converted to query+pattern grids, isActive added, className/layout normalized.
Review-related (Accommodation / Destination / Tour)
src/blocks/review-related-accommodation/block.json, src/blocks/review-related-accommodation/index.js, src/blocks/review-related-destination/block.json, src/blocks/review-related-destination/index.js, src/blocks/review-related-tour/block.json, src/blocks/review-related-tour/index.js
Manifests enriched (textdomain, description, icon, keywords, examples). index.js files refactored to register...Variation functions, import registerForPostTypes, conditional registration per post type, i18n applied, isActive added, query ordering adjusted (often desc), pattern slugs changed to review-card.
Tour-related (Accommodation / Destination / Tour)
src/blocks/tour-related-accommodation/block.json, src/blocks/tour-related-accommodation/index.js, src/blocks/tour-related-destination/block.json, src/blocks/tour-related-destination/index.js, src/blocks/tour-related-tour/block.json, src/blocks/tour-related-tour/index.js
Manifests augmented (textdomain/description/icon/keywords/examples). index.js files switched to named register functions, conditional post-type registration via registerForPostTypes, i18n applied, query defaults adjusted (perPage:6, orderBy:title), pattern slugs updated to tour-card, and isActive added.
Cross-cutting / utilities
@utils/conditional-block-registration.js (import usage across index.js)
Multiple index.js files now import and use conditional registration helpers (registerForPostTypes, registerForPostTypesAndTemplates) to gate variation registration by post type/template and defer invocation to wp.domReady.

Sequence Diagram(s)

sequenceDiagram
    participant Editor as Block Editor
    participant DOM as wp.domReady
    participant Helper as registerForPostTypes(/Templates)
    participant Blocks as wp.blocks

    rect rgb(245,250,255)
    Note over Helper,Blocks: Conditional, post-type/template-aware variation registration
    DOM->>Helper: call conditionalRegister()
    Helper->>Helper: detect current post type / template
    alt match found
        Helper->>Blocks: registerBlockVariation(variation with isActive)
        Blocks->>Editor: variation appears in inserter/context
    else no match
        Helper-->>Blocks: skip registration
        Blocks->>Editor: variation not available
    end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas requiring extra attention:
    • Correct postType/template lists passed into registerForPostTypes / registerForPostTypesAndTemplates.
    • Consistency between block.json textdomain and i18n __() usage in index.js.
    • Query block attributes (perPage, order, orderBy, postType) and alignment with desired behavior.
    • Validity and availability of referenced pattern slugs (accommodation-card, review-card, tour-card).
    • Block.json example structures conform to Block API v3 schema.

Possibly related issues

  • #694 — Block audit for review/relationship blocks; these changes implement many of that audit’s metadata, example and conditional-registration recommendations.
  • #583 — Standardisation of block.json metadata and variation registration; this PR applies the same standardisation pattern.
  • #695 — Overlap on tour↔accommodation Query Loop and conditional availability; this PR updates those query/patterns and gating.

Possibly related PRs

  • PR #696 — Introduces the conditional-block-registration utility and @utils alias used by many changed index.js files (strong code-level link).
  • PR #763 — Performs the same conditional registerForPostTypes refactor and manifest enrichments across block variations (overlapping edits).
  • PR #667 — Related standardisation of block.json metadata, example scaffolding and conditional registration flow.

Suggested labels

comp:block-variations, comp:block-json, comp:block-editor, Tour Operator

Suggested reviewers

  • ZaredRogers

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main changes: enhancement of review and cross-reference blocks with comprehensive metadata and conditional registration.
Description check ✅ Passed The PR description is comprehensive and covers objectives, key changes, technical implementation, testing, and block relationships. However, it deviates from the repository template structure and lacks explicit Test Notes checklist items and Risk & Rollback sections.
Linked Issues check ✅ Passed The PR substantially addresses the coding requirements in issue #694 by implementing Block API v3 metadata compliance, conditional registration using shared utilities, icon standardization, and comprehensive examples for nine relationship blocks across reviews, tours, accommodations, and destinations.
Out of Scope Changes check ✅ Passed All code changes remain focused on the scope defined in issue #694: JavaScript/block enhancements, block.json metadata standardization, icon integration, conditional registration, and localization. No extraneous backend changes or unrelated modifications are present.
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

📥 Commits

Reviewing files that changed from the base of the PR and between f2ed1a5 and 9352068.

⛔ Files ignored due to path filters (1)
  • build/blocks/accommodation-related-destination/index.js is excluded by !build/**
📒 Files selected for processing (1)
  • src/blocks/accommodation-related-destination/index.js (4 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.

❤️ Share

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

@github-actions github-actions bot added status:needs-review Awaiting code review meta:needs-changelog Requires a changelog entry before merge labels Nov 13, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 13, 2025

Image description CodeRabbit


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If 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.

@github-actions github-actions bot added status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Nov 13, 2025
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between b8b9598 and b48d302 commits.
Files selected (6)
  • src/blocks/accommodation-related-tour/index.js (11)
  • src/blocks/review-related-accommodation/index.js (6)
  • src/blocks/review-related-destination/index.js (6)
  • src/blocks/review-related-tour/index.js (5)
  • src/blocks/tour-related-accommodation/index.js (6)
  • src/blocks/tour-related-destination/index.js (6)
Files ignored due to filter (12)
  • build/blocks/accommodation-related-tour/block.json
  • build/blocks/review-related-accommodation/block.json
  • build/blocks/review-related-destination/block.json
  • build/blocks/review-related-tour/block.json
  • build/blocks/tour-related-accommodation/block.json
  • build/blocks/tour-related-destination/block.json
  • src/blocks/accommodation-related-tour/block.json
  • src/blocks/review-related-accommodation/block.json
  • src/blocks/review-related-destination/block.json
  • src/blocks/review-related-tour/block.json
  • src/blocks/tour-related-accommodation/block.json
  • src/blocks/tour-related-destination/block.json
Files not summarized due to errors (6)
  • src/blocks/accommodation-related-tour/index.js (diff tokens exceeds limit)
  • src/blocks/tour-related-accommodation/index.js (nothing obtained from openai)
  • src/blocks/review-related-destination/index.js (nothing obtained from openai)
  • src/blocks/tour-related-destination/index.js (nothing obtained from openai)
  • src/blocks/review-related-accommodation/index.js (nothing obtained from openai)
  • src/blocks/review-related-tour/index.js (nothing obtained from openai)
Files not reviewed due to errors (6)
  • src/blocks/tour-related-destination/index.js (no response)
  • src/blocks/accommodation-related-tour/index.js (no response)
  • src/blocks/review-related-accommodation/index.js (no response)
  • src/blocks/review-related-tour/index.js (no response)
  • src/blocks/review-related-destination/index.js (no response)
  • src/blocks/tour-related-accommodation/index.js (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description 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 @coderabbitai in 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: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link
Copy Markdown
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: 5

🧹 Nitpick comments (7)
src/blocks/tour-related-destination/block.json (1)

18-22: Standardise example metadata name. The example metadata still carries the old plural label, so previews will surface wording that no longer matches the block title. Please align the example name with the new singular title to keep localisation tidy.

-        "name": "Related Tours - Destinations"
+        "name": "Related Tours - Destination"
src/blocks/review-related-destination/index.js (2)

1-11: Add @SInCE tags to JSDoc blocks. Both JSDoc headers are missing the required @SInCE annotation, which our coding guidelines mandate for new block code. Please add the correct version reference to each block comment.


118-118: Finish the inline comment with a period. The line comment should end with a full stop to satisfy the documented commenting rules.

src/blocks/review-related-accommodation/index.js (2)

1-11: Add @SInCE tags to JSDoc blocks. Please include the mandated @SInCE annotation in both JSDoc headers so the documentation aligns with our standards.


117-117: Add the missing full stop to the comment. The inline comment should conclude with a period to stay consistent with our commenting rules.

src/blocks/review-related-destination/block.json (1)

9-9: Correct the description grammar. The description should read “Displays …” to remain grammatical and consistent with the other blocks’ copy.

-  "description": "Display reviews related to destination posts.",
+  "description": "Displays reviews related to destination posts.",
src/blocks/accommodation-related-tour/index.js (1)

114-208: Align the example content with accommodations.

The inserter example still speaks about tours (“Related tours”, tour itineraries). Because this block surfaces accommodations, the preview should showcase accommodation-focused copy to avoid confusing editors. Consider updating the labels and sample cards, e.g.:

-               metadata: {
-                   name: __('Related tours', 'tour-operator'),
+               metadata: {
+                   name: __('Related accommodations', 'tour-operator'),
...
-                               content: __('Related tours', 'tour-operator'),
+                               content: __('Related accommodations', 'tour-operator'),
...
-                                       ['core/heading', { content: __('African Safari Adventure', 'tour-operator'), level: 3 }],
-                                       ['core/paragraph', { content: __("Embark on an unforgettable 7-day safari experience through Kenya's most spectacular wildlife reserves.", 'tour-operator') }],
+                                       ['core/heading', { content: __('Savanna View Lodge', 'tour-operator'), level: 3 }],
+                                       ['core/paragraph', { content: __('Experience luxury suites overlooking the Mara savanna with guided wildlife excursions included.', 'tour-operator') }],

…and update the remaining cards similarly to describe accommodations.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8b9598 and b48d302.

⛔ Files ignored due to path filters (18)
  • build/blocks/accommodation-related-tour/block.json is excluded by !build/**
  • build/blocks/accommodation-related-tour/index.asset.php is excluded by !build/**
  • build/blocks/accommodation-related-tour/index.js is excluded by !build/**
  • build/blocks/review-related-accommodation/block.json is excluded by !build/**
  • build/blocks/review-related-accommodation/index.asset.php is excluded by !build/**
  • build/blocks/review-related-accommodation/index.js is excluded by !build/**
  • build/blocks/review-related-destination/block.json is excluded by !build/**
  • build/blocks/review-related-destination/index.asset.php is excluded by !build/**
  • build/blocks/review-related-destination/index.js is excluded by !build/**
  • build/blocks/review-related-tour/block.json is excluded by !build/**
  • build/blocks/review-related-tour/index.asset.php is excluded by !build/**
  • build/blocks/review-related-tour/index.js is excluded by !build/**
  • build/blocks/tour-related-accommodation/block.json is excluded by !build/**
  • build/blocks/tour-related-accommodation/index.asset.php is excluded by !build/**
  • build/blocks/tour-related-accommodation/index.js is excluded by !build/**
  • build/blocks/tour-related-destination/block.json is excluded by !build/**
  • build/blocks/tour-related-destination/index.asset.php is excluded by !build/**
  • build/blocks/tour-related-destination/index.js is excluded by !build/**
📒 Files selected for processing (12)
  • src/blocks/accommodation-related-tour/block.json (1 hunks)
  • src/blocks/accommodation-related-tour/index.js (11 hunks)
  • src/blocks/review-related-accommodation/block.json (1 hunks)
  • src/blocks/review-related-accommodation/index.js (6 hunks)
  • src/blocks/review-related-destination/block.json (1 hunks)
  • src/blocks/review-related-destination/index.js (6 hunks)
  • src/blocks/review-related-tour/block.json (1 hunks)
  • src/blocks/review-related-tour/index.js (5 hunks)
  • src/blocks/tour-related-accommodation/block.json (1 hunks)
  • src/blocks/tour-related-accommodation/index.js (6 hunks)
  • src/blocks/tour-related-destination/block.json (1 hunks)
  • src/blocks/tour-related-destination/index.js (6 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,mjs,ts,tsx}

📄 CodeRabbit inference engine (.github/instructions/performance.instructions.md)

Defer non-critical JavaScript and avoid synchronous blocking operations

Files:

  • src/blocks/accommodation-related-tour/index.js
  • src/blocks/review-related-tour/index.js
  • src/blocks/review-related-accommodation/index.js
  • src/blocks/review-related-destination/index.js
  • src/blocks/tour-related-accommodation/index.js
  • src/blocks/tour-related-destination/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/accommodation-related-tour/index.js
  • src/blocks/review-related-tour/index.js
  • src/blocks/review-related-accommodation/index.js
  • src/blocks/review-related-destination/index.js
  • src/blocks/tour-related-accommodation/index.js
  • src/blocks/tour-related-destination/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/accommodation-related-tour/index.js
  • src/blocks/review-related-tour/index.js
  • src/blocks/review-related-accommodation/index.js
  • src/blocks/review-related-destination/index.js
  • src/blocks/tour-related-accommodation/index.js
  • src/blocks/tour-related-destination/index.js
🧬 Code graph analysis (6)
src/blocks/accommodation-related-tour/index.js (2)
src/blocks/review-related-tour/index.js (1)
  • conditionalRegister (118-121)
src/js/conditional-block-registration.js (1)
  • registerForPostTypes (135-141)
src/blocks/review-related-tour/index.js (3)
src/blocks/accommodation-related-tour/index.js (1)
  • conditionalRegister (213-216)
src/blocks/review-related-accommodation/index.js (1)
  • conditionalRegister (118-121)
src/js/conditional-block-registration.js (1)
  • registerForPostTypes (135-141)
src/blocks/review-related-accommodation/index.js (3)
src/blocks/accommodation-related-tour/index.js (1)
  • conditionalRegister (213-216)
src/blocks/review-related-tour/index.js (1)
  • conditionalRegister (118-121)
src/js/conditional-block-registration.js (1)
  • registerForPostTypes (135-141)
src/blocks/review-related-destination/index.js (3)
src/blocks/review-related-tour/index.js (2)
  • wp (6-6)
  • conditionalRegister (118-121)
src/blocks/tour-related-destination/index.js (2)
  • wp (6-6)
  • conditionalRegister (118-121)
src/js/conditional-block-registration.js (1)
  • registerForPostTypes (135-141)
src/blocks/tour-related-accommodation/index.js (2)
src/blocks/accommodation-related-tour/index.js (1)
  • conditionalRegister (213-216)
src/js/conditional-block-registration.js (1)
  • registerForPostTypes (135-141)
src/blocks/tour-related-destination/index.js (3)
src/blocks/accommodation-related-tour/index.js (1)
  • conditionalRegister (213-216)
src/blocks/review-related-destination/index.js (1)
  • conditionalRegister (119-122)
src/js/conditional-block-registration.js (1)
  • registerForPostTypes (135-141)
⏰ 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

@tibiii tibiii added this to the v2.1.0 milestone Nov 13, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Tour Operator Nov 13, 2025
@tibiii tibiii moved this from Needs Triage to 🔎 In Review in Tour Operator Nov 13, 2025
@tibiii tibiii self-assigned this Nov 13, 2025
@tibiii tibiii requested a review from Copilot November 13, 2025 16:29
@github-project-automation github-project-automation bot moved this from 🔎 In Review to Needs Triage in Tour Operator Nov 13, 2025
@github-actions github-actions bot added status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Nov 13, 2025
@github-actions github-actions bot added status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Nov 13, 2025
Copy link
Copy Markdown
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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b48d302 and ca7e7ca.

⛔ Files ignored due to path filters (1)
  • build/blocks/review-related-accommodation/block.json is excluded by !build/**
📒 Files selected for processing (1)
  • src/blocks/review-related-accommodation/block.json (1 hunks)
⏰ 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: Agent
  • GitHub Check: Summary
🔇 Additional comments (2)
src/blocks/review-related-accommodation/block.json (2)

9-9: ✓ Past issue resolved: description typo fixed.

The double full stop (..) from the previous review has been corrected to a single period. The description reads cleanly now.


10-10: Verify icon semantic alignment.

The icon is set to "admin-multisite" (globe/network), which typically represents multi-site relationships or network concepts. For a reviews/testimonials block, an icon like "star", "comment", or "format-quote" may be more semantically appropriate and user-friendly in the inserter UI.

Confirm whether this icon choice is intentional (e.g., part of a centralised icon strategy across related blocks in this PR), or consider adjusting it for better UX clarity.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR successfully enhances six relationship blocks (review-related and cross-reference blocks) with comprehensive Block API v3 metadata, proper icon integration, and conditional registration logic. The changes improve block discoverability, user experience, and maintainability by standardizing metadata, adding descriptive keywords, and implementing context-aware block registration using a shared utility.

Key improvements:

  • Enhanced block metadata with descriptions, keywords, and comprehensive examples
  • Implemented conditional registration for appropriate post type contexts
  • Corrected pattern slug references (changed from destination-card to appropriate review-card, tour-card, and accommodation-card)
  • Added proper localization throughout all blocks
  • Integrated Dashicons for consistent visual presentation

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/blocks/review-related-accommodation/block.json Added Block API v3 metadata with description, keywords, icon, and example configuration
src/blocks/review-related-accommodation/index.js Implemented conditional registration for accommodation posts with proper localization
src/blocks/review-related-destination/block.json Enhanced with comprehensive metadata and example structure for destination reviews
src/blocks/review-related-destination/index.js Added context-aware registration for destination posts with corrected pattern slug
src/blocks/review-related-tour/block.json Standardized metadata with icon, keywords, and detailed example configuration
src/blocks/review-related-tour/index.js Implemented conditional registration for tour posts with proper pattern reference
src/blocks/tour-related-accommodation/block.json Added comprehensive metadata for accommodation-related tours cross-reference
src/blocks/tour-related-accommodation/index.js Enhanced with conditional registration and corrected tour-card pattern slug
src/blocks/tour-related-destination/block.json Standardized with Block API v3 metadata and example structure
src/blocks/tour-related-destination/index.js Implemented destination context registration with proper pattern reference
src/blocks/accommodation-related-tour/block.json Updated metadata, icon, keywords, and restructured example configuration
src/blocks/accommodation-related-tour/index.js Added conditional registration for tour posts with accommodation-card pattern
build/blocks/* Compiled versions of all source changes with updated asset hashes

@tibiii tibiii marked this pull request as draft November 13, 2025 16:49
Copy link
Copy Markdown
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: 2

♻️ Duplicate comments (2)
src/blocks/review-related-tour/index.js (1)

1-3: Add @since metadata and tidy up comment punctuation.

Both JSDoc blocks at the top of the file and above registerReviewRelatedTourVariation are missing the required @since tag, and the summary lines (as well as the inline comment at Line 266) do not end with a full stop. Project guidelines call for every JSDoc to include @since <next-plugin-version> and for line comments to end with a period. Please add an appropriate @since tag to both docblocks and update the comment text to end in full stops. As per coding guidelines.

Also applies to: 8-10, 266-270

src/blocks/tour-related-destination/index.js (1)

1-10: Add @since tags to both JSDoc comments.

The file‑level and function‑level docblocks are still missing the required @since annotation. Please add an appropriate version (for example @since 2.1.0, or whatever version this will ship in) to both comments to comply with the project’s JSDoc / WordPress documentation rules.

🧹 Nitpick comments (1)
src/blocks/review-related-tour/index.js (1)

4-6: Consider importing __ from @wordpress/i18n instead of using the global.

Using const { __ } = wp.i18n; relies on the global wp object; modern WordPress block code typically imports from @wordpress/i18n and declares wp-i18n as a script dependency instead. If the build setup allows, consider:

-import { registerForPostTypes } from '@utils/conditional-block-registration.js';
-
-const { __ } = wp.i18n;
+import { __ } from '@wordpress/i18n';
+import { registerForPostTypes } from '@utils/conditional-block-registration.js';

to better align with @wordpress/scripts patterns.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b91deb and 12cb60c.

⛔ Files ignored due to path filters (4)
  • build/blocks/review-related-tour/index.asset.php is excluded by !build/**
  • build/blocks/review-related-tour/index.js is excluded by !build/**
  • build/blocks/tour-related-destination/index.asset.php is excluded by !build/**
  • build/blocks/tour-related-destination/index.js is excluded by !build/**
📒 Files selected for processing (2)
  • src/blocks/review-related-tour/index.js (5 hunks)
  • src/blocks/tour-related-destination/index.js (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,ts,tsx,jsx}

⚙️ CodeRabbit configuration file

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

  • Review the code to ensure it is well-structured and adheres to best practices.
  • Verify compliance with WordPress coding standards 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/review-related-tour/index.js
  • src/blocks/tour-related-destination/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/review-related-tour/index.js
  • src/blocks/tour-related-destination/index.js
🧬 Code graph analysis (2)
src/blocks/review-related-tour/index.js (2)
src/blocks/tour-related-destination/index.js (1)
  • conditionalRegister (390-393)
src/js/conditional-block-registration.js (1)
  • registerForPostTypes (135-141)
src/blocks/tour-related-destination/index.js (2)
src/blocks/accommodation-related-destination/index.js (1)
  • conditionalRegister (396-399)
src/js/conditional-block-registration.js (1)
  • registerForPostTypes (135-141)
⏰ 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 (5)
src/blocks/review-related-tour/index.js (1)

111-161: Example structure and tour-specific className look solid.

The example layout mirrors the registered variation nicely and the className: 'lsx-review-related-tour-query' on the example group now correctly matches the tour variant, which should keep selector‑based styling and previews consistent.

src/blocks/tour-related-destination/index.js (4)

11-28: Variation registration, metadata, and i18n look solid.

The variation registration for lsx-tour-operator/tour-related-destination is well‑structured: metadata is clear, all user‑facing strings (title, description, metadata name) are wrapped in __() with the correct tour-operator text domain, and the wrapper className/layout attributes are coherent. No functional issues spotted here.


53-57: Query configuration aligns with the “tours for a destination” use‑case.

Targeting postType: 'tour' with perPage: 6, ascending orderBy: 'title', and using the lsx-tour-operator/tour-card pattern inside a three‑column grid is consistent with how a “Related Tours” listing should behave and matches the surrounding block family. This section looks good.

Also applies to: 77-84, 91-101


111-375: Example structure is consistent and uses the correct destination className.

The inserter example is comprehensive, fully localised, and its inner group now correctly uses className: 'lsx-tour-related-destination-query', matching the live variation’s query template. This should give editors an accurate preview without styling surprises.


379-385: isActive matcher is appropriate for this wrapper class.

Using isActive to check for the exact wrapper class and a defensive includes fallback is a reasonable way to detect existing instances of this variation. This should behave reliably when users duplicate or further customise the block.

@tibiii tibiii requested a review from Copilot November 14, 2025 14:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 49 out of 49 changed files in this pull request and generated no new comments.

@tibiii tibiii requested a review from krugazul November 14, 2025 16:40
@tibiii tibiii changed the title Enhance review and cross-reference blocks with comprehensive metadata, icons integration, and conditional registration Enhance review and cross-reference blocks with comprehensive metadata and conditional registration Nov 14, 2025
@github-actions github-actions bot added status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Nov 14, 2025
@tibiii tibiii moved this from Needs Triage to 🔎 In Review in Tour Operator Nov 14, 2025
Copy link
Copy Markdown
Collaborator

@krugazul krugazul left a comment

Choose a reason for hiding this comment

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

@tibiii the blocks are only available in the "edit post" block editor, I cannot see them when editing a single-destination template.

Image Image

@github-project-automation github-project-automation bot moved this from 🔎 In Review to Needs Triage in Tour Operator Nov 18, 2025
@github-actions github-actions bot added status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Nov 18, 2025
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 12cb60c and f2ed1a5 commits.
Files selected (3)
  • src/blocks/accommodation-related-destination/index.js (4)
  • src/blocks/review-related-destination/index.js (6)
  • src/blocks/tour-related-destination/index.js (5)
Files not summarized due to errors (3)
  • src/blocks/accommodation-related-destination/index.js (diff tokens exceeds limit)
  • src/blocks/review-related-destination/index.js (diff tokens exceeds limit)
  • src/blocks/tour-related-destination/index.js (diff tokens exceeds limit)
Files not reviewed due to errors (3)
  • src/blocks/accommodation-related-destination/index.js (no response)
  • src/blocks/review-related-destination/index.js (no response)
  • src/blocks/tour-related-destination/index.js (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description 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 @coderabbitai in 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: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link
Copy Markdown
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

♻️ Duplicate comments (5)
src/blocks/tour-related-destination/index.js (3)

376-378: supports.renaming on a variation will not actually disable renaming.

The supports: { renaming: false } on this registerBlockVariation call does not affect the underlying core/group block’s supports, so it will not prevent renaming in the editor. Renaming behaviour can currently only be controlled at the block type level (e.g. via supports.renaming in block.json), not per variation.

If you do not plan to register a dedicated block type with supports.renaming = false, it is less confusing to remove this property:

-        supports: {
-            renaming: false,
-        },

389-389: Terminate the inline comment with a full stop.

The line comment should end with a period to comply with the project’s commenting convention:

-// Register conditionally for destination post types and destination templates
+// Register conditionally for destination post types and destination templates.

1-10: Add @SInCE tags and full stops to the JSDoc headers.

Both JSDoc-style docblocks are missing the required @since annotation, and the summary lines should end with a full stop to match the project’s documentation rules. Consider something along these lines (adjust the version to the actual release you are targeting):

 /**
- * Register Tour Related Destination block variation
+ * Register Tour Related Destination block variation.
+ *
+ * @since 2.1.0
  */
 
 /**
- * Register the tours related to destination block variation
+ * Register the tours related to destination block variation.
+ *
+ * @since 2.1.0
  */
src/blocks/review-related-destination/index.js (2)

1-3: Add required @since tags and finish sentences in JSDoc.

Both JSDoc-style comments at the top of the file and above registerReviewRelatedDestinationVariation() are missing the required @since tag, and their description lines don’t end with a full stop. Please add an appropriate @since version (the next plugin release, e.g. @since 2.1.0) to each block and end the description lines with a period to match the project’s documentation standard.

Also applies to: 8-10


254-263: supports.renaming on the variation is ignored by the Block Variations API.

The supports: { renaming: false } property on the variation object won’t have any effect: wp.blocks.registerBlockVariation() only recognises documented variation keys (name, title, icon, keywords, attributes, innerBlocks, example, scope, isDefault, isActive, etc.), and supports isn’t among them. (developer.wordpress.org)

If preventing renaming is important, you’ll need to enforce it at the block type level (e.g. via block.json or a block_type_metadata filter) rather than on the variation object. In this variation, I’d suggest removing the supports block to avoid confusion and duplicating that logic where it actually applies.

Does the WordPress Block Variations API support a `supports` key (e.g. `supports.renaming`) on variation objects passed to `wp.blocks.registerBlockVariation`, or is `supports` limited to the block type registration (`registerBlockType` / `block.json`)?
🧹 Nitpick comments (2)
src/blocks/accommodation-related-destination/index.js (2)

51-56: Consider aligning heading text capitalisation for consistency.

The heading content in the live variation is Related accommodations (lowercase “a”), while the example heading uses Related Accommodations (capital “A”). For a slightly more polished editor experience, you might want to standardise these to the same casing in both places.

Also applies to: 114-137


111-113: Remove the unused supports block from the variation definition.

The supports property on a block variation definition is not used by the Block Variations API. The supports property belongs only to block type registration (registerBlockType / block.json), and registerBlockVariation does not apply or override block supports. Dropping the supports block at lines 111-113 will prevent implying behaviour that doesn't occur.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 12cb60c and f2ed1a5.

⛔ Files ignored due to path filters (6)
  • build/blocks/accommodation-related-destination/index.asset.php is excluded by !build/**
  • build/blocks/accommodation-related-destination/index.js is excluded by !build/**
  • build/blocks/review-related-destination/index.asset.php is excluded by !build/**
  • build/blocks/review-related-destination/index.js is excluded by !build/**
  • build/blocks/tour-related-destination/index.asset.php is excluded by !build/**
  • build/blocks/tour-related-destination/index.js is excluded by !build/**
📒 Files selected for processing (3)
  • src/blocks/accommodation-related-destination/index.js (4 hunks)
  • src/blocks/review-related-destination/index.js (6 hunks)
  • src/blocks/tour-related-destination/index.js (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,ts,tsx,jsx}

⚙️ CodeRabbit configuration file

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

  • Review the code to ensure it is well-structured and adheres to best practices.
  • Verify compliance with WordPress coding standards 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/accommodation-related-destination/index.js
  • src/blocks/review-related-destination/index.js
  • src/blocks/tour-related-destination/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/accommodation-related-destination/index.js
  • src/blocks/review-related-destination/index.js
  • src/blocks/tour-related-destination/index.js
🧬 Code graph analysis (3)
src/blocks/accommodation-related-destination/index.js (2)
src/blocks/review-related-destination/index.js (1)
  • conditionalRegister (268-272)
src/js/conditional-block-registration.js (1)
  • registerForPostTypesAndTemplates (170-177)
src/blocks/review-related-destination/index.js (1)
src/js/conditional-block-registration.js (1)
  • registerForPostTypesAndTemplates (170-177)
src/blocks/tour-related-destination/index.js (3)
src/blocks/accommodation-related-destination/index.js (1)
  • conditionalRegister (396-400)
src/blocks/review-related-destination/index.js (1)
  • conditionalRegister (268-272)
src/js/conditional-block-registration.js (1)
  • registerForPostTypesAndTemplates (170-177)
⏰ 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 (7)
src/blocks/tour-related-destination/index.js (3)

11-375: Variation definition, i18n, and example content look good.

The registerTourRelatedDestinationVariation setup is coherent: all user-facing strings (title, description, metadata names, headings, and example copy) are correctly wrapped in __ with the tour-operator text domain, the query configuration for tours is sensible, and the detailed example tree will provide a clear inserter preview of the related-tours grid. No functional issues spotted in this variation definition.


379-385: isActive predicate correctly matches the wrapper class.

The isActive function safely handles missing className and correctly treats the variation as active when the wrapper class either matches exactly or is one of multiple classes. This should behave reliably for both newly inserted and existing blocks.


390-396: Conditional registration setup aligns with other relationship blocks.

Using registerForPostTypesAndTemplates( ['destination'], ['destination', 'country', 'region'], registerTourRelatedDestinationVariation ) and invoking it via wp.domReady(conditionalRegister); mirrors the conditional-registration pattern shown for the other destination-related blocks, so registration should only occur in the intended destination contexts.

src/blocks/review-related-destination/index.js (2)

12-111: Variation definition, i18n, and example structure look solid.

The variation registration, innerBlocks configuration, and rich example data are well put together: strings are correctly wrapped in __() with the tour-operator textdomain, metadata and class names are consistent, and the query uses sane defaults for related reviews. This should give editors a clear inserter preview and a good starting layout.

Also applies to: 112-253


267-274: Conditional registration for destination post types/templates is correctly wired.

Using registerForPostTypesAndTemplates with ['destination'] post types and ['destination', 'country', 'region'] templates and hooking the resulting function into wp.domReady matches the shared conditional-registration pattern and should ensure this variation only appears in relevant contexts.

src/blocks/accommodation-related-destination/index.js (2)

12-110: Variation configuration, query, and example content are well structured.

The accommodation-related destination variation is nicely put together: i18n is handled correctly, the query targets the accommodation post type with a sensible grid layout, and the example tree provides rich, themed preview content that should make the inserter preview very helpful for editors.

Also applies to: 114-383


395-402: Conditional registration mirrors the shared destination pattern correctly.

The conditional registration via registerForPostTypesAndTemplates(['destination'], ['destination', 'country', 'region'], registerAccommodationRelatedDestinationVariation) and wp.domReady(conditionalRegister); looks correct and consistent with the other relationship blocks, so this variation should only appear where it’s contextually relevant.

Comment on lines +1 to +3
/**
* Register Accommodation Related Destination block variation
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add @since tags and end JSDoc description lines with a full stop.

The file-level and function-level JSDoc comments are missing @since annotations and their description lines don’t end with a period. Please add an appropriate @since version (the next plugin release, e.g. @since 2.1.0) to each block and terminate the description sentences with a full stop to comply with the project’s documentation rules.

Also applies to: 8-10

🤖 Prompt for AI Agents
In src/blocks/accommodation-related-destination/index.js lines 1-3 (and also
apply the same change to lines 8-10), the file-level and function-level JSDoc
descriptions are missing terminal periods and lack @since tags; update each
JSDoc block to end the description sentence with a full stop and add an @since
2.1.0 annotation to the file-level and function-level comments so they comply
with the project's documentation rules.

@krugazul krugazul self-requested a review November 18, 2025 09:09
Copy link
Copy Markdown
Collaborator

@krugazul krugazul left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, ive tested and they are working nicely.

@github-actions github-actions bot removed the status:needs-review Awaiting code review label Nov 18, 2025
@krugazul krugazul merged commit 7a8c79a into 2.1-trunk Nov 18, 2025
5 of 9 checks passed
@krugazul krugazul deleted the refactor/694-review-tour-acc-blocks-meta-icons branch November 18, 2025 09:11
@github-project-automation github-project-automation bot moved this from Needs Triage to ✅ Done in Tour Operator Nov 18, 2025
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between f2ed1a5 and 9352068 commits.
Files selected (1)
  • src/blocks/accommodation-related-destination/index.js (4)
Files not summarized due to errors (1)
  • src/blocks/accommodation-related-destination/index.js (diff tokens exceeds limit)
Files not reviewed due to errors (1)
  • src/blocks/accommodation-related-destination/index.js (no response)
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description 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 @coderabbitai in 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: ignore anywhere in the PR description to pause further reviews from the bot.

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

Labels

area:block-editor lang:javascript lang:php PHP code meta:needs-changelog Requires a changelog entry before merge status:needs-review Awaiting code review

Projects

Status: ✅ Done

3 participants