diff --git a/.gitignore b/.gitignore index 7e532df..90124a4 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,9 @@ wp-config.php # Note: If you wish to whitelist themes, # uncomment the next line #/wp-content/themes + +# ---> Node.js +/node_modules/ +/package-lock.json + + diff --git a/blocks-register.php b/blocks-register.php new file mode 100644 index 0000000..e336d05 --- /dev/null +++ b/blocks-register.php @@ -0,0 +1,21 @@ + 'ssi_render_block', + ] ); +} +add_action( 'init', 'ssi_register_space_status_block' ); + +/** + * Server‑side markup for the block. + */ +function ssi_render_block( array $attributes, string $content ) : string { + // Re‑use existing helper & CSS class logic. + return ssi_shortcode(); +} \ No newline at end of file diff --git a/build/space-status/block.json b/build/space-status/block.json new file mode 100644 index 0000000..5445335 --- /dev/null +++ b/build/space-status/block.json @@ -0,0 +1,15 @@ +{ + "apiVersion": 3, + "name": "wp-spaceapi-consumer/space-status", + "title": "Space Status", + "description": "Show whether the space is open or closed (SpaceAPI consumer).", + "category": "widgets", + "icon": "info", + "textdomain": "wp-spaceapi-consumer", + "style": "file:./style.css", + "editorStyle": "file:./editor.css", + "editorScript": "file:./index.js", + "supports": { + "html": false + } +} \ No newline at end of file diff --git a/build/space-status/index.asset.php b/build/space-status/index.asset.php new file mode 100644 index 0000000..f246a90 --- /dev/null +++ b/build/space-status/index.asset.php @@ -0,0 +1 @@ + array('react-jsx-runtime', 'wp-blocks', 'wp-i18n', 'wp-server-side-render'), 'version' => 'e81eff0b8644d0be4dac'); diff --git a/build/space-status/index.js b/build/space-status/index.js new file mode 100644 index 0000000..ce0184c --- /dev/null +++ b/build/space-status/index.js @@ -0,0 +1 @@ +(()=>{"use strict";var e={n:r=>{var s=r&&r.__esModule?()=>r.default:()=>r;return e.d(s,{a:s}),s},d:(r,s)=>{for(var t in s)e.o(s,t)&&!e.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:s[t]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)};window.wp.i18n;const r=window.wp.blocks,s=window.wp.serverSideRender;var t=e.n(s);const o=window.ReactJSXRuntime;(0,r.registerBlockType)("wp-spaceapi-consumer/space-status",{edit:()=>(0,o.jsx)(t(),{block:"wp-spaceapi-consumer/space-status"}),save:()=>null})})(); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..e27bbd7 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "wp-spaceapi-consumer", + "version": "0.0.0-private", + "private": true, + "scripts": { + "build": "wp-scripts build", + "start": "wp-scripts start" + }, + "devDependencies": { + "@wordpress/scripts": "^30.18.0" + }, + "engines": { + "node": ">=18.0.0" + } +} \ No newline at end of file diff --git a/src/space-status/block.json b/src/space-status/block.json new file mode 100644 index 0000000..fab63ba --- /dev/null +++ b/src/space-status/block.json @@ -0,0 +1,13 @@ +{ + "apiVersion": 3, + "name": "wp-spaceapi-consumer/space-status", + "title": "Space Status", + "description": "Show whether the space is open or closed (SpaceAPI consumer).", + "category": "widgets", + "icon": "info", + "textdomain": "wp-spaceapi-consumer", + "style": "file:./style.css", + "editorStyle": "file:./editor.css", + "editorScript": "file:./index.js", + "supports": { "html": false } +} \ No newline at end of file diff --git a/src/space-status/editor.css b/src/space-status/editor.css new file mode 100644 index 0000000..e69de29 diff --git a/src/space-status/index.js b/src/space-status/index.js new file mode 100644 index 0000000..c01d125 --- /dev/null +++ b/src/space-status/index.js @@ -0,0 +1,12 @@ +import { __ } from '@wordpress/i18n'; +import { registerBlockType } from '@wordpress/blocks'; +import ServerSideRender from '@wordpress/server-side-render'; + +registerBlockType( 'wp-spaceapi-consumer/space-status', { + edit: () => ( + + ), + save: () => null, // dynamic block — markup comes from PHP +} ); \ No newline at end of file diff --git a/src/space-status/style.css b/src/space-status/style.css new file mode 100644 index 0000000..97e7011 --- /dev/null +++ b/src/space-status/style.css @@ -0,0 +1 @@ +@import url('../wp-spaceapi-consumer-style.css'); \ No newline at end of file