Skip to content

Enhance check-in and check-out blocks with meta and post types#645

Merged
tibiii merged 9 commits into2.1-trunkfrom
refactor/checkin-checkout-blocks
Oct 9, 2025
Merged

Enhance check-in and check-out blocks with meta and post types#645
tibiii merged 9 commits into2.1-trunkfrom
refactor/checkin-checkout-blocks

Conversation

@tibiii
Copy link
Copy Markdown
Contributor

@tibiii tibiii commented Oct 5, 2025


pr: 645
related_issues:

  • 644
    blocks:
  • lsx/checkin-time
  • lsx/checkout-time
    post_types:
  • accommodation
    author: tibiii
    labels:
  • enhancement
  • block
  • audit

Summary

This pull request updates both the Check In Time and Check Out Time block variations for the LSX Tour Operator plugin, making them more descriptive, context-aware, and visually consistent. The changes ensure the blocks only register for the accommodation post type, add richer metadata and examples, and switch to a custom icon component for improved branding.

Block registration improvements:

  • Both checkin-time and checkout-time block variations now register only when editing an accommodation post type, using a polling mechanism to ensure correct timing. [1] [2]
  • The icon for both blocks is changed from a static image to the custom lsx-tour-operator/icons block with checkInAccommodationIcon, improving consistency and maintainability. [1] [2]

Block configuration enhancements:

  • Added description, icon, keywords, and a detailed example to both block.json files, improving discoverability and usability in the block editor. [1] [2]
  • The block examples now show a heading and sample time, providing a clearer preview in the editor. [1] [2]

Technical and metadata updates:

  • Added a textdomain field to both block configurations for proper localization support. [1] [2]
  • Updated asset version hashes in the PHP asset files to reflect the new builds. [1] [2]…d improved registration logic

Scope

  • PHP
  • JS/Blocks
  • Styles (theme.json / selectors)
  • Tests (Playwright)
  • Docs

Screenshots / Videos

If relevant.

Checklist

  • Block API v3
  • block.json updated (title, description, keywords, supports, example, selectors)
  • Registered via PHP using metadata
  • Theme.json styles (no bespoke CSS unless unavoidable)
  • Preview works in inserter
  • E2E tests added/updated

Related issues

This closes #644

Summary by CodeRabbit

  • New Features

    • Enhanced Check‑in and Check‑out blocks with icons, translated labels, nested grouped layouts and example previews.
  • Improvements

    • Blocks now register only in Accommodation contexts (including relevant templates) with retry/timing and isActive gating for reliable editor loading.
    • Added internationalisation, descriptions and keywords for better discoverability.
    • Build assets declare wp‑i18n dependency.
  • Documentation

    • Example content added to illustrate block usage.
  • Chores

    • Internal global storage variable renamed for content model paths.

@tibiii tibiii added this to the 2.1.0 milestone Oct 5, 2025
@tibiii tibiii self-assigned this Oct 5, 2025
@tibiii tibiii added the comp:block-variations Block variations label Oct 5, 2025
@tibiii tibiii added comp:block-supports Block supports comp:block-json Block metadata (block.json) [Type] Refactor labels Oct 5, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Tour Operator Oct 5, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 5, 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.

Walkthrough

Adds editor metadata and example payloads to checkin/checkout block manifests; replaces unconditional block-variation registration with i18n-enabled, post-type-gated registration that retries until the editor post type is available; updates built checkin assets to include wp-i18n; renames a PHP global for content model JSON paths.

Changes

Cohort / File(s) Summary
Block metadata (check-in)
src/blocks/checkin-time/block.json
Adds textdomain, description, icon, keywords and an example with nested innerBlocks (group → heading "Check In Time", paragraph "11:00 AM").
Block metadata (check-out)
src/blocks/checkout-time/block.json
Adds textdomain, description, icon, keywords and an example with nested innerBlocks (group → heading "Check Out Time", paragraph "3:00 PM").
Post-type-gated registration + i18n (source)
src/blocks/checkin-time/index.js, src/blocks/checkout-time/index.js
Replace immediate variation registration with guarded register*Variation() functions: import __ from @wordpress/i18n, wrap strings for translation, add isActive predicate, extend variation attributes (metadata, className, layout), restructure innerBlocks (nested groups, lsx-tour-operator/icons, post-meta-bound paragraph), add example payload, and gate registration to accommodation (with template/template_part slug checks) using an immediate attempt + 100ms retries up to 5s; registration wrapped in try/catch and returns boolean.
Build artefacts (check-in)
build/blocks/checkin-time/index.asset.php, build/blocks/checkin-time/index.js
Adds wp-i18n to asset dependencies and updated asset version; compiled bundle implements gated registration, i18n usage, nested innerBlocks and retry/timeout logic.
PHP global rename
tour-operator.php
Replace global array $lsx_to_content_model_json_path with $CONTENT_MODEL_JSON_PATH and append LSX_TO_PATH to the new global; removed prior initialization of the old variable.
Changelog
changelog.md
Add note about icon block usage and post-type filter for checkin/checkout blocks in 2.1.0 release notes.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant DOM as domReady
    participant Data as wp.data (core/editor)
    participant Blocks as wp.blocks.registerBlockVariation
    Note over DOM,Blocks: Variation registration gated to "accommodation" post type
    DOM->>Data: getCurrentPostType() / getEditedPostAttribute('slug') (for templates)
    alt supported (accommodation / template slug contains accommodation)
        DOM->>Blocks: registerBlockVariation(variationPayload)
        Blocks-->>DOM: success
    else not ready/unsupported
        DOM->>DOM: start interval (every 100ms) + 5s timeout
        loop until success or timeout
            DOM->>Data: getCurrentPostType()
            alt supported now
                DOM->>Blocks: registerBlockVariation(variationPayload)
                Blocks-->>DOM: success (stop interval)
            else
                DOM-->>DOM: wait 100ms
            end
        end
    end
    Note over Blocks: variationPayload includes i18n labels and nested `lsx-tour-operator/icons` and post-meta-bound paragraph
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

Suggested labels

[Type] Enhancement, [Component] Block Inserter, Tour Operator, 2.1.0

Suggested reviewers

  • krugazul
  • ZaredRogers

Pre-merge checks and finishing touches

❌ Failed checks (4 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The changes implement metadata enhancements, block.json examples, icon migration, and post-type gating per issue #644, but they do not perform server-side PHP registration via register_block_type, lack explicit apiVersion, category, and version fields and post-type selectors in block.json, and omit styling migration to theme.json as required by the same issue. Add server-side registration calls in PHP using register_block_type for both blocks, ensure block.json includes apiVersion:3, category, version, selectors scoped to accommodation, and implement the required CSS migration to theme.json selectors to fully satisfy issue #644.
Out of Scope Changes Check ⚠️ Warning The PR includes modifications to the global content model JSON path variable in tour-operator.php which are unrelated to the block audit objectives in issue #644. Please remove the unrelated content model JSON path changes from this PR or split them into a separate issue, ensuring only block audit-related changes are included.
Description Check ⚠️ Warning The PR description does not follow the required template: its front-matter fields differ from the repository template, it omits a dedicated “## Changes” section and missing “Risk & Rollback” and “Test Notes” headings, and does not include a linked issues line in the Summary section. Please update the PR description to use the repository’s default template by adding the specified YAML front-matter keys, include a “## Changes” section listing all notable changes, fill out “## Test Notes” and “## Risk & Rollback,” and ensure the Summary contains a Linked issues line.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title clearly summarises the main enhancement of adding metadata and post-type gating to the check-in and check-out blocks without extraneous detail.

📜 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 ba45885 and f031724.

📒 Files selected for processing (1)
  • changelog.md (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 5, 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.

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 5da26f0 and df230b7 commits.
Files selected (2)
  • src/blocks/checkin-time/index.js (1)
  • src/blocks/checkout-time/index.js (1)
Files ignored due to filter (4)
  • build/blocks/checkin-time/block.json
  • build/blocks/checkout-time/block.json
  • src/blocks/checkin-time/block.json
  • src/blocks/checkout-time/block.json
Files not summarized due to errors (2)
  • src/blocks/checkout-time/index.js (nothing obtained from openai)
  • src/blocks/checkin-time/index.js (nothing obtained from openai)
Files not reviewed due to errors (2)
  • src/blocks/checkin-time/index.js (no response)
  • src/blocks/checkout-time/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

🧹 Nitpick comments (1)
src/blocks/checkout-time/index.js (1)

132-143: Consider extracting the polling mechanism into a shared utility.

The polling logic (100ms interval, 5s timeout) is duplicated between the check-in and check-out time blocks. While the current implementation works correctly, extracting this into a shared utility function would improve maintainability and ensure consistent behaviour across both blocks.

Example shared utility:

// In a shared utilities file
export const registerBlockVariationWhenReady = (
    checkFn,
    options = { interval: 100, timeout: 5000 }
) => {
    if (checkFn()) return;
    
    const interval = setInterval(() => {
        if (checkFn()) clearInterval(interval);
    }, options.interval);
    
    setTimeout(() => clearInterval(interval), options.timeout);
};
📜 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 5da26f0 and df230b7.

⛔ Files ignored due to path filters (6)
  • build/blocks/checkin-time/block.json is excluded by !build/**
  • build/blocks/checkin-time/index.asset.php is excluded by !build/**
  • build/blocks/checkin-time/index.js is excluded by !build/**
  • build/blocks/checkout-time/block.json is excluded by !build/**
  • build/blocks/checkout-time/index.asset.php is excluded by !build/**
  • build/blocks/checkout-time/index.js is excluded by !build/**
📒 Files selected for processing (4)
  • src/blocks/checkin-time/block.json (1 hunks)
  • src/blocks/checkin-time/index.js (1 hunks)
  • src/blocks/checkout-time/block.json (1 hunks)
  • src/blocks/checkout-time/index.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
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 namespace lsx-to in block names

Files:

  • src/blocks/checkout-time/block.json
  • src/blocks/checkin-time/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/checkout-time/block.json
  • src/blocks/checkin-time/block.json
{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/checkout-time/block.json
  • src/blocks/checkout-time/index.js
  • src/blocks/checkin-time/index.js
  • src/blocks/checkin-time/block.json
src/**/*.{js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use @wordpress/eslint-plugin for JavaScript linting

Files:

  • src/blocks/checkout-time/index.js
  • src/blocks/checkin-time/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 domain tour-operator for JS i18n calls

Files:

  • src/blocks/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/index.js
**/*.{css,js,jsx,ts,tsx}

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

Minimize CSS/JS payload size

Files:

  • src/blocks/checkout-time/index.js
  • src/blocks/checkin-time/index.js
**/*.{js,jsx,ts,tsx}

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

Lazy-load code and resources where possible

Files:

  • src/blocks/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/index.js
🧬 Code graph analysis (2)
src/blocks/checkout-time/index.js (1)
src/blocks/checkin-time/index.js (3)
  • wp (14-14)
  • supportedPostTypes (17-17)
  • checkAndRegister (20-130)
src/blocks/checkin-time/index.js (1)
src/blocks/checkout-time/index.js (3)
  • wp (14-14)
  • supportedPostTypes (17-17)
  • checkAndRegister (20-130)
⏰ 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: review
🔇 Additional comments (6)
src/blocks/checkin-time/block.json (2)

4-4: LGTM! Metadata enhancements align with requirements.

The additions of textdomain, description, icon, keywords, and example properly enhance the block's discoverability and provide a clear inserter preview. These changes fulfill the block.json requirements from issue #644.

Also applies to: 9-15, 16-43


5-5: Align block namespace or update guideline
All blocks currently use lsx-tour-operator/... but the coding guideline prescribes lsx-to/.... Renaming every block to lsx-to is a breaking change; alternatively, revise the guideline to lsx-tour-operator. Confirm which namespace should be standard.

src/blocks/checkout-time/index.js (2)

1-9: LGTM! JSDoc and imports are correct.

The file header accurately describes the Check Out Time block variation, and the i18n import is properly included for translatable strings.

Also applies to: 11-11


20-130: Well-implemented post-type gating and registration logic.

The conditional registration based on post type is correctly implemented with proper editor state checking and fallback handling.

src/blocks/checkout-time/block.json (1)

4-4: LGTM! Metadata enhancements properly implemented.

The checkout time block.json includes all required metadata fields with appropriate content. The example preview with "3:00 PM" effectively demonstrates the block's purpose in the inserter.

Also applies to: 9-15, 16-43

src/blocks/checkin-time/index.js (1)

20-130: LGTM! Registration logic is correctly implemented.

The post-type gating and conditional registration logic properly restricts the block variation to accommodation post types, fulfilling the requirements from issue #644.

@ashleyshaw
Copy link
Copy Markdown
Member

ashleyshaw commented Oct 6, 2025

@tibiii please assign project details to both issues and PRs, make sure the meta is filled in properly. Also, process the coderabbit and copilot code review feedback.

@tibiii tibiii moved this from Needs Triage to 🏗️ In Progress in Tour Operator Oct 6, 2025
@tibiii tibiii requested a review from Copilot October 6, 2025 14:19
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 enhances the Check In Time and Check Out Time block variations by adding post-type-specific registration, improved metadata, and better visual consistency. The blocks now only appear when editing accommodation posts and feature enriched configuration for better discoverability.

Key changes:

  • Added post-type-specific registration logic that restricts blocks to accommodation post types
  • Enhanced block metadata with descriptions, keywords, and detailed examples for better editor experience
  • Replaced static image icons with custom icon components for improved maintainability

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/blocks/checkout-time/index.js Added post-type checking logic and switched from static image to custom icon component
src/blocks/checkout-time/block.json Added metadata fields including description, keywords, and example configuration
src/blocks/checkin-time/index.js Added post-type checking logic and switched from static image to custom icon component
src/blocks/checkin-time/block.json Added metadata fields including description, keywords, and example configuration
build/blocks/checkout-time/index.js Compiled build output with new webpack bundling structure
build/blocks/checkout-time/index.asset.php Updated asset dependencies and version hash
build/blocks/checkout-time/block.json Build copy of updated block configuration
build/blocks/checkin-time/index.js Compiled build output with new webpack bundling structure
build/blocks/checkin-time/index.asset.php Updated asset dependencies and version hash
build/blocks/checkin-time/block.json Build copy of updated block configuration

@github-project-automation github-project-automation bot moved this from 🏗️ In Progress to Needs Triage in Tour Operator Oct 6, 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 df230b7 and ee5ef0e commits.
Files selected (1)
  • src/blocks/checkin-time/index.js (1)
Files not summarized due to errors (1)
  • src/blocks/checkin-time/index.js (nothing obtained from openai)
Files not reviewed due to errors (1)
  • src/blocks/checkin-time/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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df230b7 and ee5ef0e.

📒 Files selected for processing (3)
  • build/blocks/checkin-time/index.asset.php (1 hunks)
  • build/blocks/checkin-time/index.js (1 hunks)
  • src/blocks/checkin-time/index.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
**/*.php

📄 CodeRabbit inference engine (.github/instructions/coding-standards.instructions.md)

**/*.php: PHP classes must use the Tour_Operator_ prefix with Pascal_Case
PHP functions must use the tour_operator_ prefix with snake_case
Variables should use snake_case (e.g., $tour_data, $destination_info)
Constants must use UPPER_SNAKE_CASE (e.g., TOUR_OPERATOR_VERSION)
Always sanitize input data (e.g., sanitize_text_field)
Validate all data before processing (e.g., type checks, ranges)
Escape all output (e.g., esc_html, wp_kses_post)
Use nonces for form submissions (e.g., wp_nonce_field)
Use $wpdb->prepare() for all SQL queries
Prefix all custom tables with $wpdb->prefix
Prefer WordPress database helper functions when possible
Prefix all hooks (actions/filters) with tour_operator_
Document all hooks with proper DocBlocks
Provide examples in hook documentation DocBlocks
One class per PHP file
All functions must have DocBlocks
Use @SInCE tags for version tracking in DocBlocks
Include @param and @return tags in DocBlocks
Use transients for temporary cached data
Minimize database queries

Use wp_enqueue_block_style and wp_register_style with proper dependencies when adding styles in WordPress

**/*.php: Use proper WordPress file headers with plugin/theme information
Use kebab-case for file names
Use snake_case for PHP function names
Prefix all functions, classes, and constants to avoid conflicts
Escape all output using appropriate WordPress functions (esc_html, esc_attr, esc_url, wp_kses_post)
Sanitize input immediately on receipt (e.g., sanitize_text_field, sanitize_email, esc_url_raw)
Use nonces for all forms and AJAX requests and verify with wp_verify_nonce
Check user capabilities (current_user_can) before privileged actions
Always use $wpdb->prepare for custom SQL queries
Prefer WordPress API functions (e.g., get_posts) over direct SQL queries
Internationalize strings using __, _e, _x, _n with a consistent text domain
For JavaScript strings, pass data via wp_localize_script and include nonces where needed
Use WordPress error handling: check is_wp_error, log...

Files:

  • build/blocks/checkin-time/index.asset.php
**/*.{php,js,jsx,ts,tsx}

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

Internationalize user‑facing strings using WordPress i18n APIs

Files:

  • build/blocks/checkin-time/index.asset.php
  • src/blocks/checkin-time/index.js
  • build/blocks/checkin-time/index.js
**/*.{php,html,jsx,tsx}

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

Do not use inline CSS (no style attributes or inline style props)

Files:

  • build/blocks/checkin-time/index.asset.php
src/**/*.{js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use @wordpress/eslint-plugin for JavaScript linting

Files:

  • src/blocks/checkin-time/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 domain tour-operator for JS i18n calls

Files:

  • src/blocks/checkin-time/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/checkin-time/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/checkin-time/index.js
  • build/blocks/checkin-time/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/checkin-time/index.js
  • build/blocks/checkin-time/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/checkin-time/index.js
  • build/blocks/checkin-time/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/checkin-time/index.js
  • build/blocks/checkin-time/index.js
**/*.{css,js,jsx,ts,tsx}

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

Minimize CSS/JS payload size

Files:

  • src/blocks/checkin-time/index.js
  • build/blocks/checkin-time/index.js
**/*.{js,jsx,ts,tsx}

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

Lazy-load code and resources where possible

Files:

  • src/blocks/checkin-time/index.js
  • build/blocks/checkin-time/index.js
🔇 Additional comments (1)
build/blocks/checkin-time/index.asset.php (1)

1-1: LGTM! Dependency and version updated correctly.

The addition of the wp-i18n dependency aligns with the internationalization work in the source block (where __ is now used for translated strings), and the version hash has been properly updated to reflect the build change.

Note: This is a generated build artifact. Ensure your build process consistently regenerates this file when source dependencies change.

@github-actions github-actions bot added the lang:php PHP code label Oct 8, 2025
@github-actions github-actions bot added status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Oct 9, 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 2e6b2e9 and ca88da6 commits.
Files selected (2)
  • src/blocks/checkin-time/index.js (1)
  • src/blocks/checkout-time/index.js (1)
Files not summarized due to errors (2)
  • src/blocks/checkout-time/index.js (nothing obtained from openai)
  • src/blocks/checkin-time/index.js (nothing obtained from openai)
Files not reviewed due to errors (2)
  • src/blocks/checkin-time/index.js (no response)
  • src/blocks/checkout-time/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 (1)
src/blocks/checkin-time/index.js (1)

16-118: Localise the variation label everywhere.

metadata.name and the preview text are still hard-coded, so the list view and inserter preview stay in English. Please reuse the translated label for these fields as well.

-        wp.blocks.registerBlockVariation('core/group', {
+        const variationLabel = __( 'Check in time', 'tour-operator' );
+
+        wp.blocks.registerBlockVariation('core/group', {
             name: 'lsx-tour-operator/checkin-time',
-            title: __('Check in time', 'tour-operator'),
+            title: variationLabel,
@@
             attributes: {
                 metadata: {
-                    name: 'Check in time',
+                    name: variationLabel,
                 },
@@
             example: {
                 attributes: {
                     metadata: {
-                        name: 'Check in time',
+                        name: variationLabel,
                     },
                 },
                 innerBlocks: [
                     [
                         'core/group',
                         {},
                         [
                             [
                                 'core/heading',
                                 {
-                                    content: 'Check in time',
+                                    content: variationLabel,
                                     level: 3,
                                 },

As per coding guidelines.

📜 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 2e6b2e9 and ca88da6.

⛔ Files ignored due to path filters (4)
  • build/blocks/checkin-time/index.asset.php is excluded by !build/**
  • build/blocks/checkin-time/index.js is excluded by !build/**
  • build/blocks/checkout-time/index.asset.php is excluded by !build/**
  • build/blocks/checkout-time/index.js is excluded by !build/**
📒 Files selected for processing (2)
  • src/blocks/checkin-time/index.js (1 hunks)
  • src/blocks/checkout-time/index.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
src/**/*.{js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use @wordpress/eslint-plugin for JavaScript linting

Files:

  • src/blocks/checkout-time/index.js
  • src/blocks/checkin-time/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 domain tour-operator for JS i18n calls

Files:

  • src/blocks/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/index.js
**/*.{css,js,jsx,ts,tsx}

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

Minimize CSS/JS payload size

Files:

  • src/blocks/checkout-time/index.js
  • src/blocks/checkin-time/index.js
**/*.{js,jsx,ts,tsx}

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

Lazy-load code and resources where possible

Files:

  • src/blocks/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/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/checkout-time/index.js
  • src/blocks/checkin-time/index.js
🧬 Code graph analysis (2)
src/blocks/checkout-time/index.js (1)
src/blocks/checkin-time/index.js (5)
  • wp (129-129)
  • supportedPostTypes (132-132)
  • registered (133-133)
  • checkAndRegister (136-154)
  • interval (159-163)
src/blocks/checkin-time/index.js (2)
src/blocks/checkout-time/index.js (5)
  • wp (129-129)
  • supportedPostTypes (132-132)
  • registered (133-133)
  • checkAndRegister (136-154)
  • interval (159-163)
build/blocks/checkin-time/index.js (5)
  • wp (175-177)
  • supportedPostTypes (180-180)
  • registered (181-181)
  • checkAndRegister (184-198)
  • interval (203-207)
⏰ 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

Comment on lines +16 to +119
name: "lsx-tour-operator/checkout-time",
title: __("Check out time", "tour-operator"),
icon: "clock",
category: "lsx-tour-operator",
isActive: (blockAttributes, variationAttributes) => {
return blockAttributes.metadata?.name === variationAttributes.metadata?.name;
},
},
innerBlocks: [
[
'core/group',
{
layout: {
type: 'flex',
flexWrap: 'nowrap',
verticalAlignment: 'top',
},
attributes: {
metadata: {
name: "Check out time",
},
className: "lsx-checkout-time-wrapper",
layout: {
type: "flex",
flexWrap: "nowrap",
},
},
innerBlocks: [
[
[
'core/image',
{
id: 122720,
width: '20px',
sizeSlug: 'large',
linkDestination: 'none',
url:
lsxToEditor.assetsUrl +
'blocks/check-in-check-out-time.svg',
alt: '',
className: 'wp-image-122720',
"core/group",
{
layout: {
type: "flex",
flexWrap: "nowrap",
verticalAlignment: "middle",
},
],
},
[
'core/paragraph',
{
content: '<strong>Check out time:</strong>',
},
[
"lsx-tour-operator/icons",
{
iconType: "solid",
iconName: "checkInAccommodationIcon",
},
],
[
"core/paragraph",
{
content: __(
'Check out time:',
'tour-operator'
),
},
],
],
],
],
[
'core/group',
{
layout: {
type: 'flex',
flexWrap: 'nowrap',
},
},
[
"core/group",
{
layout: {
type: "flex",
flexWrap: "nowrap",
},
},
[
'core/paragraph',
{
metadata: {
bindings: {
content: {
source: 'lsx/post-meta',
args: {
key: 'checkout_time',
[
"core/paragraph",
{
metadata: {
bindings: {
content: {
source: "lsx/post-meta",
args: {
key: "checkout_time",
},
},
},
},
},
},
],
],
],
],
],
supports: {
renaming: false,
},
} );
} );
supports: {
renaming: false,
},
example: {
attributes: {
metadata: {
name: "Check Out Time",
},
},
innerBlocks: [
[
"core/group",
{},
[
[
"core/heading",
{
content: "Check Out Time",
level: 3,
},
],
[
"core/paragraph",
{
content: "3:00 PM",
},
],
],
],
],
},
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

Translate the variation label and preview.

The checkout variation still hard-codes metadata.name and the preview heading, so they won’t be localised in the editor UI. Please mirror the translated label across these fields.

-        wp.blocks.registerBlockVariation("core/group", {
+        const variationLabel = __( 'Check out time', 'tour-operator' );
+
+        wp.blocks.registerBlockVariation("core/group", {
             name: "lsx-tour-operator/checkout-time",
-            title: __("Check out time", "tour-operator"),
+            title: variationLabel,
@@
             attributes: {
                 metadata: {
-                    name: "Check out time",
+                    name: variationLabel,
                 },
@@
             example: {
                 attributes: {
                     metadata: {
-                        name: "Check Out Time",
+                        name: variationLabel,
                     },
                 },
                 innerBlocks: [
                     [
                         "core/group",
                         {},
                         [
                             [
                                 "core/heading",
                                 {
-                                    content: "Check Out Time",
+                                    content: variationLabel,
                                     level: 3,
                                 },

As per coding guidelines.

📝 Committable suggestion

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

Suggested change
name: "lsx-tour-operator/checkout-time",
title: __("Check out time", "tour-operator"),
icon: "clock",
category: "lsx-tour-operator",
isActive: (blockAttributes, variationAttributes) => {
return blockAttributes.metadata?.name === variationAttributes.metadata?.name;
},
},
innerBlocks: [
[
'core/group',
{
layout: {
type: 'flex',
flexWrap: 'nowrap',
verticalAlignment: 'top',
},
attributes: {
metadata: {
name: "Check out time",
},
className: "lsx-checkout-time-wrapper",
layout: {
type: "flex",
flexWrap: "nowrap",
},
},
innerBlocks: [
[
[
'core/image',
{
id: 122720,
width: '20px',
sizeSlug: 'large',
linkDestination: 'none',
url:
lsxToEditor.assetsUrl +
'blocks/check-in-check-out-time.svg',
alt: '',
className: 'wp-image-122720',
"core/group",
{
layout: {
type: "flex",
flexWrap: "nowrap",
verticalAlignment: "middle",
},
],
},
[
'core/paragraph',
{
content: '<strong>Check out time:</strong>',
},
[
"lsx-tour-operator/icons",
{
iconType: "solid",
iconName: "checkInAccommodationIcon",
},
],
[
"core/paragraph",
{
content: __(
'Check out time:',
'tour-operator'
),
},
],
],
],
],
[
'core/group',
{
layout: {
type: 'flex',
flexWrap: 'nowrap',
},
},
[
"core/group",
{
layout: {
type: "flex",
flexWrap: "nowrap",
},
},
[
'core/paragraph',
{
metadata: {
bindings: {
content: {
source: 'lsx/post-meta',
args: {
key: 'checkout_time',
[
"core/paragraph",
{
metadata: {
bindings: {
content: {
source: "lsx/post-meta",
args: {
key: "checkout_time",
},
},
},
},
},
},
],
],
],
],
],
supports: {
renaming: false,
},
} );
} );
supports: {
renaming: false,
},
example: {
attributes: {
metadata: {
name: "Check Out Time",
},
},
innerBlocks: [
[
"core/group",
{},
[
[
"core/heading",
{
content: "Check Out Time",
level: 3,
},
],
[
"core/paragraph",
{
content: "3:00 PM",
},
],
],
],
],
},
const variationLabel = __( 'Check out time', 'tour-operator' );
wp.blocks.registerBlockVariation( "core/group", {
name: "lsx-tour-operator/checkout-time",
title: variationLabel,
icon: "clock",
category: "lsx-tour-operator",
isActive: ( blockAttributes, variationAttributes ) => {
return blockAttributes.metadata?.name === variationAttributes.metadata?.name;
},
attributes: {
metadata: {
name: variationLabel,
},
className: "lsx-checkout-time-wrapper",
layout: {
type: "flex",
flexWrap: "nowrap",
},
},
innerBlocks: [
[
"core/group",
{
layout: {
type: "flex",
flexWrap: "nowrap",
verticalAlignment: "middle",
},
},
[
[
"lsx-tour-operator/icons",
{
iconType: "solid",
iconName: "checkInAccommodationIcon",
},
],
[
"core/paragraph",
{
content: __(
'Check out time:',
'tour-operator'
),
},
],
],
],
[
"core/group",
{
layout: {
type: "flex",
flexWrap: "nowrap",
},
},
[
[
"core/paragraph",
{
metadata: {
bindings: {
content: {
source: "lsx/post-meta",
args: {
key: "checkout_time",
},
},
},
},
},
],
],
],
],
supports: {
renaming: false,
},
example: {
attributes: {
metadata: {
name: variationLabel,
},
},
innerBlocks: [
[
"core/group",
{},
[
[
"core/heading",
{
content: variationLabel,
level: 3,
},
],
[
"core/paragraph",
{
content: "3:00 PM",
},
],
],
],
],
},
} );
🤖 Prompt for AI Agents
In src/blocks/checkout-time/index.js around lines 16 to 119, the variation’s
metadata.name and the example preview heading are hard-coded and not localised;
replace those literal strings with the translation function so both the
variation label and the preview heading use __('Check out time',
'tour-operator') (or the appropriate case variant) so the metadata.name in
attributes and the example innerBlocks heading content are wrapped with __()
using the 'tour-operator' text domain.

@github-actions github-actions bot added status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Oct 9, 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 ca88da6 and ba45885 commits.
Files selected (2)
  • src/blocks/checkin-time/index.js (1)
  • src/blocks/checkout-time/index.js (1)
Files not summarized due to errors (2)
  • src/blocks/checkout-time/index.js (nothing obtained from openai)
  • src/blocks/checkin-time/index.js (nothing obtained from openai)
Files not reviewed due to errors (2)
  • src/blocks/checkout-time/index.js (no response)
  • src/blocks/checkin-time/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.

@github-actions github-actions bot added status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Oct 9, 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: 2

📜 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 ca88da6 and ba45885.

⛔ Files ignored due to path filters (4)
  • build/blocks/checkin-time/index.asset.php is excluded by !build/**
  • build/blocks/checkin-time/index.js is excluded by !build/**
  • build/blocks/checkout-time/index.asset.php is excluded by !build/**
  • build/blocks/checkout-time/index.js is excluded by !build/**
📒 Files selected for processing (2)
  • src/blocks/checkin-time/index.js (1 hunks)
  • src/blocks/checkout-time/index.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
src/**/*.{js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use @wordpress/eslint-plugin for JavaScript linting

Files:

  • src/blocks/checkin-time/index.js
  • src/blocks/checkout-time/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 domain tour-operator for JS i18n calls

Files:

  • src/blocks/checkin-time/index.js
  • src/blocks/checkout-time/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/checkin-time/index.js
  • src/blocks/checkout-time/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/checkin-time/index.js
  • src/blocks/checkout-time/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/checkin-time/index.js
  • src/blocks/checkout-time/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/checkin-time/index.js
  • src/blocks/checkout-time/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/checkin-time/index.js
  • src/blocks/checkout-time/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/checkin-time/index.js
  • src/blocks/checkout-time/index.js
**/*.{css,js,jsx,ts,tsx}

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

Minimize CSS/JS payload size

Files:

  • src/blocks/checkin-time/index.js
  • src/blocks/checkout-time/index.js
**/*.{js,jsx,ts,tsx}

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

Lazy-load code and resources where possible

Files:

  • src/blocks/checkin-time/index.js
  • src/blocks/checkout-time/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/checkin-time/index.js
  • src/blocks/checkout-time/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/checkin-time/index.js
  • src/blocks/checkout-time/index.js
🧬 Code graph analysis (2)
src/blocks/checkin-time/index.js (2)
src/blocks/checkout-time/index.js (5)
  • wp (129-129)
  • supportedPostTypes (132-132)
  • registered (133-133)
  • checkAndRegister (136-154)
  • interval (159-163)
build/blocks/checkin-time/index.js (5)
  • wp (175-177)
  • supportedPostTypes (180-180)
  • registered (181-181)
  • checkAndRegister (184-198)
  • interval (203-207)
src/blocks/checkout-time/index.js (1)
src/blocks/checkin-time/index.js (5)
  • wp (129-129)
  • supportedPostTypes (132-132)
  • registered (133-133)
  • checkAndRegister (136-154)
  • interval (159-163)
⏰ 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

Comment on lines +148 to +151
if (supportedPostTypes.includes(postType) || ((postType === 'wp_template' || postType === 'wp_template_part') && postSlug.includes('accommodation'))) {
registerCheckinTimeVariation();
registered = true;
}
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

Only set registered when registration succeeds.

We ignore the boolean returned by registerCheckinTimeVariation(), so a caught exception marks the variation as registered and we never retry. This leaves the block variation unregistered.

Apply this diff:

-        if (supportedPostTypes.includes(postType) || ((postType === 'wp_template' || postType === 'wp_template_part') && postSlug.includes('accommodation'))) {
-            registerCheckinTimeVariation();
-            registered = true;
-        }
+        if (supportedPostTypes.includes(postType) || ((postType === 'wp_template' || postType === 'wp_template_part') && postSlug.includes('accommodation'))) {
+            if (registerCheckinTimeVariation()) {
+                registered = true;
+            }
+        }
📝 Committable suggestion

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

Suggested change
if (supportedPostTypes.includes(postType) || ((postType === 'wp_template' || postType === 'wp_template_part') && postSlug.includes('accommodation'))) {
registerCheckinTimeVariation();
registered = true;
}
if (
supportedPostTypes.includes(postType) ||
(
(postType === 'wp_template' || postType === 'wp_template_part') &&
postSlug.includes('accommodation')
)
) {
if ( registerCheckinTimeVariation() ) {
registered = true;
}
}
🤖 Prompt for AI Agents
In src/blocks/checkin-time/index.js around lines 148 to 151, the code sets
registered = true regardless of whether registerCheckinTimeVariation()
succeeded; update it to call registerCheckinTimeVariation() and capture its
return value or await it if async, then set registered = true only when that
call returns a truthy success value; additionally wrap the call in a try/catch
(or preserve existing one) and ensure the catch does not set registered, instead
log or rethrow the error so failed registrations can be retried.

Comment on lines +148 to +151
if (supportedPostTypes.includes(postType) || ((postType === 'wp_template' || postType === 'wp_template_part') && postSlug.includes('accommodation'))) {
registerCheckoutTimeVariation();
registered = true;
}
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

Guard the registered flag with the function’s return value.

registerCheckoutTimeVariation() can return false when registerBlockVariation throws, yet we still flip registered to true, so we never retry and the variation stays unavailable. Wrap the assignment so the flag is only set when registration actually succeeds.

Apply this diff:

-        if (supportedPostTypes.includes(postType) || ((postType === 'wp_template' || postType === 'wp_template_part') && postSlug.includes('accommodation'))) {
-            registerCheckoutTimeVariation();
-            registered = true;
-        }
+        if (supportedPostTypes.includes(postType) || ((postType === 'wp_template' || postType === 'wp_template_part') && postSlug.includes('accommodation'))) {
+            if (registerCheckoutTimeVariation()) {
+                registered = true;
+            }
+        }
📝 Committable suggestion

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

Suggested change
if (supportedPostTypes.includes(postType) || ((postType === 'wp_template' || postType === 'wp_template_part') && postSlug.includes('accommodation'))) {
registerCheckoutTimeVariation();
registered = true;
}
if (
supportedPostTypes.includes(postType) ||
(
(postType === 'wp_template' || postType === 'wp_template_part') &&
postSlug.includes('accommodation')
)
) {
if ( registerCheckoutTimeVariation() ) {
registered = true;
}
}
🤖 Prompt for AI Agents
In src/blocks/checkout-time/index.js around lines 148 to 151,
registerCheckoutTimeVariation() can return false when registration fails but the
code unconditionally sets registered = true; change this so you capture the
function's return value and only set registered = true when that return value is
truthy (i.e., registration succeeded), ensuring failed attempts don't mark the
variation as registered and allowing retries.

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 Ive reviewed and tested the code changes, Im happy for this to be merged in.

Added icon block icons for checkin/checkout times and a filter for relevant post types. Updated changelog with recent changes and integrations.

Signed-off-by: Tibi Buzdugan <buzdugan.tiberiu@gmail.com>
@github-actions github-actions bot added lang:md Markdown content/docs status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Oct 9, 2025
@tibiii tibiii merged commit 0e414f1 into 2.1-trunk Oct 9, 2025
5 of 8 checks passed
@github-project-automation github-project-automation bot moved this from Needs Triage to ✅ Done in Tour Operator Oct 9, 2025
@tibiii tibiii deleted the refactor/checkin-checkout-blocks branch October 9, 2025 11:41
@github-actions github-actions bot added status:needs-review Awaiting code review and removed status:needs-review Awaiting code review labels Oct 9, 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 ba45885 and f031724 commits.
Files selected (1)
  • changelog.md (1)
Files not summarized due to errors (1)
  • changelog.md (nothing obtained from openai)
Files not reviewed due to errors (1)
  • changelog.md (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 comp:block-json Block metadata (block.json) comp:block-supports Block supports comp:block-variations Block variations lang:javascript lang:md Markdown content/docs lang:php PHP code meta:needs-changelog Requires a changelog entry before merge status:needs-review Awaiting code review

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Block Audit: checkin-time & checkout-time blocks (Accommodation post type meta & icons integration)

4 participants