From b55b8d2d86ee654bbea907259922450e95abcea3 Mon Sep 17 00:00:00 2001 From: ngqile Date: Fri, 4 Dec 2026 09:46:32 +0800 Subject: [PATCH] feat(pages): a hero can run full width with points and a form card heading A full-width hero spans the window with a larger serif headline and a lighter left-to-right shade. It may list up to 6 points and give its form card a heading and text. Full-width neighbours join with no gap. Custom HTML frames now shrink to 20 px and re-report their height when the page asks, so a short top bar no longer leaves a blank band. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs --- docs/deployment.md | 2 + local/seed/04-zh-cn-messages.sql | 10 +++ .../add-hero-full-width/.openspec.yaml | 2 + .../changes/add-hero-full-width/design.md | 25 ++++++ .../changes/add-hero-full-width/proposal.md | 59 +++++++++++++ .../specs/landing-pages/spec.md | 86 +++++++++++++++++++ .../sql/01-hero-full-width-labels.sql | 13 +++ openspec/changes/add-hero-full-width/tasks.md | 69 +++++++++++++++ .../app/components/pages/BlockFields.tsx | 38 +++++--- .../components/pages/CmsBlocks.html.test.tsx | 15 +++- .../app/components/pages/CmsBlocks.test.tsx | 42 ++++++++- .../app/components/pages/CmsBlocks.tsx | 76 +++++++++++++--- .../app/components/pages/HtmlFrame.tsx | 8 +- .../app/components/pages/PageEditor.test.tsx | 27 ++++++ .../components/pages/usePageDraft.test.tsx | 10 +++ .../app/components/pages/usePageDraft.ts | 11 ++- solvway-admin-portal/app/lib/cmsPages.ts | 6 +- .../app/lib/frameHtml.anchor.test.ts | 9 ++ .../app/lib/frameHtml.test.ts | 6 +- solvway-admin-portal/app/lib/frameHtml.ts | 8 +- .../app/lib/i18n/defaultMessages.ts | 5 ++ .../app/lib/i18n/zh_CN.seed.json | 5 ++ .../services/counter/dto/CmsBlock.java | 7 +- .../counter/service/CmsBlockValidator.java | 26 ++++-- .../service/CmsBlockValidatorTest.java | 56 ++++++++++++ 25 files changed, 575 insertions(+), 46 deletions(-) create mode 100644 openspec/changes/add-hero-full-width/.openspec.yaml create mode 100644 openspec/changes/add-hero-full-width/design.md create mode 100644 openspec/changes/add-hero-full-width/proposal.md create mode 100644 openspec/changes/add-hero-full-width/specs/landing-pages/spec.md create mode 100644 openspec/changes/add-hero-full-width/sql/01-hero-full-width-labels.sql create mode 100644 openspec/changes/add-hero-full-width/tasks.md diff --git a/docs/deployment.md b/docs/deployment.md index b9b3b3e..7a34c06 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -466,4 +466,6 @@ A form stops taking sign-ups when its event is disabled, its end date has passed **Release add-hero-signup-form (SQL, in its OpenSpec change folder):** deploy services-counter, mobile-api and the portal (any order), then run `sql/01-hero-form-labels.sql` (labels only). A hero section can now carry the sign-up form for an event, beside its text. Rollback: the previous images. A hero saved with an event keeps it in its JSON. The old code ignores it and shows the hero without a form, so add a Sign-up form section to those pages if you roll back. +**Release add-hero-full-width (SQL, in its OpenSpec change folder):** deploy services-counter, then the portal, then run `sql/01-hero-full-width-labels.sql` (labels only). Deploy services-counter first, because the portal's editor saves the new hero fields. A hero can now run full width, carry bullet points, and give its form card a heading. Custom HTML frames now shrink to fit short content and no longer leave a gap next to a full-width hero. Rollback: the previous images. Saved heroes keep the new fields in their JSON; the old code ignores them and shows the boxed hero. The old services-counter refuses to save a hero that has points or a form heading, so remove them before saving such a page. + **New portal dependencies:** `@tiptap/react`, `@tiptap/pm`, `@tiptap/starter-kit` and `@tiptap/extension-text-align` (the editor, loaded only on the editor screens), and `sanitize-html` (cleans page text on the server before it reaches a visitor). The image build installs them from `package-lock.json`; nothing to do by hand. diff --git a/local/seed/04-zh-cn-messages.sql b/local/seed/04-zh-cn-messages.sql index 29b3a04..b829b3c 100644 --- a/local/seed/04-zh-cn-messages.sql +++ b/local/seed/04-zh-cn-messages.sql @@ -1717,6 +1717,16 @@ INSERT INTO message (code, content, area) SELECT 'PagesHeroForm', JSON_OBJECT('e UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '报名表单') WHERE LOWER(code) = LOWER('PagesHeroForm') AND area = 'A'; INSERT INTO message (code, content, area) SELECT 'PagesNoForm', JSON_OBJECT('en_US', 'No form', 'zh_CN', '不显示表单'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesNoForm') AND area = 'A'); UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '不显示表单') WHERE LOWER(code) = LOWER('PagesNoForm') AND area = 'A'; +INSERT INTO message (code, content, area) SELECT 'PagesFullWidth', JSON_OBJECT('en_US', 'Full width', 'zh_CN', '全宽'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesFullWidth') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '全宽') WHERE LOWER(code) = LOWER('PagesFullWidth') AND area = 'A'; +INSERT INTO message (code, content, area) SELECT 'PagesPointN', JSON_OBJECT('en_US', 'Point {number}', 'zh_CN', '要点 {number}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesPointN') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '要点 {number}') WHERE LOWER(code) = LOWER('PagesPointN') AND area = 'A'; +INSERT INTO message (code, content, area) SELECT 'PagesAddPoint', JSON_OBJECT('en_US', 'Add point', 'zh_CN', '添加要点'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesAddPoint') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '添加要点') WHERE LOWER(code) = LOWER('PagesAddPoint') AND area = 'A'; +INSERT INTO message (code, content, area) SELECT 'PagesFormHeading', JSON_OBJECT('en_US', 'Form heading', 'zh_CN', '表单标题'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesFormHeading') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '表单标题') WHERE LOWER(code) = LOWER('PagesFormHeading') AND area = 'A'; +INSERT INTO message (code, content, area) SELECT 'PagesFormText', JSON_OBJECT('en_US', 'Form text', 'zh_CN', '表单说明'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesFormText') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '表单说明') WHERE LOWER(code) = LOWER('PagesFormText') AND area = 'A'; INSERT INTO message (code, content, area) SELECT 'PagesToolbar', JSON_OBJECT('en_US', 'Formatting', 'zh_CN', '格式'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesToolbar') AND area = 'A'); UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '格式') WHERE LOWER(code) = LOWER('PagesToolbar') AND area = 'A'; INSERT INTO message (code, content, area) SELECT 'PagesTextStyle', JSON_OBJECT('en_US', 'Text style', 'zh_CN', '文字样式'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTextStyle') AND area = 'A'); diff --git a/openspec/changes/add-hero-full-width/.openspec.yaml b/openspec/changes/add-hero-full-width/.openspec.yaml new file mode 100644 index 0000000..2ad7578 --- /dev/null +++ b/openspec/changes/add-hero-full-width/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-12-04 diff --git a/openspec/changes/add-hero-full-width/design.md b/openspec/changes/add-hero-full-width/design.md new file mode 100644 index 0000000..2d46811 --- /dev/null +++ b/openspec/changes/add-hero-full-width/design.md @@ -0,0 +1,25 @@ +# Design + +## Context + +The HERO block renders inside `Section`, which wraps every non-HTML block in the page width (`max-w-5xl px-4`). The page's block list is `space-y-10`. Custom HTML blocks already render outside `Section`, so they run full width. The hero-with-form layout comes from add-hero-signup-form. + +## Approaches + +1. **A `fullWidth` option on HERO (chosen).** Explicit and opt-in, so existing heroes and templates do not change. It costs one boolean and one switch in the editor. +2. **Make every hero with a form full width.** This needs no new field, but it silently changes existing pages and ties two unrelated choices together. +3. **Build the hero in Custom HTML.** This cannot work: a sealed frame cannot hold the real sign-up form (see add-hero-signup-form). + +## Decisions + +- **Points reuse `cards`.** They use title-only cards, as the trust strip does. The DTO does not change, and the editor reuses the trust strip's item list (`PagesItemN`, `PagesAddItem`). On a HERO the validator allows 0 to 6 cards. FEATURES, STEPS and TRUST keep their 2 to 6 rule. +- **Joins.** A block counts as "bleed" when it is HTML, or when it is a full-width HERO. When a block and the block before it are both bleed, the block gets no top margin. Two Custom HTML blocks next to each other therefore join as well. That changes current pages, but only toward what Custom HTML sections expect: built sections are designed to stack. +- **A full-width hero is not wrapped in `Section`.** It renders outside the page width, in the same way as `HtmlSpot`. Its inner content uses a wider container (`max-w-6xl px-4`). +- **Font.** The headline uses Tailwind's `font-serif`, the system serif. No web font is added, so there is no new dependency and no third-party request. +- **Shade.** The full-width shade is a left-to-right gradient, from `black/75` through `black/45` to `black/10`. It stays black-based, because the design-token test refuses raw colours, and the white text sits on the dark side. On phones the layout stacks and the form card is solid, so contrast holds. +- **Form heading and text.** These are plain text fields edited with `Text` in place, in the same way as the hero heading. They are refused on a hero without an event, so they cannot hide in saved data. + +## Risks + +- **Contrast with a light photo on the right.** The text sits on the left, over the darkest part of the shade, and the right side holds the solid form card. This is acceptable. +- **Editor controls on the edge.** On the full-width canvas, the image button and the toolbar sit at the window's edge. They are already positioned inside the section by the PR #66 fix. diff --git a/openspec/changes/add-hero-full-width/proposal.md b/openspec/changes/add-hero-full-width/proposal.md new file mode 100644 index 0000000..f0368c4 --- /dev/null +++ b/openspec/changes/add-hero-full-width/proposal.md @@ -0,0 +1,59 @@ +# Proposal + +## Why + +The INS Hotel technology page is being rebuilt in Co-Lite to match INS's standalone landing page (`~/Projects/ins-landing-page`). Since add-hero-signup-form, the form sits beside the hero text, but the hero still looks unlike the original in five ways: + +- it is a rounded box inside the page width, with grey space around it, where the original runs edge to edge directly under the top bar; +- its shade is near-black over the whole photo, where the original fades from dark on the left to a clear photo on the right; +- its headline is small and pinned to the top, where the original's is large, serif and vertically centred; +- it has no bullet points under the text; +- the form card has no title or subtitle ("Get a free consultation" / "Tell us about your property…"). + +Marketing staff cannot fix any of these from the editor. + +## What Changes + +- A HERO block gains a **Full width** option (`fullWidth`). A full-width hero: + - spans the whole window, with square corners and no page margin; + - is taller, with a larger serif headline, vertically centred; + - uses a lighter shade that runs from dark on the left to almost clear on the right. +- Full-width heroes and Custom HTML blocks that sit next to each other join with no gap, so a Custom HTML top bar runs straight into the hero. +- Custom HTML frames (found in the live check): + - they may shrink to 20 px instead of 100 px, so a 68 px top bar leaves no blank band; + - the page asks each frame for its height once it listens and when the frame loads, because the frame's first report could arrive before the page was ready, leaving it at 600 px. +- A HERO block may carry up to 6 **points**, short title-only lines (`cards`, 80 characters each) shown as a bullet list under its text. The editor reuses the trust strip's item list. +- A HERO with an event may carry a **form heading** (`formHeading`, 80 characters) and **form text** (`formText`, 200 characters), shown at the top of the form card. Both can be typed in place on the canvas. +- The server validates the new fields: + - `fullWidth` is a boolean; + - the hero takes 0 to 6 points, each a non-empty title of at most 80 characters, with no icon or text; + - the form heading and form text are refused on a hero without an event. +- New editor labels in English and Chinese, with an SQL label file for real environments. + +Not changing: +- The heroes that exist today. Without the option they look as they do now. +- The sign-up form's fields, the privacy notice and the consent box. They are shared with QR sign-up, and the notice and consent are required by the data-protection rules. +- Field labels and the interests checkboxes. +- The submit button colour, which follows the company's accent colour. For INS's gold button, set INS's accent colour in Companies; that is a setting, not code. +- The red wave decoration at the bottom of the INS hero, which is left out. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +- `landing-pages`: adds "Full-Width Hero", "Hero Points" and "Hero Form Heading". + +## Impact + +- services-counter: `CmsBlock` gains `fullWidth`, `formHeading` and `formText`. `CmsBlockValidator` lets a HERO carry `cards` as points and checks the new fields. +- mobile-api: none. Public blocks pass through as maps. +- Portal: + - `CmsBlocks.tsx` renders the hero layout and the joins between full-width blocks; + - `BlockFields.tsx` gets the Full width switch, the points list and the form heading and text; + - `cmsPages.ts` gets the types; + - new labels in `defaultMessages.ts` and `zh_CN.seed.json`. +- Data: no schema change, because the blocks are JSON. The new labels need a SQL label file in this change folder for real environments. diff --git a/openspec/changes/add-hero-full-width/specs/landing-pages/spec.md b/openspec/changes/add-hero-full-width/specs/landing-pages/spec.md new file mode 100644 index 0000000..c7c09c8 --- /dev/null +++ b/openspec/changes/add-hero-full-width/specs/landing-pages/spec.md @@ -0,0 +1,86 @@ +## ADDED Requirements + +### Requirement: Full-Width Hero + +A HERO block MAY be marked full width. A full-width hero SHALL span the whole window with square corners, show its heading larger and centred top to bottom in the hero's opening height (not beside a long form), and use a shade that is darker on the text side than on the far side. A hero that is not marked full width SHALL look as it did before. The server SHALL refuse a `fullWidth` value that is not true or false. + +#### Scenario: Hero runs edge to edge under a Custom HTML top bar + +- **GIVEN** page `/p/INS/hotel-technology` with a Custom HTML top bar followed by a full-width HERO with an image and an event +- **WHEN** a visitor opens the page in a 1280 px window +- **THEN** the hero spans the full window width +- **AND** the form card sits beside the heading + +#### Scenario: Existing hero unchanged + +- **WHEN** a visitor opens a page whose HERO block is not marked full width +- **THEN** the hero sits inside the page width with rounded corners, as before + +#### Scenario: Turn on full width in the editor + +- **GIVEN** staff editing a page with a HERO block +- **WHEN** they switch on "Full width" in the hero's settings +- **THEN** the canvas shows the hero across the full width + +### Requirement: Full-Width Blocks Join Without Gaps + +A full-width HERO and a Custom HTML block next to each other SHALL join with no gap between them, and so SHALL two Custom HTML blocks next to each other. Other blocks SHALL keep their usual spacing. + +#### Scenario: Top bar runs straight into the hero + +- **GIVEN** a Custom HTML top bar followed by a full-width HERO +- **WHEN** a visitor opens the page +- **THEN** the hero starts directly under the top bar, with no gap + +### Requirement: Hero Points + +A HERO block MAY carry up to 6 points, each a non-empty title of at most 80 characters, with no icon and no text. The hero SHALL show its points as a bulleted list under its text. The server SHALL refuse more than 6 points, an empty or over-long point, and a point with an icon or text, naming the field. + +#### Scenario: Points under the hero text + +- **GIVEN** a HERO block with points "One accountable partner instead of five vendors" and "Local support team in Malaysia" +- **WHEN** a visitor opens the page +- **THEN** both points show as a bulleted list under the hero text + +#### Scenario: Too many points refused + +- **WHEN** staff save a HERO block with 7 points +- **THEN** the save is refused at `blocks[n].cards` + +### Requirement: Hero Form Heading + +A HERO block with an event MAY carry a form heading of at most 80 characters and a form text of at most 200 characters. The hero SHALL show them at the top of its form card, above the form. The server SHALL refuse either on a hero without an event. On the canvas, staff SHALL be able to type both in place. + +#### Scenario: Card shows its heading + +- **GIVEN** a HERO block with an event, form heading "Get a free consultation" and form text "Tell us about your property. It takes under a minute." +- **WHEN** a visitor opens the page +- **THEN** the form card starts with that heading and text, followed by the form + +#### Scenario: Form heading without a form refused + +- **WHEN** staff save a HERO block with a form heading and no event +- **THEN** the save is refused at `blocks[n].formHeading` + +## MODIFIED Requirements + +### Requirement: Custom HTML Frame Height + +The frame SHALL grow or shrink to fit its content, between 20 and 20000 pixels, using height reports sent by that frame only. Before the first report it SHALL be 600 pixels tall. The frame SHALL report the height of its content, not of its own window, and SHALL report again whenever the page asks, which the page SHALL do once it listens and when the frame loads. + +#### Scenario: A tall paste grows the frame + +- **GIVEN** a published HTML block whose content is 3000 pixels tall +- **WHEN** a visitor opens the page +- **THEN** the frame is 3000 pixels tall and shows no inner scroll bar + +#### Scenario: A short top bar shrinks the frame + +- **GIVEN** a published HTML block holding only a 68 pixel top bar +- **WHEN** a visitor opens the page, even if the frame loaded before the page was ready +- **THEN** the frame is 68 pixels tall, with no blank space below the bar + +#### Scenario: Another frame cannot resize it + +- **WHEN** a different window posts a height report to the page +- **THEN** the frame's height does not change diff --git a/openspec/changes/add-hero-full-width/sql/01-hero-full-width-labels.sql b/openspec/changes/add-hero-full-width/sql/01-hero-full-width-labels.sql new file mode 100644 index 0000000..c4c1632 --- /dev/null +++ b/openspec/changes/add-hero-full-width/sql/01-hero-full-width-labels.sql @@ -0,0 +1,13 @@ +-- The labels added by add-hero-full-width, cut from the output of `npm run i18n:sql`. Run it only in an environment that already ran add-zh-cn-messages/sql/03-zh-cn-messages.sql; otherwise run that 03 file, which includes these labels. +SET NAMES utf8mb4; +USE `service-system`; +INSERT INTO message (code, content, area) SELECT 'PagesFullWidth', JSON_OBJECT('en_US', 'Full width', 'zh_CN', '全宽'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesFullWidth') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '全宽') WHERE LOWER(code) = LOWER('PagesFullWidth') AND area = 'A'; +INSERT INTO message (code, content, area) SELECT 'PagesPointN', JSON_OBJECT('en_US', 'Point {number}', 'zh_CN', '要点 {number}'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesPointN') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '要点 {number}') WHERE LOWER(code) = LOWER('PagesPointN') AND area = 'A'; +INSERT INTO message (code, content, area) SELECT 'PagesAddPoint', JSON_OBJECT('en_US', 'Add point', 'zh_CN', '添加要点'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesAddPoint') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '添加要点') WHERE LOWER(code) = LOWER('PagesAddPoint') AND area = 'A'; +INSERT INTO message (code, content, area) SELECT 'PagesFormHeading', JSON_OBJECT('en_US', 'Form heading', 'zh_CN', '表单标题'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesFormHeading') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '表单标题') WHERE LOWER(code) = LOWER('PagesFormHeading') AND area = 'A'; +INSERT INTO message (code, content, area) SELECT 'PagesFormText', JSON_OBJECT('en_US', 'Form text', 'zh_CN', '表单说明'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesFormText') AND area = 'A'); +UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '表单说明') WHERE LOWER(code) = LOWER('PagesFormText') AND area = 'A'; diff --git a/openspec/changes/add-hero-full-width/tasks.md b/openspec/changes/add-hero-full-width/tasks.md new file mode 100644 index 0000000..1fa0b05 --- /dev/null +++ b/openspec/changes/add-hero-full-width/tasks.md @@ -0,0 +1,69 @@ +# Tasks + +## 1. Server + +- [x] 1.1 services-counter `CmsBlock`: add `fullWidth` (Boolean), `formHeading` and `formText`. `CmsBlockValidator` HERO rules: + - allow `cards` on a HERO, 0 to 6 of them, each with a title that is required and at most 80 characters, and no icon or text; + - `formHeading` at most 80 characters and `formText` at most 200; + - refuse `formHeading` or `formText` without `eventUuid` (`PagesUnusedField`). + + Verify: new validator tests fail first, then pass; `mvn -T 1C -pl solvway-services-counter verify`. + +## 2. Portal + +- [x] 2.1 `cmsPages.ts` types. In `CmsBlocks.tsx`: + - the HERO shows its points as a bulleted list; + - the form card shows `formHeading` and `formText`, editable in place; + - a full-width HERO renders outside the page width, with a larger serif heading, vertical centring and the lighter left-to-right shade; + - adjacent bleed blocks (HTML, or a full-width HERO) get no gap between them. + + Verify: render tests fail first, then pass; vitest exit 0. +- [x] 2.2 `BlockFields.tsx`: + - the Hero gets a "Full width" switch, the points list (reusing the trust strip's item list), and the form heading and text fields, shown only when an event is picked; + - `INLINE.HERO` includes `formHeading`, `formText` and the points; + - add the labels to `defaultMessages.ts`, `zh_CN.seed.json` and `sql/01-hero-full-width-labels.sql`, and regenerate `local/seed/04-zh-cn-messages.sql`. + + Verify: editor tests fail first, then pass; tsc and lint clean. + +## 3. Verification + +- [x] 3.1 Rebuild services-counter. Use Playwright on port 3001 to edit `/p/INS/hotel-technology` through the editor: + - turn on Full width; + - add the three INS points; + - set the form heading and text; + - publish the page. + + Then check the published page at 1280 px and 390 px against the INS page, and check a save with 7 points shows the refusal on the canvas. +- [x] 3.2 Run the full portal vitest (exit 0), tsc, lint, Maven verify for services-counter, and `openspec validate add-hero-full-width --strict`. +- [x] 3.3 Add a release note to `docs/deployment.md` (label SQL). + +## Notes (2026-12-04) + +- **Red first:** + - the validator tests failed on points and the form heading; + - the render tests failed on full width, points, the card heading and the joins; + - the editor and company-switch tests failed; + - the frame floor, ask and answer tests failed. +- **Changed existing tests:** + - `CmsBlocks.html.test.tsx` "starts a header-less page flush at the top" now checks that the first block row has no top margin. It used to check for a `space-y` class, which is no longer how spacing works. It still asserts that the hidden title is outside the spacing. + - `frameHtml.test.ts` clamp test: the floor is now 20 px, per the modified "Custom HTML Frame Height" requirement. It also checks that 68 stays 68. +- **Live check** (port 3001, rebuilt counter), on `/p/INS/hotel-technology` through the editor: + - Full width switched on; + - three points and the form heading and text typed on the canvas; + - saved and published. +- **Published result at 1280 px:** + - the hero runs flush under the top bar and into the rest of the page; + - the serif headline is centred in the first screen; + - the points show in the accent colour, and the card has its heading. +- **Published result at 390 px:** the layout stacks, with the card below the text. +- **Fixes from the live check:** + - the text is centred in the opening height, not beside the long form; + - the frame floor is 20 px; + - the page asks frames for their height (both added to the spec). +- **Not reachable in the UI, covered by the validator tests:** + - 7 points, because Add point stops at 6; + - a form heading without a form, because No form clears it. + +## Workflow follow-up + +- Open a PR to `main` and merge it. Archive the change on its own branch, with its own PR. diff --git a/solvway-admin-portal/app/components/pages/BlockFields.tsx b/solvway-admin-portal/app/components/pages/BlockFields.tsx index ef0a288..5fbf669 100644 --- a/solvway-admin-portal/app/components/pages/BlockFields.tsx +++ b/solvway-admin-portal/app/components/pages/BlockFields.tsx @@ -6,6 +6,7 @@ import { BLOCK_LABELS, ICONS, LOOKS, imageSrc, type CmsBlock, type CmsCard, type import { Button } from "@/app/components/ui/button"; import { Input } from "@/app/components/ui/input"; import { Label } from "@/app/components/ui/label"; +import { Switch } from "@/app/components/ui/switch"; import { Textarea } from "@/app/components/ui/textarea"; import { useT } from "@/app/lib/i18n/MessagesProvider"; import { RichTextEditor } from "./RichTextEditor"; @@ -14,7 +15,7 @@ import { RichTextEditor } from "./RichTextEditor"; /** Field paths (relative to the block) each type shows inline; any other error shows at the block's top. Every type also shows "anchor". */ const INLINE: Record = { - HERO: ["imageId", "heading", "text", "buttonLabel", "buttonUrl", "eventUuid"], + HERO: ["imageId", "heading", "text", "buttonLabel", "buttonUrl", "eventUuid", "fullWidth", "formHeading", "formText", "cards"], RICH_TEXT: ["html"], IMAGE_TEXT: ["imageId", "imagePosition", "heading", "html", "buttonLabel", "buttonUrl"], FAQ: ["heading", "items"], @@ -34,10 +35,12 @@ const ICON_LABELS: Record = { "shield-check": "PagesIconShieldCheck", cloud: "PagesIconCloud", wrench: "PagesIconWrench", headset: "PagesIconHeadset", users: "PagesIconUsers", calendar: "PagesIconCalendar", star: "PagesIconStar", }; -const CARD_KINDS: Record = { - FEATURES: { legend: "PagesCardN", add: "PagesAddCard", icon: true, text: true, empty: { icon: "star", title: "", text: "" } }, - STEPS: { legend: "PagesStepN", add: "PagesAddStep", icon: false, text: true, empty: { title: "", text: "" } }, - TRUST: { legend: "PagesItemN", add: "PagesAddItem", icon: false, text: false, empty: { title: "" } }, +// add-hero-full-width: a hero's points are title-only cards, and it may have none. +const CARD_KINDS: Record = { + FEATURES: { legend: "PagesCardN", add: "PagesAddCard", icon: true, text: true, min: 2, empty: { icon: "star", title: "", text: "" } }, + STEPS: { legend: "PagesStepN", add: "PagesAddStep", icon: false, text: true, min: 2, empty: { title: "", text: "" } }, + TRUST: { legend: "PagesItemN", add: "PagesAddItem", icon: false, text: false, min: 2, empty: { title: "" } }, + HERO: { legend: "PagesPointN", add: "PagesAddPoint", icon: false, text: false, min: 0, empty: { title: "" } }, }; const SELECT = "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm disabled:cursor-not-allowed disabled:opacity-50"; @@ -83,7 +86,7 @@ export function BlockFields(props: { const fid = (name: string) => `block-${id}-${name}`; const topErrors = Object.entries(errors).filter(([path]) => path !== "anchor" && path !== "look" && !INLINE[block.type]?.includes(path) && !LISTED.test(path)); - const text = (name: "heading" | "text" | "buttonLabel" | "buttonUrl" | "anchor", labelCode: string) => ( + const text = (name: "heading" | "text" | "buttonLabel" | "buttonUrl" | "anchor" | "formHeading" | "formText", labelCode: string) => ( set({ [name]: e.target.value })} /> @@ -100,7 +103,7 @@ export function BlockFields(props: { const eventPicker = (labelCode: string, emptyCode: string) => (