Conversation
|
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. WalkthroughAdds i18n and standardized metadata (textdomain, description, icon, keywords, example) to multiple accommodation block manifests; refactors four block variation registrations to explicit innerBlocks with header + query + 3‑column grid, adds example previews and supports.renaming=false, and adjusts one isActive signature. Updates changelog for 2.1.0. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Editor
participant Variation as Block Variation (core/group)
participant Header as Header Group
participant Query as core/query (accommodation)
participant Template as core/post-template (grid:3)
participant Card as Pattern: accommodation-card
Editor->>Variation: Insert variation
Variation->>Header: Render separators + centered heading
Variation->>Query: Initialise perPage, postType, order/orderBy
Query->>Template: Build grid layout
Template->>Card: Render each item via pattern
Note over Variation,Template: supports.renaming = false (related variations)
alt isActive by className (related-accommodation only)
Editor->>Variation: Evaluate className.includes(wrapper)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
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 (6)
- build/blocks/modal-button/index.js (1)
- changelog.md (1)
- src/blocks/accommodation-related-accommodation/index.js (2)
- src/blocks/accommodation-related-destination/index.js (1)
- src/blocks/accommodation-related-tour/index.js (1)
- src/blocks/accommodation-type/index.js (1)
Files ignored due to filter (9)
- build/blocks/accommodation-related-accommodation/block.json
- build/blocks/accommodation-related-destination/block.json
- build/blocks/accommodation-related-tour/block.json
- build/blocks/accommodation-type/block.json
- build/blocks/modal-button/block.json
- src/blocks/accommodation-related-accommodation/block.json
- src/blocks/accommodation-related-destination/block.json
- src/blocks/accommodation-related-tour/block.json
- src/blocks/accommodation-type/block.json
Files not summarized due to errors (6)
- build/blocks/modal-button/index.js (diff tokens exceeds limit)
- src/blocks/accommodation-type/index.js (nothing obtained from openai)
- changelog.md (nothing obtained from openai)
- src/blocks/accommodation-related-accommodation/index.js (nothing obtained from openai)
- src/blocks/accommodation-related-tour/index.js (nothing obtained from openai)
- src/blocks/accommodation-related-destination/index.js (nothing obtained from openai)
Files not reviewed due to errors (6)
- changelog.md (no response)
- src/blocks/accommodation-related-destination/index.js (no response)
- src/blocks/accommodation-type/index.js (no response)
- build/blocks/modal-button/index.js (no response)
- src/blocks/accommodation-related-tour/index.js (no response)
- src/blocks/accommodation-related-accommodation/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 (11)
changelog.md (1)
38-38: Wording: prefer “internationalisation (i18n)” for consistencyMinor copy edit to match en-ZA spelling and common shorthand.
-- Standardized accommodation block metadata with improved internationalization, descriptions, and schema compliance - PR [#625](https://github.com/lightspeedwp/tour-operator/pull/625), Issue [#624](https://github.com/lightspeedwp/tour-operator/issues/624) +- Standardised accommodation block metadata with improved internationalisation (i18n), descriptions, and schema compliance – PR [#625](https://github.com/lightspeedwp/tour-operator/pull/625), Issue [#624](https://github.com/lightspeedwp/tour-operator/issues/624)src/blocks/accommodation-related-tour/block.json (1)
16-143: Example payload is fine; consider keeping examples in one placeOptional: keep the example either here (block.json) or in the variation (index.js), but not both, to avoid drift.
src/blocks/accommodation-type/block.json (1)
16-43: Single source of truth for examplesSince index.js also defines an example for this variation, prefer keeping the example in one place (recommend block.json) and removing the duplicate from JS.
src/blocks/accommodation-type/index.js (2)
65-92: De-duplicate example (keep it in block.json, remove here)Having two copies invites drift.
- example: { - attributes: { - metadata: { - name: "Accommodation Type", - }, - }, - innerBlocks: [ - [ - "core/group", - {}, - [ - [ - "core/heading", - { - content: "Accommodation Type", - level: 3, - }, - ], - [ - "core/paragraph", - { - content: "Luxury Safari Lodge", - }, - ], - ], - ], - ], - },
1-5: Optional: define __ onceFor cleanliness, pull __ from wp.i18n once at the top of the callback.
-wp.domReady(() => { +wp.domReady(() => { + const { __ } = wp.i18n;src/blocks/accommodation-related-destination/index.js (2)
95-97: Add isActive to reliably detect the variation in the editor.Match on the wrapper class the same way as the “accommodation-related-accommodation” build artifact.
Apply:
supports: { renaming: false, }, + isActive: ( attributes ) => + attributes?.className === 'lsx-accommodation-related-destination-query-wrapper' || + attributes?.className?.includes( 'lsx-accommodation-related-destination-query-wrapper' ),
63-69: Confirm sort order (“asc” by date).For related content, latest-first is typical. If there’s no product reason for ascending, consider “desc”.
Apply (if desired):
- order: 'asc', + order: 'desc',src/blocks/accommodation-related-destination/block.json (2)
11-15: Add “accommodation” to keywords for better discoverability.Apply:
"keywords": [ "related", + "accommodation", "destinations", "similar" ],
64-76: Optional: Make example cards accommodation‑centric.Current items are destination names; consider sample accommodation names to avoid confusion.
Also applies to: 94-106, 124-136
src/blocks/accommodation-related-accommodation/block.json (1)
16-21: Align example metadata.name with the registered variation title.Minor naming consistency.
Apply:
- "metadata": { - "name": "Related Accommodation" - } + "metadata": { + "name": "Related Accommodation - Accommodation" + }src/blocks/accommodation-related-accommodation/index.js (1)
193-199: Consider simplifying theisActivecheck.The current implementation checks for both exact match and includes, but since
includes()would also match an exact string, the first condition is redundant.- isActive: ( blockAttributes ) => { - return ( - blockAttributes.className === 'lsx-accommodation-related-accommodation-query-wrapper' || - ( blockAttributes.className && - blockAttributes.className.includes( 'lsx-accommodation-related-accommodation-query-wrapper' ) ) - ); - }, + isActive: ( blockAttributes ) => { + return blockAttributes.className?.includes( 'lsx-accommodation-related-accommodation-query-wrapper' ) || false; + },
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (20)
build/admin.asset.phpis excluded by!build/**build/blocks/accommodation-related-accommodation/block.jsonis 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/block.jsonis 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/block.jsonis 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/block.jsonis excluded by!build/**build/blocks/accommodation-type/index.asset.phpis excluded by!build/**build/blocks/accommodation-type/index.jsis excluded by!build/**build/blocks/modal-button/block.jsonis excluded by!build/**build/blocks/modal-button/index.asset.phpis excluded by!build/**build/blocks/modal-button/index.jsis excluded by!build/**build/custom.asset.phpis excluded by!build/**build/custom.jsis excluded by!build/**build/metaboxes.asset.phpis excluded by!build/**build/style.asset.phpis excluded by!build/**
📒 Files selected for processing (9)
changelog.md(1 hunks)src/blocks/accommodation-related-accommodation/block.json(1 hunks)src/blocks/accommodation-related-accommodation/index.js(2 hunks)src/blocks/accommodation-related-destination/block.json(1 hunks)src/blocks/accommodation-related-destination/index.js(1 hunks)src/blocks/accommodation-related-tour/block.json(1 hunks)src/blocks/accommodation-related-tour/index.js(1 hunks)src/blocks/accommodation-type/block.json(1 hunks)src/blocks/accommodation-type/index.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{php,js,ts,jsx,tsx}
⚙️ CodeRabbit configuration file
**/*.{php,js,ts,jsx,tsx}: - Follow WordPress coding standards.
- Escape output and sanitize input.
- Follow plugin security best practices.
- Enforce prefixing for all functions, classes, and constants to avoid naming collisions.
- Check for accessibility best practices in UI code (labels, ARIA attributes, color contrast).
- Ensure inline documentation/comments for all custom functions and classes.
- Ensure consistent formatting and schema validation.
- Keep documentation up to date and clear.
- On Pull Requests check for updates to the changelog file.
Files:
src/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-accommodation/index.jssrc/blocks/accommodation-type/index.js
🧠 Learnings (1)
📚 Learning: 2025-08-25T13:07:05.897Z
Learnt from: CR
PR: lightspeedwp/tour-operator#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-25T13:07:05.897Z
Learning: Applies to tour-operator/src/**/*.js : Use the block namespace `lsx-to` when registering Gutenberg blocks (e.g., name: 'lsx-to/your-block')
Applied to files:
src/blocks/accommodation-type/block.jsonsrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-tour/block.jsonsrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-accommodation/index.jssrc/blocks/accommodation-type/index.js
🧬 Code graph analysis (7)
src/blocks/accommodation-related-accommodation/block.json (1)
build/blocks/accommodation-related-accommodation/index.js (1)
wp(1-1)
src/blocks/accommodation-type/block.json (2)
src/blocks/destination-to-accommodation/index.js (1)
wp(1-67)src/blocks/featured-accommodation/index.js (1)
wp(1-70)
src/blocks/accommodation-related-destination/index.js (4)
build/blocks/accommodation-related-accommodation/index.js (1)
wp(1-1)src/blocks/destination-to-accommodation/index.js (1)
wp(1-67)src/blocks/featured-accommodation/index.js (1)
wp(1-70)src/blocks/tour-related-accommodation/index.js (1)
wp(1-69)
src/blocks/accommodation-related-tour/block.json (2)
src/blocks/featured-accommodation/index.js (1)
wp(1-70)src/blocks/tour-related-accommodation/index.js (1)
wp(1-69)
src/blocks/accommodation-related-tour/index.js (4)
build/blocks/tour-related-accommodation/index.js (1)
wp(1-1)src/blocks/featured-accommodation/index.js (1)
wp(1-70)src/blocks/tour-related-accommodation/index.js (1)
wp(1-69)src/blocks/review-related-accommodation/index.js (1)
wp(1-69)
src/blocks/accommodation-related-accommodation/index.js (2)
build/blocks/accommodation-related-accommodation/index.js (1)
wp(1-1)src/blocks/featured-accommodation/index.js (1)
wp(1-70)
src/blocks/accommodation-type/index.js (2)
src/blocks/destination-to-accommodation/index.js (1)
wp(1-67)src/blocks/review-related-accommodation/index.js (1)
wp(1-69)
⏰ 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). (1)
- GitHub Check: Summary
🔇 Additional comments (8)
src/blocks/accommodation-related-tour/block.json (2)
4-15: Metadata additions look goodtextdomain, description, icon, and keywords are correctly added and align with WP block.json schema.
5-5: Confirm no name collision between block and variationIf index.js also registers a variation named "lsx-tour-operator/accommodation-related-tour", ensure there’s no duplicate block registration or inserter confusion.
Would you confirm whether this slug is used only as a variation name and not as a separate block elsewhere in the codebase?
src/blocks/accommodation-type/block.json (1)
2-15: Schema + metadata are correct$schema, apiVersion, textdomain, description, icon, and keywords conform to expectations.
src/blocks/accommodation-related-destination/index.js (1)
3-3: Confirm canonical block namespace: 'lsx-to' vs 'lsx-tour-operator'src/blocks/accommodation-related-destination/index.js registers name 'lsx-tour-operator/accommodation-related-destination' but internal guidance references 'lsx-to/...'. Standardise the namespace across the repo or justify keeping 'lsx-tour-operator'. I couldn't verify occurrences across the repo (ripgrep returned no files); run locally: rg -n "lsx-to/|lsx-tour-operator/" -g '!/node_modules/' and align registrations.
src/blocks/accommodation-related-accommodation/block.json (1)
1-15: LGTM on schema, i18n fields, and example structure.Consistent with WP block.json conventions and the rest of the PR.
src/blocks/accommodation-related-accommodation/index.js (2)
94-96: LGTM! Good addition of therenamingsupport.The
renaming: falsesupport prevents users from accidentally changing the block variation's name, which helps maintain consistency across the site.
98-192: Well-structured example block for preview functionality.The example provides a clear visual representation of the block's purpose with proper heading and grid layout. The sample accommodation cards effectively demonstrate the expected output structure.
src/blocks/accommodation-related-tour/index.js (1)
95-97: Good addition of renaming support.The
renaming: falseprevents accidental renaming of the block variation, maintaining consistency.
…cy, replace image icon with block icon
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (3)
src/blocks/accommodation-related-destination/index.js (2)
58-91: Core/query still misses the related query classThe PHP filter (
includes/classes/blocks/class-query-loop.php::query_args_filter) only activates when thecore/queryblock itself carries a*-related-*-queryclass. Here the class is applied to thecore/post-template, so the filter never scopes the results to the current destination. Users will just see generic accommodation listings. Please addclassName: 'lsx-accommodation-related-destination-query'(or append the class) to thecore/queryblock attributes so the related-query behaviour works again.
106-189: Example heading should match the variationThe preview still shows “Related Destinations”, which disagrees with the registered variation heading (“Related accommodation”). Update the example heading string to keep the example aligned with the actual block.
src/blocks/accommodation-related-tour/index.js (1)
99-193: Address previously flagged inconsistencies in the example section.The example section contains two critical issues that were previously flagged:
Lines 102, 113: The example uses "Related tours" but the block is meant to display "Related accommodation". This creates confusion about the block's actual purpose.
Lines 146-147, 165-166, 184-185: The example content shows tour descriptions (African Safari Adventure, European Cultural Journey, Tropical Island Escape) instead of accommodation descriptions. Since this block displays accommodation related to tours, the example should showcase accommodation items (e.g., Safari Lodge, Historic City Hotel, Beach Resort).
These inconsistencies will mislead users during block insertion and preview. Please refer to the previously suggested fixes in the existing review comments.
🧹 Nitpick comments (3)
src/blocks/accommodation-type/index.js (1)
61-93: Consider adding inline documentation.The block variation registration lacks JSDoc comments explaining its purpose, parameters, and behaviour. Per coding guidelines, inline documentation should be provided for all custom functions and classes.
As per coding guidelines.
Add a JSDoc comment above the registration:
wp.domReady(() => { const { __ } = wp.i18n; + /** + * Registers the Accommodation Type block variation. + * + * Creates a group block variation that displays the accommodation type + * taxonomy term with an icon and label. + */ wp.blocks.registerBlockVariation("core/group", {src/blocks/accommodation-related-accommodation/index.js (1)
101-114: Keep the variation example label consistentThe variation registers
metadata.nameas “Related accommodation - accommodation”, but the example hard-codes “Related Accommodation”. Because renaming is disabled, editors will see two different labels between the preview and the inserted block. Please align the example string with the registered default to avoid that mismatch.src/blocks/accommodation-related-accommodation/block.json (1)
18-21: Align example metadata with the registered nameThe example metadata name (“Related accommodation”) doesn’t match the variation’s registered name (“Related accommodation - accommodation”). Harmonising these avoids showing editors one label in previews and another after insertion.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
src/blocks/accommodation-related-accommodation/block.json(1 hunks)src/blocks/accommodation-related-accommodation/index.js(2 hunks)src/blocks/accommodation-related-destination/block.json(1 hunks)src/blocks/accommodation-related-destination/index.js(1 hunks)src/blocks/accommodation-related-tour/block.json(1 hunks)src/blocks/accommodation-related-tour/index.js(1 hunks)src/blocks/accommodation-type/block.json(1 hunks)src/blocks/accommodation-type/index.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/blocks/accommodation-type/block.json
- src/blocks/accommodation-related-destination/block.json
🧰 Additional context used
📓 Path-based instructions (13)
src/**/*.{js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use @wordpress/eslint-plugin for JavaScript linting
Files:
src/blocks/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/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/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/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/accommodation-type/index.jssrc/blocks/accommodation-related-accommodation/block.jsonsrc/blocks/accommodation-related-tour/block.jsonsrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/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/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/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/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/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/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/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/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/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/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/index.js
**/*.{css,js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/reviews.instructions.md)
Minimize CSS/JS payload size
Files:
src/blocks/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/index.js
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/reviews.instructions.md)
Lazy-load code and resources where possible
Files:
src/blocks/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/index.js
**/*.{php,js,ts,jsx,tsx}
⚙️ CodeRabbit configuration file
**/*.{php,js,ts,jsx,tsx}: - Follow WordPress coding standards.
- Escape output and sanitize input.
- Follow plugin security best practices.
- Enforce prefixing for all functions, classes, and constants to avoid naming collisions.
- Check for accessibility best practices in UI code (labels, ARIA attributes, color contrast).
- Ensure inline documentation/comments for all custom functions and classes.
- Ensure consistent formatting and schema validation.
- Keep documentation up to date and clear.
- On Pull Requests check for updates to the changelog file.
Files:
src/blocks/accommodation-type/index.jssrc/blocks/accommodation-related-tour/index.jssrc/blocks/accommodation-related-destination/index.jssrc/blocks/accommodation-related-accommodation/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/accommodation-related-accommodation/block.jsonsrc/blocks/accommodation-related-tour/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/accommodation-related-accommodation/block.jsonsrc/blocks/accommodation-related-tour/block.json
🧬 Code graph analysis (6)
src/blocks/accommodation-type/index.js (3)
src/blocks/accommodation-related-accommodation/index.js (1)
wp(2-2)src/blocks/accommodation-related-destination/index.js (1)
wp(2-2)src/blocks/accommodation-related-tour/index.js (1)
wp(2-2)
src/blocks/accommodation-related-accommodation/block.json (1)
build/blocks/accommodation-related-accommodation/index.js (1)
wp(1-1)
src/blocks/accommodation-related-tour/block.json (3)
src/blocks/destination-to-accommodation/index.js (1)
wp(1-67)src/blocks/featured-accommodation/index.js (1)
wp(1-70)src/blocks/tour-related-accommodation/index.js (1)
wp(1-69)
src/blocks/accommodation-related-tour/index.js (2)
src/blocks/featured-accommodation/index.js (1)
wp(1-70)src/blocks/tour-related-accommodation/index.js (1)
wp(1-69)
src/blocks/accommodation-related-destination/index.js (3)
src/blocks/accommodation-related-accommodation/index.js (1)
wp(2-2)src/blocks/accommodation-related-tour/index.js (1)
wp(2-2)src/blocks/accommodation-type/index.js (1)
wp(2-2)
src/blocks/accommodation-related-accommodation/index.js (4)
src/blocks/accommodation-related-destination/index.js (1)
wp(2-2)src/blocks/accommodation-related-tour/index.js (1)
wp(2-2)src/blocks/accommodation-type/index.js (1)
wp(2-2)build/blocks/accommodation-related-accommodation/index.js (1)
wp(1-1)
⏰ 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). (1)
- GitHub Check: Summary
🔇 Additional comments (6)
src/blocks/accommodation-related-tour/index.js (4)
1-8: LGTM! Proper i18n implementation.The block registration correctly imports and uses the WordPress i18n API, with all user-facing strings properly wrapped with the
tour-operatortextdomain. The block title and description accurately reflect the block's purpose.
9-19: LGTM! Attributes properly configured.The attributes configuration is consistent with similar blocks in the codebase, with proper internationalization of the metadata name and appropriate alignment and layout settings.
20-95: LGTM! Main block structure correctly configured.The innerBlocks structure properly implements a two-tier layout with a decorated heading section and a query block for accommodation. All strings are correctly internationalized, and the query configuration appropriately targets the
accommodationpost type.
96-98: LGTM! Supports configuration appropriate.The
renaming: falseconfiguration prevents users from renaming block instances, which is consistent with other related blocks in the codebase.src/blocks/accommodation-type/index.js (2)
1-2: LGTM! i18n import correctly added.The destructured import of
__fromwp.i18nfollows WordPress best practices for internationalization and addresses the previous review comment about localizing user-facing strings.
28-34: Verified icon block registration
Thelsx-tour-operator/iconsblock is registered in src/blocks/icons/index.js and declared in its block.json.
| "category": "lsx-tour-operator", | ||
| "editorScript": "file:index.js" | ||
| "editorScript": "file:index.js", | ||
| "description": "Displays accommodation related to this tour via the destinations.", |
There was a problem hiding this comment.
Add accessibility guidance to the block description.
The block description must include editor-facing accessibility guidance (per our block.json standards), but right now it only states what the block does. Please expand it with actionable advice for authors.
Apply something like:
- "description": "Displays accommodation related to this tour via the destinations.",
+ "description": "Displays accommodation related to this tour via the destinations. Ensure the heading level fits the page hierarchy and that any linked media include descriptive alternative text for accessibility.",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "description": "Displays accommodation related to this tour via the destinations.", | |
| "description": "Displays accommodation related to this tour via the destinations. Ensure the heading level fits the page hierarchy and that any linked media include descriptive alternative text for accessibility.", |
🤖 Prompt for AI Agents
In src/blocks/accommodation-related-tour/block.json around line 9, the
"description" only states the block's function and lacks editor-facing
accessibility guidance; update the description string to include brief,
actionable accessibility instructions for authors (e.g., guidance about using
meaningful alt text for images, ensuring link text is descriptive, using
headings appropriately, and avoiding color-only cues) so the block.json follows
our accessibility guidance standard.
| wp.blocks.registerBlockVariation("core/group", { | ||
| name: "lsx-tour-operator/accommodation-type", | ||
| title: __( "Accommodation type", "tour-operator" ), | ||
| icon: "admin-multisite", | ||
| category: 'lsx-tour-operator', | ||
| category: "lsx-tour-operator", | ||
| attributes: { | ||
| metadata: { | ||
| name: 'Accommodation Type', | ||
| name: __( "Accommodation type", "tour-operator" ), | ||
| }, | ||
| className: 'lsx-accommodation-type-wrapper', | ||
| className: "lsx-accommodation-type-wrapper", | ||
| layout: { | ||
| type: 'constrained' | ||
| } | ||
| type: "constrained", | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Capitalization inconsistency in block title.
The block title uses "Accommodation type" (lowercase "t") on line 5, but "Accommodation Type" (uppercase "T") is used elsewhere (lines 67, 78). For consistency and to follow proper title casing conventions, standardize on "Accommodation Type" throughout.
Apply this diff to standardize the capitalization:
- title: __( "Accommodation type", "tour-operator" ),
+ title: __( "Accommodation Type", "tour-operator" ),
icon: "admin-multisite",
category: "lsx-tour-operator",
attributes: {
metadata: {
- name: __( "Accommodation type", "tour-operator" ),
+ name: __( "Accommodation Type", "tour-operator" ),
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| wp.blocks.registerBlockVariation("core/group", { | |
| name: "lsx-tour-operator/accommodation-type", | |
| title: __( "Accommodation type", "tour-operator" ), | |
| icon: "admin-multisite", | |
| category: 'lsx-tour-operator', | |
| category: "lsx-tour-operator", | |
| attributes: { | |
| metadata: { | |
| name: 'Accommodation Type', | |
| name: __( "Accommodation type", "tour-operator" ), | |
| }, | |
| className: 'lsx-accommodation-type-wrapper', | |
| className: "lsx-accommodation-type-wrapper", | |
| layout: { | |
| type: 'constrained' | |
| } | |
| type: "constrained", | |
| }, | |
| }, | |
| wp.blocks.registerBlockVariation("core/group", { | |
| name: "lsx-tour-operator/accommodation-type", | |
| title: __( "Accommodation Type", "tour-operator" ), | |
| icon: "admin-multisite", | |
| category: "lsx-tour-operator", | |
| attributes: { | |
| metadata: { | |
| name: __( "Accommodation Type", "tour-operator" ), | |
| }, | |
| className: "lsx-accommodation-type-wrapper", | |
| layout: { | |
| type: "constrained", | |
| }, | |
| }, | |
| } ); |
🤖 Prompt for AI Agents
In src/blocks/accommodation-type/index.js around lines 3 to 16, the block title
and metadata name use "Accommodation type" (lowercase "t") while other
occurrences use "Accommodation Type"; update the title string and the
metadata.name string to "Accommodation Type" so capitalization is consistent
across the file (align with lines 67 and 78).
| "core/paragraph", | ||
| { | ||
| content: "<strong>" + __( "Accommodation Type", "tour-operator" ) + "</strong>:", | ||
| }, | ||
| ], |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Use template literals instead of string concatenation.
String concatenation is used to build the paragraph content. Per coding guidelines, prefer template literals for string interpolation to improve readability and maintainability.
As per coding guidelines.
Apply this diff:
[
"core/paragraph",
{
- content: "<strong>" + __( "Accommodation Type", "tour-operator" ) + "</strong>:",
+ content: `<strong>${__( "Accommodation Type", "tour-operator" )}</strong>:`,
},
],📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "core/paragraph", | |
| { | |
| content: "<strong>" + __( "Accommodation Type", "tour-operator" ) + "</strong>:", | |
| }, | |
| ], | |
| [ | |
| "core/paragraph", | |
| { | |
| content: `<strong>${__( "Accommodation Type", "tour-operator" )}</strong>:`, | |
| }, | |
| ], |
🤖 Prompt for AI Agents
In src/blocks/accommodation-type/index.js around lines 36 to 40, the paragraph
content is built using string concatenation; replace the concatenation with a
template literal that embeds the localized string (e.g. `\`<strong>${__(
"Accommodation Type", "tour-operator" )}</strong>:\``) so the paragraph content
uses a template string for clearer interpolation and maintain coding guidelines.
Description
This PR standardizes the metadata for accommodation-related blocks as part of the larger block standardization effort (issue #583). This is the first chunk focusing on accommodation blocks to make the review process more manageable.
Blocks updated:
accommodation-related-accommodationaccommodation-related-destinationaccommodation-related-touraccommodation-typeChanges include:
block.jsonschema with proper$schemadeclarationtextdomainand internationalization supportindex.jsfilesType of Change
Benefits
Possible Drawbacks
Alternate Designs
Checklist
How to Test
Block Editor Testing:
Internationalization Testing:
block.jsonfilesSchema Validation:
block.jsonfiles follow WordPress schemaBackward Compatibility:
Applicable Issues
Addresses #624
Part of #583
Changelog Entry
Summary by CodeRabbit
New Features
Documentation