# Page Component

The Page component calls these methods to see which blocks should be rendered. The Page component calls these methods to get the data that is associated with each block.

{% code title="ShowroomBlock.tsx" %}

```javascript
/**
 * Called from WP's block preview screen.
 * Separate from getServerSideProps because private/session based data might need to be mocked.
 * @returns
 */
export const getPreviewProps = async () => {
	return await getPropsData();
};

/**
 * Called by the page the block exists on within it's getServerSideProps method.
 * The result is passed to the component props.
 * @returns
 */
export const getServerSideProps = async () => {
	return await getPropsData();
};
```

{% endcode %}

Register Block

{% code title="gravity-platform-core.php" %}

```php
function gravity_platform_core_blocks_init()
{
	register_block_type(__DIR__ . '/src/blocks/showroom');
  register_block_type(__DIR__ . '/src/blocks/promotions');
}
add_action('init', 'gravity_platform_core_blocks_init');
```

{% endcode %}

Add to frontend > components > blocks

### \[slug] - Detail Page

In \[...slug] the post type should be the same as the post type name in the backend.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shaunh.gitbook.io/kairos/page-component.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
