From 148d7e83d587e4afb9434e573d675d26f21ef8ef Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 16:49:02 -0400 Subject: [PATCH 01/11] Remove unused view.js --- .../featured-and-events-section/block.json | 1 - .../featured-and-events-section/view.js | 25 ------------------- .../featured-collection-section/block.json | 3 +-- .../featured-collection-section/view.js | 25 ------------------- .../blocks/hero-section/block.json | 1 - .../mitlib-blocks/blocks/hero-section/view.js | 25 ------------------- .../using-the-libraries-section/block.json | 3 +-- .../using-the-libraries-section/view.js | 25 ------------------- 8 files changed, 2 insertions(+), 106 deletions(-) delete mode 100644 web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/view.js delete mode 100644 web/app/plugins/mitlib-blocks/blocks/featured-collection-section/view.js delete mode 100644 web/app/plugins/mitlib-blocks/blocks/hero-section/view.js delete mode 100644 web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/view.js diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/block.json b/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/block.json index 6911fa56..176ba572 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/block.json +++ b/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/block.json @@ -21,6 +21,5 @@ "editorScript": "file:./index.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", - "viewScript": "file:./view.js", "render": "file:./render.php" } diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/view.js b/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/view.js deleted file mode 100644 index 85cb3620..00000000 --- a/web/app/plugins/mitlib-blocks/blocks/featured-and-events-section/view.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Use this file for JavaScript code that you want to run in the front-end - * on posts/pages that contain this block. - * - * When this file is defined as the value of the `viewScript` property - * in `block.json` it will be enqueued on the front end of the site. - * - * Example: - * - * ```js - * { - * "viewScript": "file:./view.js" - * } - * ``` - * - * If you're not making any changes to this file because your project doesn't need any - * JavaScript running in the front-end, then you should delete this file and remove - * the `viewScript` property from `block.json`. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script - */ - -/* eslint-disable no-console */ -console.log( 'Hello World! (from mitlib-featured-and-events-section block)' ); -/* eslint-enable no-console */ diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/block.json b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/block.json index 30f01b97..bcd5aab9 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/block.json +++ b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/block.json @@ -14,6 +14,5 @@ "textdomain": "mitlib-blocks", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/view.js b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/view.js deleted file mode 100644 index c6a1baa3..00000000 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/view.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Use this file for JavaScript code that you want to run in the front-end - * on posts/pages that contain this block. - * - * When this file is defined as the value of the `viewScript` property - * in `block.json` it will be enqueued on the front end of the site. - * - * Example: - * - * ```js - * { - * "viewScript": "file:./view.js" - * } - * ``` - * - * If you're not making any changes to this file because your project doesn't need any - * JavaScript running in the front-end, then you should delete this file and remove - * the `viewScript` property from `block.json`. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script - */ - -/* eslint-disable no-console */ -console.log( 'Hello World! (from mitlib-featured-collection-section block)' ); -/* eslint-enable no-console */ diff --git a/web/app/plugins/mitlib-blocks/blocks/hero-section/block.json b/web/app/plugins/mitlib-blocks/blocks/hero-section/block.json index 2586f08a..e133a25f 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hero-section/block.json +++ b/web/app/plugins/mitlib-blocks/blocks/hero-section/block.json @@ -21,6 +21,5 @@ "editorScript": "file:./index.js", "editorStyle": "file:./index.css", "style": "file:./style-index.css", - "viewScript": "file:./view.js", "render": "file:./render.php" } diff --git a/web/app/plugins/mitlib-blocks/blocks/hero-section/view.js b/web/app/plugins/mitlib-blocks/blocks/hero-section/view.js deleted file mode 100644 index ae94783d..00000000 --- a/web/app/plugins/mitlib-blocks/blocks/hero-section/view.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Use this file for JavaScript code that you want to run in the front-end - * on posts/pages that contain this block. - * - * When this file is defined as the value of the `viewScript` property - * in `block.json` it will be enqueued on the front end of the site. - * - * Example: - * - * ```js - * { - * "viewScript": "file:./view.js" - * } - * ``` - * - * If you're not making any changes to this file because your project doesn't need any - * JavaScript running in the front-end, then you should delete this file and remove - * the `viewScript` property from `block.json`. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script - */ - -/* eslint-disable no-console */ -console.log( 'Hello World! (from mitlib-hero-section block)' ); -/* eslint-enable no-console */ diff --git a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/block.json b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/block.json index d86c23ae..e5f71a27 100644 --- a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/block.json +++ b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/block.json @@ -36,6 +36,5 @@ "textdomain": "mitlib-blocks", "editorScript": "file:./index.js", "editorStyle": "file:./index.css", - "style": "file:./style-index.css", - "viewScript": "file:./view.js" + "style": "file:./style-index.css" } diff --git a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/view.js b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/view.js deleted file mode 100644 index 573b3df4..00000000 --- a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/view.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Use this file for JavaScript code that you want to run in the front-end - * on posts/pages that contain this block. - * - * When this file is defined as the value of the `viewScript` property - * in `block.json` it will be enqueued on the front end of the site. - * - * Example: - * - * ```js - * { - * "viewScript": "file:./view.js" - * } - * ``` - * - * If you're not making any changes to this file because your project doesn't need any - * JavaScript running in the front-end, then you should delete this file and remove - * the `viewScript` property from `block.json`. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#view-script - */ - -/* eslint-disable no-console */ -console.log( 'Hello World! (from mitlib-using-the-libraries-section block)' ); -/* eslint-enable no-console */ From f80850de6ce71b86cedd0f9a1c77357ec54bc65f Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 16:49:18 -0400 Subject: [PATCH 02/11] Remove "main" entry from package.json --- web/app/plugins/mitlib-blocks/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/web/app/plugins/mitlib-blocks/package.json b/web/app/plugins/mitlib-blocks/package.json index 7c3c8875..a30ed917 100644 --- a/web/app/plugins/mitlib-blocks/package.json +++ b/web/app/plugins/mitlib-blocks/package.json @@ -4,7 +4,6 @@ "description": "Custom MIT Libraries editor blocks.", "author": "MIT Libraries", "license": "GPL-2.0-or-later", - "main": "build/index.js", "scripts": { "build": "wp-scripts build --blocks-manifest --source-path=blocks", "format": "wp-scripts format", From 31d5f1be063b98892c84531c2a02fd33e8b5c0d7 Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 16:50:06 -0400 Subject: [PATCH 03/11] UPDATE ME - remove dependencies These packages are not needed in this way - need to work out how to specify them. Declare WordPress packages as dev dependencies --- web/app/plugins/mitlib-blocks/package.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/web/app/plugins/mitlib-blocks/package.json b/web/app/plugins/mitlib-blocks/package.json index a30ed917..823c783b 100644 --- a/web/app/plugins/mitlib-blocks/package.json +++ b/web/app/plugins/mitlib-blocks/package.json @@ -13,13 +13,11 @@ "plugin-zip": "wp-scripts plugin-zip", "start": "wp-scripts start --blocks-manifest --source-path=blocks" }, - "dependencies": { - "@wordpress/block-editor": "latest", - "@wordpress/blocks": "latest", - "@wordpress/components": "latest", - "@wordpress/i18n": "latest" - }, "devDependencies": { + "@wordpress/block-editor": "^17.0.0", + "@wordpress/blocks": "^15.27.0", + "@wordpress/components": "^40.0.0", + "@wordpress/i18n": "^6.27.0", "@wordpress/scripts": "^34.2.0" } } From f57fd929887a5c574c04fa47fd1ed2f892df09e6 Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 17:02:35 -0400 Subject: [PATCH 04/11] npm run format --- .../featured-collection-section/edit.js | 2 +- .../featured-collection-section/save.js | 28 ++++- .../mitlib-blocks/blocks/hero-section/edit.js | 22 ++-- .../mitlib-blocks/blocks/hero-section/save.js | 2 +- .../blocks/hours-section/edit.js | 64 +++++----- .../blocks/hours-section/save.js | 62 ++++++++-- .../using-the-libraries-section/edit.js | 99 ++++++++++------ .../using-the-libraries-section/save.js | 109 +++++++++++++----- 8 files changed, 265 insertions(+), 123 deletions(-) diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/edit.js b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/edit.js index e7bb602e..b96cf610 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/edit.js +++ b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/edit.js @@ -31,6 +31,6 @@ export default function Edit() { return (

Featured collection (No title to edit)

-
+ ); } diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js index 6c9642c2..b98f70c7 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js @@ -19,15 +19,35 @@ export default function save() { return ( diff --git a/web/app/plugins/mitlib-blocks/blocks/hero-section/edit.js b/web/app/plugins/mitlib-blocks/blocks/hero-section/edit.js index 68226f46..d91337a4 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hero-section/edit.js +++ b/web/app/plugins/mitlib-blocks/blocks/hero-section/edit.js @@ -14,16 +14,16 @@ import { useBlockProps, RichText } from '@wordpress/block-editor'; import './editor.scss'; export default function Edit( { attributes, setAttributes } ) { - const blockProps = useBlockProps(); + const blockProps = useBlockProps(); - return ( -
- setAttributes( { heading } ) } - placeholder={ __( 'Enter heading…', 'mitlib-blocks' ) } - /> -
- ); + return ( +
+ setAttributes( { heading } ) } + placeholder={ __( 'Enter heading…', 'mitlib-blocks' ) } + /> +
+ ); } diff --git a/web/app/plugins/mitlib-blocks/blocks/hero-section/save.js b/web/app/plugins/mitlib-blocks/blocks/hero-section/save.js index 34a57a53..fa631549 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hero-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/hero-section/save.js @@ -16,5 +16,5 @@ import { useBlockProps } from '@wordpress/block-editor'; * @return {Element} Element to render. */ export default function save() { - return null; + return null; } diff --git a/web/app/plugins/mitlib-blocks/blocks/hours-section/edit.js b/web/app/plugins/mitlib-blocks/blocks/hours-section/edit.js index d2042d8c..98f66d54 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hours-section/edit.js +++ b/web/app/plugins/mitlib-blocks/blocks/hours-section/edit.js @@ -4,7 +4,11 @@ * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/ */ import { __ } from '@wordpress/i18n'; -import { useBlockProps, RichText, InspectorControls } from '@wordpress/block-editor'; +import { + useBlockProps, + RichText, + InspectorControls, +} from '@wordpress/block-editor'; import { PanelBody, TextControl } from '@wordpress/components'; import './editor.scss'; @@ -13,32 +17,38 @@ export default function Edit( { attributes, setAttributes } ) { return ( <> - - - setAttributes( { linkText: value } ) } - /> - setAttributes( { linkUrl: value } ) } - type="url" - /> - - -
-
- setAttributes( { heading: value } ) } - placeholder={ __( 'Today\'s hours', 'mitlib-blocks' ) } - allowedFormats={ [] } - /> -
-
+ + + + setAttributes( { linkText: value } ) + } + /> + + setAttributes( { linkUrl: value } ) + } + type="url" + /> + + +
+
+ + setAttributes( { heading: value } ) + } + placeholder={ __( "Today's hours", 'mitlib-blocks' ) } + allowedFormats={ [] } + /> +
+
); } diff --git a/web/app/plugins/mitlib-blocks/blocks/hours-section/save.js b/web/app/plugins/mitlib-blocks/blocks/hours-section/save.js index c6ad2181..fc93d5da 100644 --- a/web/app/plugins/mitlib-blocks/blocks/hours-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/hours-section/save.js @@ -15,36 +15,74 @@ export default function save( { attributes } ) {
  1. - Hayden Library - + + + Hayden Library + + + + + - + 24/7 study
  2. - Rotch Library - + + + Rotch Library + + + + + - + 24/7 study
  3. - Barker Library - + + + Barker Library + + + + + - + 24/7 study
  4. - Lewis Music Library - + + + Lewis Music Library + + + + +
- { linkText } + + { linkText } + ); diff --git a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/edit.js b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/edit.js index fb8efba7..8d7893fa 100644 --- a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/edit.js +++ b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/edit.js @@ -4,51 +4,74 @@ * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/ */ import { __ } from '@wordpress/i18n'; -import { useBlockProps, RichText, InspectorControls } from '@wordpress/block-editor'; +import { + useBlockProps, + RichText, + InspectorControls, +} from '@wordpress/block-editor'; import { PanelBody, TextControl, TextareaControl } from '@wordpress/components'; import './editor.scss'; export default function Edit( { attributes, setAttributes } ) { - const { heading, askUsTitle, askUsDescription, askUsLinkText, askUsLinkUrl } = attributes; + const { + heading, + askUsTitle, + askUsDescription, + askUsLinkText, + askUsLinkUrl, + } = attributes; return ( <> - - - setAttributes( { askUsTitle: value } ) } - /> - setAttributes( { askUsDescription: value } ) } - /> - setAttributes( { askUsLinkText: value } ) } - /> - setAttributes( { askUsLinkUrl: value } ) } - type="url" - /> - - -
-
- setAttributes( { heading: value } ) } - placeholder={ __( 'Using the Libraries', 'mitlib-blocks' ) } - allowedFormats={ [] } - /> -
-
+ + + + setAttributes( { askUsTitle: value } ) + } + /> + + setAttributes( { askUsDescription: value } ) + } + /> + + setAttributes( { askUsLinkText: value } ) + } + /> + + setAttributes( { askUsLinkUrl: value } ) + } + type="url" + /> + + +
+
+ + setAttributes( { heading: value } ) + } + placeholder={ __( + 'Using the Libraries', + 'mitlib-blocks' + ) } + allowedFormats={ [] } + /> +
+
); } diff --git a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/save.js b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/save.js index 0efb0ef2..6700a6bc 100644 --- a/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/using-the-libraries-section/save.js @@ -7,45 +7,96 @@ import { useBlockProps, RichText } from '@wordpress/block-editor'; export default function save( { attributes } ) { - const { heading, askUsTitle, askUsDescription, askUsLinkText, askUsLinkUrl } = attributes; + const { + heading, + askUsTitle, + askUsDescription, + askUsLinkText, + askUsLinkUrl, + } = attributes; return (
-
-
- -
-

Find a study space

-

Quiet and group spaces—many available 24/7

+
+
+ +
+

+ Find a study space +

+

+ Quiet and group spaces—many available 24/7 +

+
-
-
- -
-

Learn how to get materials

-

Find, request, and get articles, books, and more

+
+ +
+

+ + Learn how to get materials + +

+

+ Find, request, and get articles, books, and + more +

+
-
-
- -
-

Discover guides & librarians

-

Resource and class guides with experts for every subject

+
+ +
+

+ + Discover guides & librarians + +

+

+ Resource and class guides with experts for + every subject +

+
-
-
- -
-

Find and manage data

-

Get support from creating and visualizing to using and sharing data

+
+ +
+

+ + Find and manage data + +

+

+ Get support from creating and visualizing to + using and sharing data +

+
-
-
-
- +
+
+

{ askUsTitle }

{ askUsDescription }

From a73f895d77f254ef11edf5ebbd626f979c1006fe Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Tue, 8 Sep 2026 20:30:44 -0400 Subject: [PATCH 05/11] replace class with className in javascript files --- .../featured-collection-section/save.js | 14 ++++----- .../using-the-libraries-section/edit.js | 2 +- .../using-the-libraries-section/save.js | 30 +++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js index b98f70c7..3830d12f 100644 --- a/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js +++ b/web/app/plugins/mitlib-blocks/blocks/featured-collection-section/save.js @@ -18,18 +18,18 @@ import { useBlockProps } from '@wordpress/block-editor'; export default function save() { return (