Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a83752c34e | ||
|
|
bba99993cb | ||
|
|
1136046fc2 | ||
|
|
44eace2bcb | ||
|
|
dc5cfd1c54 | ||
|
|
fae25c11a6 | ||
|
|
b55b8d2d86 | ||
|
|
dbb58e6e94 |
No files matched your search
@@ -466,4 +466,8 @@ 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.
|
||||
|
||||
**Release add-html-image-upload (SQL, in its OpenSpec change folder):** deploy the portal, then run `sql/01-html-image-labels.sql` (labels only). A Custom HTML block's panel can now upload an image and show its link to copy. Rollback: the previous portal image.
|
||||
|
||||
**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.
|
||||
@@ -1717,6 +1717,20 @@ 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 'PagesUploadImage', JSON_OBJECT('en_US', 'Upload image', 'zh_CN', '上传图片'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesUploadImage') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '上传图片') WHERE LOWER(code) = LOWER('PagesUploadImage') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesUploadImageHint', JSON_OBJECT('en_US', 'PNG, JPEG or WebP up to 2 MB. Paste the link into your HTML, for example in an img tag''s src.', 'zh_CN', 'PNG、JPEG 或 WebP,最大 2 MB。将链接粘贴到您的 HTML 中,例如 img 标签的 src。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesUploadImageHint') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', 'PNG、JPEG 或 WebP,最大 2 MB。将链接粘贴到您的 HTML 中,例如 img 标签的 src。') WHERE LOWER(code) = LOWER('PagesUploadImageHint') 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');
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-12-04
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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
|
||||
+13
@@ -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';
|
||||
@@ -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.
|
||||
@@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-12-04
|
||||
@@ -0,0 +1,44 @@
|
||||
# Proposal
|
||||
|
||||
## Why
|
||||
|
||||
Custom HTML blocks hold whole designed sections, such as the INS Hotel technology page. Their images must be served from somewhere. Today the only way to get an image link is to upload it as a hero image and read its id back, or to ask a developer. Marketing staff need to upload an image from the Custom HTML block itself and get a link they can paste into their HTML.
|
||||
|
||||
## What Changes
|
||||
|
||||
- The Custom HTML block's panel gains an **Upload image** file picker. Choosing a file uploads it at once, for the page's company, with the same checks as every page image:
|
||||
- PNG, JPEG or WebP;
|
||||
- at most 2 MB;
|
||||
- the type is checked by the file's content.
|
||||
- Each upload made while the panel is open shows:
|
||||
- a small preview;
|
||||
- its link (`/api/public/page-images/<id>`) in a read-only box;
|
||||
- a **Copy link** button.
|
||||
- A refused upload shows its reason under the picker.
|
||||
- A new page with no company chosen yet asks for one first.
|
||||
- The link is relative, so it works on the published page and inside the sealed frame. The INS top bar's logo already loads this way.
|
||||
|
||||
Not changing:
|
||||
- The server. The existing `POST /api/pages/images` upload and the public image address are used as they are.
|
||||
- Saving. The upload does not touch the page's HTML; staff paste the link where they want it.
|
||||
- Unused images. They stay stored, as an unused hero upload would. Clean-up is left for later.
|
||||
- The list of uploads, which is not saved. It shows this session's uploads only.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
None.
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `landing-pages`: adds "Image Upload For Custom HTML".
|
||||
|
||||
## Impact
|
||||
|
||||
- Portal:
|
||||
- `BlockFields.tsx`, the HTML block panel;
|
||||
- the editor passes the page's company to the panel (or the panel reads it from the draft hook);
|
||||
- `uploadPageImage` already exists.
|
||||
- New labels in `defaultMessages.ts` and `zh_CN.seed.json`, a regenerated local seed, and a SQL label file in this change folder.
|
||||
- No server or schema change.
|
||||
@@ -0,0 +1,23 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Image Upload For Custom HTML
|
||||
|
||||
A Custom HTML block's panel in the editor SHALL offer an image upload for the page's company, under the same checks as other page images. On success it SHALL show the image's preview and its public link with a copy button; on refusal it SHALL show the reason. The upload SHALL NOT change the block's HTML.
|
||||
|
||||
#### Scenario: Upload an image for the HTML
|
||||
|
||||
- **GIVEN** staff editing an INS page with a Custom HTML block
|
||||
- **WHEN** they choose `lobby.webp` under "Upload image" in that block's panel
|
||||
- **THEN** the image is stored for INS and the panel shows its preview and the link `/api/public/page-images/<id>`
|
||||
- **AND** "Copy link" copies that link, and the block's HTML is unchanged
|
||||
|
||||
#### Scenario: Refused upload
|
||||
|
||||
- **WHEN** staff choose a 3 MB JPEG under "Upload image"
|
||||
- **THEN** the panel shows that the image is too large, and no link appears
|
||||
|
||||
#### Scenario: New page without a company
|
||||
|
||||
- **GIVEN** a super admin's new page with no company chosen
|
||||
- **WHEN** they choose a file under "Upload image"
|
||||
- **THEN** nothing is uploaded and the panel asks them to choose a company
|
||||
@@ -0,0 +1,7 @@
|
||||
-- The labels added by add-html-image-upload, 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 'PagesUploadImage', JSON_OBJECT('en_US', 'Upload image', 'zh_CN', '上传图片'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesUploadImage') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '上传图片') WHERE LOWER(code) = LOWER('PagesUploadImage') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesUploadImageHint', JSON_OBJECT('en_US', 'PNG, JPEG or WebP up to 2 MB. Paste the link into your HTML, for example in an img tag''s src.', 'zh_CN', 'PNG、JPEG 或 WebP,最大 2 MB。将链接粘贴到您的 HTML 中,例如 img 标签的 src。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesUploadImageHint') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', 'PNG、JPEG 或 WebP,最大 2 MB。将链接粘贴到您的 HTML 中,例如 img 标签的 src。') WHERE LOWER(code) = LOWER('PagesUploadImageHint') AND area = 'A';
|
||||
@@ -0,0 +1,34 @@
|
||||
# Tasks
|
||||
|
||||
## 1. Portal
|
||||
|
||||
- [x] 1.1 HTML block panel: an "Upload image" file picker (`image/png,image/jpeg,image/webp`) uploads at once through `uploadPageImage(companyId, base64)`.
|
||||
- Each success adds a row: preview, a read-only link `/api/public/page-images/<id>`, and a "Copy link" button that uses the clipboard.
|
||||
- A refusal shows the translated server reason under the picker.
|
||||
- With no company, the panel shows "Choose a company." and does not upload.
|
||||
- The block's HTML is never changed.
|
||||
|
||||
Verify: editor tests (success row and copy, refusal, no company, HTML unchanged) fail first, then pass; vitest exit 0; tsc; lint.
|
||||
- [x] 1.2 Add the labels (`PagesUploadImage`, `PagesUploadImageHint`; the copy button reuses the page-address copy button) to `defaultMessages.ts`, `zh_CN.seed.json` and `sql/01-html-image-labels.sql`, and regenerate `local/seed/04-zh-cn-messages.sql`.
|
||||
|
||||
## 2. Verification
|
||||
|
||||
- [x] 2.1 Use Playwright on port 3001, signing in through the form and opening Hotel technology from Pages.
|
||||
- In a Custom HTML block, upload an image, copy the link, and check that the panel shows the preview and the link.
|
||||
- Upload a file that is not an image and see the refusal.
|
||||
- Do not change the published page.
|
||||
- [x] 2.2 Run the full portal vitest (exit 0), tsc, lint, and `openspec validate add-html-image-upload --strict`. Add a release note to `docs/deployment.md` (label SQL).
|
||||
|
||||
## Notes (2026-12-04)
|
||||
|
||||
- **Red first:** the success, refusal and no-company editor tests all failed, because there was no "Upload image" picker yet. They pass now.
|
||||
- **Live check** (port 3001): signed in through the form, then opened Hotel technology from Pages.
|
||||
- In block 3 (Custom HTML), uploaded `hero-bg.webp`. The panel showed the preview and `/api/public/page-images/7` with a copy button.
|
||||
- A text file named `.png` was refused with "Use a PNG, JPEG or WebP image."
|
||||
- The page was not saved or published.
|
||||
- **Fix from the live check:** the link was shown twice (a read-only box and the copy button's text). It now shows once, beside its copy button, which reuses the page-address copy button with a `relative` option.
|
||||
- **Results:** vitest 1997 passed (exit 0); tsc clean; lint 0 errors (the 4 warnings were already there).
|
||||
|
||||
## Workflow follow-up
|
||||
|
||||
- Open a PR to `main` and merge it. Archive the change on its own branch, with its own PR.
|
||||
@@ -278,7 +278,7 @@ The public frame address SHALL be `/p/<company>/<slug>/frame/<block index>` and
|
||||
|
||||
### Requirement: Custom HTML Frame Height
|
||||
|
||||
The frame SHALL grow to fit its content, between 100 and 20000 pixels, using height reports sent by that frame only. Before the first report it SHALL be 600 pixels tall.
|
||||
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
|
||||
|
||||
@@ -286,6 +286,12 @@ The frame SHALL grow to fit its content, between 100 and 20000 pixels, using hei
|
||||
- **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
|
||||
@@ -605,3 +611,87 @@ A HERO block MAY name an event. When it does, the hero SHALL show Co-Lite's sign
|
||||
- **WHEN** they pick `INS website enquiries` under the hero's sign-up form setting
|
||||
- **THEN** the canvas shows the form card beside the hero text
|
||||
- **AND** choosing "No form" removes it
|
||||
|
||||
### 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`
|
||||
|
||||
### Requirement: Image Upload For Custom HTML
|
||||
|
||||
A Custom HTML block's panel in the editor SHALL offer an image upload for the page's company, under the same checks as other page images. On success it SHALL show the image's preview and its public link with a copy button; on refusal it SHALL show the reason. The upload SHALL NOT change the block's HTML.
|
||||
|
||||
#### Scenario: Upload an image for the HTML
|
||||
|
||||
- **GIVEN** staff editing an INS page with a Custom HTML block
|
||||
- **WHEN** they choose `lobby.webp` under "Upload image" in that block's panel
|
||||
- **THEN** the image is stored for INS and the panel shows its preview and the link `/api/public/page-images/<id>`
|
||||
- **AND** "Copy link" copies that link, and the block's HTML is unchanged
|
||||
|
||||
#### Scenario: Refused upload
|
||||
|
||||
- **WHEN** staff choose a 3 MB JPEG under "Upload image"
|
||||
- **THEN** the panel shows that the image is too large, and no link appears
|
||||
|
||||
#### Scenario: New page without a company
|
||||
|
||||
- **GIVEN** a super admin's new page with no company chosen
|
||||
- **WHEN** they choose a file under "Upload image"
|
||||
- **THEN** nothing is uploaded and the panel asks them to choose a company
|
||||
@@ -1,20 +1,22 @@
|
||||
"use client";
|
||||
|
||||
import type { ReactNode } from "react";
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { ArrowDown, ArrowUp, Plus, Trash2 } from "lucide-react";
|
||||
import { BLOCK_LABELS, ICONS, LOOKS, imageSrc, type CmsBlock, type CmsCard, type Look } from "@/app/lib/cmsPages";
|
||||
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";
|
||||
import { CopyAddress } from "./CopyAddress";
|
||||
|
||||
// One block of the page editor, ported from babyboo's BlockFields: a fieldset with move/remove and its type's fields.
|
||||
|
||||
/** 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<string, string[]> = {
|
||||
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 +36,12 @@ const ICON_LABELS: Record<string, string> = {
|
||||
"shield-check": "PagesIconShieldCheck", cloud: "PagesIconCloud", wrench: "PagesIconWrench", headset: "PagesIconHeadset",
|
||||
users: "PagesIconUsers", calendar: "PagesIconCalendar", star: "PagesIconStar",
|
||||
};
|
||||
const CARD_KINDS: Record<string, { legend: string; add: string; icon: boolean; text: boolean; empty: CmsCard }> = {
|
||||
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<string, { legend: string; add: string; icon: boolean; text: boolean; min: number; empty: CmsCard }> = {
|
||||
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";
|
||||
|
||||
@@ -76,6 +80,8 @@ export function BlockFields(props: {
|
||||
onMove: (delta: -1 | 1) => void;
|
||||
onRemove: () => void;
|
||||
onChooseImage: (file: File) => void;
|
||||
/** Uploads an image for a Custom HTML block at once (add-html-image-upload); rejects with the reason to show. */
|
||||
onUploadImage?: (file: File) => Promise<number>;
|
||||
}) {
|
||||
const { block, id, index, count, errors, saving, events, pendingImage, onChange, onMove, onRemove } = props;
|
||||
const t = useT();
|
||||
@@ -83,7 +89,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) => (
|
||||
<Field id={fid(name)} label={t(labelCode)} error={errors[name]}>
|
||||
<Input id={fid(name)} value={block[name] ?? ""} disabled={saving} aria-invalid={!!errors[name]} onChange={(e) => set({ [name]: e.target.value })} />
|
||||
</Field>
|
||||
@@ -95,12 +101,30 @@ export function BlockFields(props: {
|
||||
</Field>
|
||||
);
|
||||
|
||||
// add-html-image-upload: this panel's uploads, newest first; their links are pasted into the HTML by hand.
|
||||
const [uploads, setUploads] = useState<number[]>([]);
|
||||
const [uploadError, setUploadError] = useState<string | null>(null);
|
||||
const [uploading, setUploading] = useState(false);
|
||||
async function upload(file: File) {
|
||||
if (!props.onUploadImage) return;
|
||||
setUploadError(null);
|
||||
setUploading(true);
|
||||
try {
|
||||
const imageId = await props.onUploadImage(file);
|
||||
setUploads((u) => [imageId, ...u]);
|
||||
} catch (err) {
|
||||
setUploadError(err instanceof Error ? err.message : String(err));
|
||||
} finally {
|
||||
setUploading(false);
|
||||
}
|
||||
}
|
||||
|
||||
const preview = pendingImage?.preview ?? (block.imageId ? imageSrc(block.imageId) : undefined);
|
||||
// The FORM block's event, and the hero's optional sign-up form (add-hero-signup-form): the same picker and hint.
|
||||
const eventPicker = (labelCode: string, emptyCode: string) => (
|
||||
<Field id={fid("event")} label={t(labelCode)} error={errors.eventUuid}>
|
||||
<select id={fid("event")} className={SELECT} value={block.eventUuid ?? ""} disabled={saving} aria-invalid={!!errors.eventUuid}
|
||||
onChange={(e) => set({ eventUuid: e.target.value || null })}>
|
||||
onChange={(e) => set(e.target.value ? { eventUuid: e.target.value } : { eventUuid: null, formHeading: undefined, formText: undefined })}>
|
||||
<option value="">{t(emptyCode)}</option>
|
||||
{events.map((ev) => <option key={ev.uuid} value={ev.uuid}>{ev.name}</option>)}
|
||||
{block.eventUuid && !events.some((ev) => ev.uuid === block.eventUuid) ? (
|
||||
@@ -140,8 +164,8 @@ export function BlockFields(props: {
|
||||
<>
|
||||
{cards.map((card, i) => {
|
||||
const err = (f: string) => errors[`cards[${i}].${f}`];
|
||||
const cardField = (f: "title" | "text", labelCode: string, multiline: boolean) => (
|
||||
<Field id={fid(`c${i}${f}`)} label={t(labelCode)} error={err(f)}>
|
||||
const cardField = (f: "title" | "text", label: string, multiline: boolean) => (
|
||||
<Field id={fid(`c${i}${f}`)} label={label} error={err(f)}>
|
||||
{multiline
|
||||
? <Textarea id={fid(`c${i}${f}`)} rows={2} value={card[f] ?? ""} disabled={saving} aria-invalid={!!err(f)}
|
||||
onChange={(e) => setCards(cards.map((c, j) => (j === i ? { ...c, [f]: e.target.value } : c)))} />
|
||||
@@ -160,12 +184,12 @@ export function BlockFields(props: {
|
||||
</select>
|
||||
</Field>
|
||||
) : null}
|
||||
{cardField("title", "PagesCardTitle", false)}
|
||||
{kind.text ? cardField("text", "PagesCardText", true) : null}
|
||||
{cardField("title", kind.min ? t("PagesCardTitle") : t(kind.legend, { number: i + 1 }), false)}
|
||||
{kind.text ? cardField("text", t("PagesCardText"), true) : null}
|
||||
<div className="flex flex-wrap gap-1">
|
||||
<Button type="button" variant="ghost" size="sm" disabled={saving || i === 0} onClick={() => moveCard(i, -1)}>{t("PagesMoveUp")}</Button>
|
||||
<Button type="button" variant="ghost" size="sm" disabled={saving || i === cards.length - 1} onClick={() => moveCard(i, 1)}>{t("PagesMoveDown")}</Button>
|
||||
<Button type="button" variant="ghost" size="sm" disabled={saving || cards.length <= 2} onClick={() => setCards(cards.filter((_, j) => j !== i))}>{t("PagesRemoveCard")}</Button>
|
||||
<Button type="button" variant="ghost" size="sm" disabled={saving || cards.length <= kind.min} onClick={() => setCards(cards.filter((_, j) => j !== i))}>{t("PagesRemoveCard")}</Button>
|
||||
</div>
|
||||
</fieldset>
|
||||
);
|
||||
@@ -204,7 +228,18 @@ export function BlockFields(props: {
|
||||
{text("text", "PagesText")}
|
||||
{text("buttonLabel", "PagesButtonLabel")}
|
||||
{text("buttonUrl", "PagesButtonLink")}
|
||||
<div className="flex items-center gap-2">
|
||||
<Switch id={fid("fullWidth")} checked={!!block.fullWidth} disabled={saving} onCheckedChange={(on) => set({ fullWidth: on || undefined })} />
|
||||
<Label htmlFor={fid("fullWidth")}>{t("PagesFullWidth")}</Label>
|
||||
</div>
|
||||
{cardList}
|
||||
{eventPicker("PagesHeroForm", "PagesNoForm")}
|
||||
{block.eventUuid ? (
|
||||
<>
|
||||
{text("formHeading", "PagesFormHeading")}
|
||||
{text("formText", "PagesFormText")}
|
||||
</>
|
||||
) : null}
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -260,6 +295,24 @@ export function BlockFields(props: {
|
||||
<p className="text-xs text-muted-foreground">{t("PagesHtmlHint")}</p>
|
||||
</Field>
|
||||
)}
|
||||
{block.type === "HTML" && props.onUploadImage && (
|
||||
<Field id={fid("upload")} label={t("PagesUploadImage")} error={uploadError ?? undefined}>
|
||||
<Input id={fid("upload")} type="file" accept="image/png,image/jpeg,image/webp" disabled={saving || uploading}
|
||||
onChange={(e) => {
|
||||
const file = e.target.files?.[0];
|
||||
e.target.value = "";
|
||||
if (file) void upload(file);
|
||||
}} />
|
||||
<p className="text-xs text-muted-foreground">{t("PagesUploadImageHint")}</p>
|
||||
{uploads.map((imageId) => (
|
||||
<div key={imageId} className="flex items-center gap-2 rounded-md border p-2">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element -- an uploaded image of unknown size */}
|
||||
<img src={imageSrc(imageId)} alt={t("PagesImagePreview")} className="size-12 rounded object-cover" />
|
||||
<CopyAddress address={imageSrc(imageId)} relative />
|
||||
</div>
|
||||
))}
|
||||
</Field>
|
||||
)}
|
||||
|
||||
{block.type === "FORM" && (
|
||||
<>
|
||||
|
||||
@@ -58,6 +58,18 @@ describe("LandingPage: Custom HTML", () => {
|
||||
expect(frame().style.height).toBe("2400px");
|
||||
});
|
||||
|
||||
// add-hero-full-width: the frame's first report can arrive before the page listens, so the page asks once it does.
|
||||
it("asks its frame for a height report once it listens, and again when the frame loads", () => {
|
||||
const sealed = { postMessage: vi.fn() };
|
||||
const getter = vi.spyOn(HTMLIFrameElement.prototype, "contentWindow", "get").mockReturnValue(sealed as unknown as Window);
|
||||
onTestFinished(() => getter.mockRestore());
|
||||
render(<LandingPage company={company} page={page([HTML])} />);
|
||||
expect(sealed.postMessage).toHaveBeenCalledWith({ type: "colite-frame-ask" }, "*");
|
||||
sealed.postMessage.mockClear();
|
||||
act(() => { frame().dispatchEvent(new Event("load")); });
|
||||
expect(sealed.postMessage).toHaveBeenCalledWith({ type: "colite-frame-ask" }, "*");
|
||||
});
|
||||
|
||||
it("grows inside another document too: it listens on its own document's window (add-page-visual-editor)", () => {
|
||||
const host = document.createElement("iframe");
|
||||
document.body.appendChild(host);
|
||||
@@ -80,6 +92,7 @@ describe("LandingPage: Custom HTML", () => {
|
||||
render(<LandingPage company={company} page={page([HTML], true)} />);
|
||||
const title = screen.getByRole("heading", { level: 1, name: "Hotel day" });
|
||||
expect(title.parentElement!.className).not.toMatch(/space-y/);
|
||||
expect(frame().parentElement!.className).toMatch(/space-y/);
|
||||
// add-hero-full-width: spacing is a top margin on each block row after the first, so the first row has none.
|
||||
expect(frame().closest("main > div > div")).not.toHaveClass("mt-10");
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { render, screen, within } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { LandingPage, type PublicBlock } from "./CmsBlocks";
|
||||
@@ -103,6 +103,46 @@ describe("LandingPage", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// add-hero-full-width: edge-to-edge hero, points, the form card's heading, and flush full-width neighbours.
|
||||
describe("LandingPage full-width hero", () => {
|
||||
const ins = { type: "HERO" as const, heading: "One partner", fullWidth: true, eventUuid: "77", closed: true,
|
||||
cards: [{ title: "One accountable partner" }, { title: "Local support team in Malaysia" }],
|
||||
formHeading: "Get a free consultation", formText: "Tell us about your property." };
|
||||
|
||||
it("runs outside the page width with square corners; a plain hero stays boxed in the page width", () => {
|
||||
render(<LandingPage company={company} page={page([ins, { type: "HERO", heading: "Boxed" }])} />);
|
||||
const wide = screen.getByRole("heading", { name: "One partner" }).closest("section")!;
|
||||
expect(wide.closest(".max-w-5xl")).toBeNull();
|
||||
expect(wide).not.toHaveClass("rounded-lg");
|
||||
const boxed = screen.getByRole("heading", { name: "Boxed" }).closest("section")!;
|
||||
expect(boxed.closest(".max-w-5xl")).not.toBeNull();
|
||||
expect(boxed).toHaveClass("rounded-lg");
|
||||
});
|
||||
|
||||
it("shows its points as a list under the text", () => {
|
||||
render(<LandingPage company={company} page={page([ins])} />);
|
||||
const hero = screen.getByRole("heading", { name: "One partner" }).closest("section")!;
|
||||
const items = within(hero).getAllByRole("listitem");
|
||||
expect(items.map((li) => li.textContent)).toEqual(["One accountable partner", "Local support team in Malaysia"]);
|
||||
});
|
||||
|
||||
it("starts the form card with its heading and text", () => {
|
||||
render(<LandingPage company={company} page={page([ins])} />);
|
||||
const title = screen.getByRole("heading", { name: "Get a free consultation" });
|
||||
const card = title.parentElement!.parentElement!;
|
||||
expect(card).toHaveTextContent(/^Get a free consultation\s*Tell us about your property\./);
|
||||
expect(card).toHaveTextContent("Sign-up is closed.");
|
||||
});
|
||||
|
||||
it("joins a Custom HTML block and a full-width hero with no gap; other blocks keep theirs", () => {
|
||||
render(<LandingPage company={company} frameBase="/f" page={page([
|
||||
{ type: "HTML", html: "<header>Top</header>" }, ins, { type: "HTML", html: "<p>Rest</p>" }, { type: "RICH_TEXT", html: "<p>After</p>" },
|
||||
])} />);
|
||||
const rows = Array.from(document.querySelector("main > div")!.children);
|
||||
expect(rows.map((r) => r.classList.contains("mt-10"))).toEqual([false, false, false, true]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("utmTags", () => {
|
||||
it("reads the three tags, capped at 100 characters", () => {
|
||||
expect(utmTags("?utm_source=" + "x".repeat(150))).toEqual({ utmSource: "x".repeat(100), utmMedium: undefined, utmCampaign: undefined });
|
||||
|
||||
@@ -47,31 +47,70 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
|
||||
const button = <ButtonLink block={block} index={index} edit={edit} />;
|
||||
switch (block.type) {
|
||||
case "HERO": {
|
||||
const wide = !!block.fullWidth;
|
||||
const points = block.cards?.length ? (
|
||||
<ul className="space-y-2">
|
||||
{block.cards.map((card, i) => (
|
||||
<li key={i} className="flex items-baseline gap-3 before:size-2 before:shrink-0 before:rounded-full before:bg-primary">
|
||||
<Text as="span" index={index} path={`cards.${i}.title`} value={card.title} max={80} code="PagesPointN" n={i + 1} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null;
|
||||
const words = (
|
||||
<>
|
||||
<Text as="h2" index={index} path="heading" value={block.heading} max={120} code="PagesHeading" className="text-3xl font-semibold sm:text-4xl" />
|
||||
<Text as="h2" index={index} path="heading" value={block.heading} max={120} code="PagesHeading"
|
||||
className={wide ? "font-serif text-4xl leading-tight font-semibold sm:text-5xl" : "text-3xl font-semibold sm:text-4xl"} />
|
||||
<Text as="p" index={index} path="text" value={block.text} max={300} code="PagesText" className="max-w-2xl text-lg" />
|
||||
{points}
|
||||
<div>{button}</div>
|
||||
</>
|
||||
);
|
||||
// add-hero-signup-form: with an event, the sign-up form sits in a card beside the text (below it on phones).
|
||||
if (block.eventUuid) {
|
||||
// Top padding leaves room for the editor's image button in the corner.
|
||||
const grid = "grid items-start gap-6 px-6 pt-16 pb-6 md:grid-cols-[minmax(0,1fr)_minmax(0,26rem)] md:px-10 md:pb-10";
|
||||
// add-hero-full-width: the card may open with its own heading and text.
|
||||
const card = block.eventUuid ? (
|
||||
<div className="space-y-4 rounded-lg border bg-card p-6 text-card-foreground shadow-card">
|
||||
{block.formHeading || block.formText || edit ? (
|
||||
<div className="space-y-1">
|
||||
<Text as="h3" index={index} path="formHeading" value={block.formHeading} max={80} code="PagesFormHeading" className="font-serif text-2xl font-semibold" />
|
||||
<Text as="p" index={index} path="formText" value={block.formText} max={200} code="PagesFormText" className="text-sm text-muted-foreground" />
|
||||
</div>
|
||||
) : null}
|
||||
<LandingForm companyCode={company} slug={slug} index={index} info={block.closed ? undefined : block.form} preview={preview} />
|
||||
</div>
|
||||
) : null;
|
||||
const back = bandOf(block.look) ? "" : "bg-muted";
|
||||
if (wide) {
|
||||
// Edge to edge; the shade is darkest behind the text and clears toward the far side. The text is centred in the
|
||||
// hero's opening height, not beside a long form, so it stays in the first screen.
|
||||
const grid = `mx-auto grid w-full max-w-6xl items-start gap-8 px-4 pt-16 pb-12 ${card ? "md:grid-cols-[minmax(0,1fr)_minmax(0,28rem)]" : ""}`;
|
||||
return (
|
||||
<section className={`relative overflow-hidden rounded-lg ${bandOf(block.look) ? "" : "bg-muted"}`}>
|
||||
<section className={`relative overflow-hidden ${back}`}>
|
||||
<ImageSpot index={index} src={image} className="absolute inset-0 h-full w-full object-cover" corner />
|
||||
<HeroShade index={index} image={!!image} shaded={`relative ${grid} bg-gradient-to-r from-black/80 via-black/60 to-black/40 text-white sm:min-h-96`} plain={grid}>
|
||||
<div className="flex flex-col gap-3">{words}</div>
|
||||
<div className="rounded-lg border bg-card p-6 text-card-foreground shadow-card">
|
||||
<LandingForm companyCode={company} slug={slug} index={index} info={block.closed ? undefined : block.form} preview={preview} />
|
||||
<HeroShade index={index} image={!!image} shaded="relative bg-gradient-to-r from-black/75 via-black/45 to-black/10 text-white" plain="">
|
||||
<div className={grid}>
|
||||
<div className="flex flex-col justify-center gap-4 md:min-h-[32rem]">{words}</div>
|
||||
{card}
|
||||
</div>
|
||||
</HeroShade>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
if (card) {
|
||||
// Top padding leaves room for the editor's image button in the corner.
|
||||
const grid = "grid items-start gap-6 px-6 pt-16 pb-6 md:grid-cols-[minmax(0,1fr)_minmax(0,26rem)] md:px-10 md:pb-10";
|
||||
return (
|
||||
<section className={`relative overflow-hidden rounded-lg ${back}`}>
|
||||
<ImageSpot index={index} src={image} className="absolute inset-0 h-full w-full object-cover" corner />
|
||||
<HeroShade index={index} image={!!image} shaded={`relative ${grid} bg-gradient-to-r from-black/80 via-black/60 to-black/40 text-white sm:min-h-96`} plain={grid}>
|
||||
<div className="flex flex-col gap-3">{words}</div>
|
||||
{card}
|
||||
</HeroShade>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<section className={`relative overflow-hidden rounded-lg ${bandOf(block.look) ? "" : "bg-muted"}`}>
|
||||
<section className={`relative overflow-hidden rounded-lg ${back}`}>
|
||||
<ImageSpot index={index} src={image} className="absolute inset-0 h-full w-full object-cover" corner />
|
||||
<HeroShade index={index} image={!!image}
|
||||
shaded="relative flex min-h-72 flex-col justify-end gap-3 bg-gradient-to-t from-black/80 via-black/50 to-transparent p-6 text-white sm:min-h-96"
|
||||
@@ -189,9 +228,14 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
|
||||
|
||||
const WIDTH = "mx-auto w-full max-w-5xl px-4";
|
||||
|
||||
/** Blocks that run the full window width: Custom HTML, and a full-width hero. Two of them in a row join with no gap. */
|
||||
const bleeds = (block: PublicBlock) => block.type === "HTML" || (block.type === "HERO" && !!block.fullWidth);
|
||||
|
||||
/** A block in the page width; with a non-default look, inside a full-width band of that colour. */
|
||||
function Section({ block, index, children }: { block: PublicBlock; index: number; children: ReactNode }) {
|
||||
const band = bandOf(block.look);
|
||||
// add-hero-full-width: a full-width hero sets its own width.
|
||||
if (bleeds(block)) return <EditSection index={index}><div id={anchorId(block.anchor)}>{children}</div></EditSection>;
|
||||
if (!band) return <EditSection index={index}><div id={anchorId(block.anchor)} className={WIDTH}>{children}</div></EditSection>;
|
||||
return (
|
||||
<EditSection index={index}>
|
||||
@@ -235,10 +279,14 @@ export function LandingPage({ company, page, banner, preview, frameBase, edit }:
|
||||
</header>}
|
||||
<main className={page.hideHeader ? "pb-8" : "py-8"}>
|
||||
<h1 className={page.hideHeader ? "sr-only" : `${WIDTH} mb-10 text-3xl font-semibold sm:text-4xl`}>{page.title}</h1>
|
||||
<div className="space-y-10">
|
||||
{page.blocks.map((block, i) => block.type === "HTML"
|
||||
? <HtmlSpot key={i} index={i}><HtmlFrame id={anchorId(block.anchor)} src={`${frames}/${i}${edit ? `?v=${edit.frameVersion}` : ""}`} title={page.title} /></HtmlSpot>
|
||||
: <Section key={i} block={block} index={i}><Block block={block} index={i} company={company.code} slug={page.slug} preview={preview} edit={!!edit} /></Section>)}
|
||||
<div>
|
||||
{page.blocks.map((block, i) => (
|
||||
<div key={i} className={i > 0 && !(bleeds(block) && bleeds(page.blocks[i - 1])) ? "mt-10" : undefined}>
|
||||
{block.type === "HTML"
|
||||
? <HtmlSpot index={i}><HtmlFrame id={anchorId(block.anchor)} src={`${frames}/${i}${edit ? `?v=${edit.frameVersion}` : ""}`} title={page.title} /></HtmlSpot>
|
||||
: <Section block={block} index={i}><Block block={block} index={i} company={company.code} slug={page.slug} preview={preview} edit={!!edit} /></Section>}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@@ -5,14 +5,14 @@ import { Check, Copy } from "lucide-react";
|
||||
import { Button } from "@/app/components/ui/button";
|
||||
import { useT } from "@/app/lib/i18n/MessagesProvider";
|
||||
|
||||
/** A page address with a button that copies its full URL (this site's origin plus the path). */
|
||||
export function CopyAddress({ address }: { address: string }) {
|
||||
/** A page address with a button that copies its full URL (this site's origin plus the path), or the path itself when `relative`. */
|
||||
export function CopyAddress({ address, relative }: { address: string; relative?: boolean }) {
|
||||
const t = useT();
|
||||
const [state, setState] = useState<"idle" | "copied" | "failed">("idle");
|
||||
|
||||
async function copy() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(`${window.location.origin}${address}`);
|
||||
await navigator.clipboard.writeText(relative ? address : `${window.location.origin}${address}`);
|
||||
setState("copied");
|
||||
setTimeout(() => setState("idle"), 2000);
|
||||
} catch {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { FRAME_SANDBOX, frameAnchor, nextFrameHeight, START_HEIGHT, type FrameHeight } from "@/app/lib/frameHtml";
|
||||
import { FRAME_ASK_MESSAGE, FRAME_SANDBOX, frameAnchor, nextFrameHeight, START_HEIGHT, type FrameHeight } from "@/app/lib/frameHtml";
|
||||
|
||||
// add-hero-full-width: the frame may have reported before this page listened; ask on mount, and again when it loads.
|
||||
const ask = (frame: HTMLIFrameElement | null) => frame?.contentWindow?.postMessage({ type: FRAME_ASK_MESSAGE }, "*");
|
||||
|
||||
/** A Custom HTML block: the sealed frame, sized by height reports and scrolled to by #name requests from that frame's own window only. */
|
||||
export function HtmlFrame({ id, src, title }: { id?: string; src: string; title: string }) {
|
||||
@@ -22,7 +25,8 @@ export function HtmlFrame({ id, src, title }: { id?: string; src: string; title:
|
||||
if (block?.closest("main")) block.scrollIntoView({ behavior: "smooth" });
|
||||
};
|
||||
host.addEventListener("message", onMessage);
|
||||
ask(ref.current);
|
||||
return () => host.removeEventListener("message", onMessage);
|
||||
}, []);
|
||||
return <iframe ref={ref} id={id} src={src} title={title} sandbox={FRAME_SANDBOX} loading="lazy" className="block w-full border-0" style={{ height: `${size.height}px` }} />;
|
||||
return <iframe ref={ref} id={id} src={src} title={title} sandbox={FRAME_SANDBOX} loading="lazy" onLoad={(e) => ask(e.currentTarget)} className="block w-full border-0" style={{ height: `${size.height}px` }} />;
|
||||
}
|
||||
@@ -64,4 +64,42 @@ describe("PageEditor: Custom HTML", () => {
|
||||
expect(box.closest("div")).toHaveTextContent("Too long.");
|
||||
expect(box).toHaveAttribute("aria-invalid", "true");
|
||||
});
|
||||
|
||||
// add-html-image-upload: upload an image from the block's panel and copy its link; the HTML stays as it was.
|
||||
it("uploads an image at once for the page's company and shows its link to copy", async () => {
|
||||
mocks.uploadPageImage.mockResolvedValueOnce({ id: 42 });
|
||||
const user = userEvent.setup();
|
||||
render(<PageEditor pageId={5} />);
|
||||
await screen.findByLabelText("HTML");
|
||||
await user.upload(screen.getByLabelText("Upload image"), new File(["png"], "lobby.png", { type: "image/png" }));
|
||||
expect(await screen.findByText("/api/public/page-images/42")).toBeInTheDocument();
|
||||
expect(mocks.uploadPageImage).toHaveBeenCalledWith(2, btoa("png"));
|
||||
expect(screen.getByRole("img", { name: "Image preview" })).toHaveAttribute("src", "/api/public/page-images/42");
|
||||
const write = vi.spyOn(navigator.clipboard, "writeText");
|
||||
await user.click(screen.getByRole("button", { name: "Copy link /api/public/page-images/42" }));
|
||||
expect(write).toHaveBeenCalledWith("/api/public/page-images/42");
|
||||
expect(screen.getByLabelText("HTML")).toHaveValue("<h1>Designed</h1>");
|
||||
expect(mocks.savePage).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("shows a refused upload's reason and no link", async () => {
|
||||
mocks.uploadPageImage.mockRejectedValueOnce(new ApiError("x", 422, { code: "PagesImageTooLarge" }));
|
||||
const user = userEvent.setup();
|
||||
render(<PageEditor pageId={5} />);
|
||||
await screen.findByLabelText("HTML");
|
||||
await user.upload(screen.getByLabelText("Upload image"), new File(["big"], "big.jpg", { type: "image/jpeg" }));
|
||||
expect(await screen.findByText("The image is larger than 2 MB.")).toBeInTheDocument();
|
||||
expect(screen.queryByText(/\/api\/public\/page-images\//)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("asks a super admin's new page for a company before uploading", async () => {
|
||||
mocks.useAdminAuth.mockReturnValue({ isSuper: true, companyCode: null });
|
||||
memoryRouter.reset("/pages/new");
|
||||
const user = userEvent.setup();
|
||||
render(<PageEditor />);
|
||||
await user.click(screen.getByRole("button", { name: "Add Custom HTML" }));
|
||||
await user.upload(await screen.findByLabelText("Upload image"), new File(["png"], "lobby.png", { type: "image/png" }));
|
||||
expect(await screen.findByText("Choose a company.")).toBeInTheDocument();
|
||||
expect(mocks.uploadPageImage).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -125,6 +125,33 @@ describe("PageEditor", () => {
|
||||
expect(mocks.savePage.mock.calls[1][1].blocks[0].eventUuid ?? null).toBeNull();
|
||||
});
|
||||
|
||||
// add-hero-full-width: Full width, points, and the form card's heading and text (only while the hero has a form).
|
||||
it("saves a full-width hero with points and a form heading; No form drops the heading and text", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<PageEditor pageId={5} />);
|
||||
const picker = await screen.findByLabelText("Sign-up form");
|
||||
expect(screen.queryByLabelText("Form heading")).not.toBeInTheDocument();
|
||||
await user.click(screen.getByRole("switch", { name: "Full width" }));
|
||||
await user.click(screen.getByRole("button", { name: "Add point" }));
|
||||
await user.type(screen.getByRole("textbox", { name: "Point 1" }), "Local support team");
|
||||
await waitFor(() => expect(within(picker).getByRole("option", { name: "Website enquiries" })).toBeInTheDocument());
|
||||
await user.selectOptions(picker, "3312726793093644288");
|
||||
await user.type(screen.getByLabelText("Form heading"), "Get a free consultation");
|
||||
await user.type(screen.getByLabelText("Form text"), "It takes a minute.");
|
||||
await user.click(screen.getByRole("button", { name: "Save" }));
|
||||
await waitFor(() => expect(mocks.savePage).toHaveBeenCalledTimes(1));
|
||||
expect(mocks.savePage.mock.calls[0][1].blocks[0]).toMatchObject({
|
||||
type: "HERO", fullWidth: true, cards: [{ title: "Local support team" }],
|
||||
formHeading: "Get a free consultation", formText: "It takes a minute.",
|
||||
});
|
||||
await user.selectOptions(screen.getByLabelText("Sign-up form"), "");
|
||||
expect(screen.queryByLabelText("Form heading")).not.toBeInTheDocument();
|
||||
await user.click(screen.getByRole("button", { name: "Save" }));
|
||||
await waitFor(() => expect(mocks.savePage).toHaveBeenCalledTimes(2));
|
||||
const hero = mocks.savePage.mock.calls[1][1].blocks[0];
|
||||
expect([hero.formHeading, hero.formText]).toEqual([undefined, undefined]);
|
||||
});
|
||||
|
||||
it("a super admin must choose a company for a new page", async () => {
|
||||
mocks.useAdminAuth.mockReturnValue({ isSuper: true, companyCode: null });
|
||||
const user = userEvent.setup();
|
||||
|
||||
@@ -223,6 +223,7 @@ function FormEditor({ p, ask }: { p: Draft; ask: Ask }) {
|
||||
onMove={(delta) => p.moveBlock(index, delta)}
|
||||
onRemove={() => p.removeBlock(row.key)}
|
||||
onChooseImage={(file) => p.chooseImage(row.key, file)}
|
||||
onUploadImage={p.uploadImage}
|
||||
/>
|
||||
))}
|
||||
<FieldError message={errors.blocks} />
|
||||
|
||||
@@ -58,6 +58,16 @@ describe("usePageDraft for the on-page editor", () => {
|
||||
expect(result.current.rows.map((r) => r.block.eventUuid ?? null)).toEqual([null, null, null]);
|
||||
});
|
||||
|
||||
// add-hero-full-width: the form card's heading and text go with the form, or the server refuses the save.
|
||||
it("a company switch also drops a hero's form heading and text", async () => {
|
||||
mocks.getPage.mockResolvedValueOnce({ ...stored, blocks: [
|
||||
{ type: "HERO" as const, heading: "Hi", eventUuid: "77", formHeading: "Get a free consultation", formText: "Quick." },
|
||||
] });
|
||||
const { result } = await loaded();
|
||||
act(() => result.current.changeCompany(3));
|
||||
expect(result.current.rows[0].block).toEqual({ type: "HERO", heading: "Hi", eventUuid: null });
|
||||
});
|
||||
|
||||
it("keeps the company's branding from the loaded page", async () => {
|
||||
const { result } = await loaded();
|
||||
expect(result.current.branding).toEqual(stored.company);
|
||||
|
||||
@@ -191,11 +191,18 @@ export function usePageDraft({ pageId, fromId, initialBlocks }: { pageId?: numbe
|
||||
step("page:title");
|
||||
setDraft((d) => withTitle(d, title));
|
||||
};
|
||||
/** A super admin's new page changes company: FORM blocks and hero sign-up forms lose their event, which belongs to the old one. */
|
||||
/**
|
||||
* A super admin's new page changes company: FORM blocks and hero sign-up forms lose their event, which belongs to the old one,
|
||||
* and a hero's form heading and text go with its form (add-hero-full-width).
|
||||
*/
|
||||
const changeCompany = (companyId: number) => {
|
||||
step(null);
|
||||
setDraft((d) => ({ ...d, companyId }));
|
||||
setRows((rs) => rs.map((r) => (r.block.eventUuid ? { ...r, block: { ...r.block, eventUuid: null } } : r)));
|
||||
setRows((rs) => rs.map((r) => {
|
||||
if (!r.block.eventUuid) return r;
|
||||
const { formHeading: _h, formText: _t, ...block } = r.block;
|
||||
return { ...r, block: { ...block, eventUuid: null } };
|
||||
}));
|
||||
};
|
||||
const setBlock = (key: number, update: (block: CmsBlock) => CmsBlock) =>
|
||||
setRows((rs) => rs.map((r) => (r.key === key ? { ...r, block: update(r.block) } : r)));
|
||||
@@ -318,6 +325,20 @@ export function usePageDraft({ pageId, fromId, initialBlocks }: { pageId?: numbe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* add-html-image-upload: uploads an image for a Custom HTML block at once, for the page's company. Resolves to its id;
|
||||
* rejects with the reason to show (no company yet, or the server's refusal).
|
||||
*/
|
||||
async function uploadImage(file: File): Promise<number> {
|
||||
if (isSuper && !draft.companyId) throw new Error(t("ChooseCompany"));
|
||||
try {
|
||||
return (await uploadPageImage(draft.companyId, (await readDataUrl(file)).split(",")[1])).id;
|
||||
} catch (err) {
|
||||
const code = err instanceof ApiError ? (err.data as { code?: string } | undefined)?.code : undefined;
|
||||
throw new Error(t(code ?? "PagesSaveFailed"));
|
||||
}
|
||||
}
|
||||
|
||||
/** Saves the current edits, then makes the draft live. */
|
||||
async function publishChanges() {
|
||||
if (draft.id == null || !(await save())) return;
|
||||
@@ -377,7 +398,7 @@ export function usePageDraft({ pageId, fromId, initialBlocks }: { pageId?: numbe
|
||||
selected, select: setSelected, revealed, frameVersion, stale,
|
||||
canUndo: past.length > 0, canRedo: future.length > 0, undo, redo, endTyping,
|
||||
patch, setTitle, changeCompany, updateBlock, text, html, moveBlock, moveBlockTo, removeBlock, addBlock, insertBlock, duplicateBlock,
|
||||
chooseImage, blockErrors,
|
||||
chooseImage, uploadImage, blockErrors,
|
||||
save, publishChanges, discardChanges, remove,
|
||||
};
|
||||
}
|
||||
@@ -198,6 +198,7 @@ export function VisualEditor({ p, ask }: { p: Draft; ask: Ask }) {
|
||||
onMove={(delta) => p.moveBlock(selected, delta)}
|
||||
onRemove={() => p.removeBlock(row.key)}
|
||||
onChooseImage={(f) => p.chooseImage(row.key, f)}
|
||||
onUploadImage={p.uploadImage}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -30,7 +30,7 @@ export const BLOCK_LABELS: Record<BlockType, string> = {
|
||||
CTA: "PagesBlockCta",
|
||||
};
|
||||
|
||||
/** A FEATURES (icon, title, text), STEPS (title, text) or TRUST (title) card. */
|
||||
/** A FEATURES (icon, title, text), STEPS (title, text) or TRUST (title) card; a HERO's points are title-only cards. */
|
||||
export interface CmsCard {
|
||||
icon?: string;
|
||||
title: string;
|
||||
@@ -58,6 +58,10 @@ export interface CmsBlock {
|
||||
cards?: CmsCard[];
|
||||
/** The FORM block's event (a Snowflake uuid, kept as a string). */
|
||||
eventUuid?: string | null;
|
||||
/** add-hero-full-width: a HERO across the whole window, and its form card's heading (80) and text (200). */
|
||||
fullWidth?: boolean;
|
||||
formHeading?: string;
|
||||
formText?: string;
|
||||
}
|
||||
|
||||
export type PageStatus = "DRAFT" | "PUBLISHED";
|
||||
|
||||
@@ -47,4 +47,13 @@ describe("frame script: height report", () => {
|
||||
runFrameScript("<header>Top bar</header>");
|
||||
expect(post).toHaveBeenCalledWith({ type: "colite-frame-height", height: 70 }, "*");
|
||||
});
|
||||
|
||||
it("reports again when the page asks", () => {
|
||||
const post = vi.spyOn(window.parent, "postMessage").mockImplementation(() => {});
|
||||
vi.spyOn(document.documentElement, "getBoundingClientRect").mockReturnValue({ height: 68 } as DOMRect);
|
||||
runFrameScript("<header>Top bar</header>");
|
||||
post.mockClear();
|
||||
window.dispatchEvent(new MessageEvent("message", { data: { type: "colite-frame-ask" } }));
|
||||
expect(post).toHaveBeenCalledWith({ type: "colite-frame-height", height: 68 }, "*");
|
||||
});
|
||||
});
|
||||
@@ -33,11 +33,13 @@ describe("frameHtml", () => {
|
||||
expect(frameResponse("<p>x</p>", { preview: false }).headers.get("cache-control")).not.toBe("no-store");
|
||||
});
|
||||
|
||||
it("clamps a reported height between 100 and 20000 pixels and ignores junk", () => {
|
||||
// add-hero-full-width: the floor is 20 px, so a 68 px top bar keeps its own height.
|
||||
it("clamps a reported height between 20 and 20000 pixels and ignores junk", () => {
|
||||
const start = { height: START_HEIGHT, steps: [] };
|
||||
expect(START_HEIGHT).toBe(600);
|
||||
expect(nextFrameHeight(start, { type: "colite-frame-height", height: 3000 }).height).toBe(3000);
|
||||
expect(nextFrameHeight(start, { type: "colite-frame-height", height: 10 }).height).toBe(100);
|
||||
expect(nextFrameHeight(start, { type: "colite-frame-height", height: 68 }).height).toBe(68);
|
||||
expect(nextFrameHeight(start, { type: "colite-frame-height", height: 10 }).height).toBe(20);
|
||||
expect(nextFrameHeight(start, { type: "colite-frame-height", height: 99999 }).height).toBe(20000);
|
||||
for (const junk of [null, "600", { type: "other", height: 900 }, { type: "colite-frame-height", height: "900" }, { type: "colite-frame-height", height: NaN }]) {
|
||||
expect(nextFrameHeight(start, junk)).toBe(start);
|
||||
|
||||
@@ -6,8 +6,10 @@ export const FRAME_SANDBOX = "allow-scripts allow-popups allow-popups-to-escape-
|
||||
/** The frame document's own policy. next.config sends it too: config headers replace a route's header of the same name. */
|
||||
export const FRAME_CSP = `sandbox ${FRAME_SANDBOX}; frame-ancestors 'self'`;
|
||||
export const FRAME_MESSAGE = "colite-frame-height";
|
||||
/** The page asks a frame to report its height again: its first report can come before the page listens (add-hero-full-width). */
|
||||
export const FRAME_ASK_MESSAGE = "colite-frame-ask";
|
||||
export const START_HEIGHT = 600;
|
||||
const MIN_HEIGHT = 100;
|
||||
const MIN_HEIGHT = 20;
|
||||
const MAX_HEIGHT = 20000;
|
||||
|
||||
export const FRAME_ANCHOR_MESSAGE = "colite-frame-anchor";
|
||||
@@ -15,11 +17,11 @@ export const FRAME_ANCHOR_MESSAGE = "colite-frame-anchor";
|
||||
const ANCHOR_SOURCE = "^(?!reg-)[a-z0-9][a-z0-9-]{0,39}$";
|
||||
const ANCHOR = new RegExp(ANCHOR_SOURCE);
|
||||
|
||||
// Posts the content height (not scrollHeight, which never drops below the frame itself) to the parent page on load and whenever it changes. A click on a #name link
|
||||
// Posts the content height (not scrollHeight, which never drops below the frame itself) to the parent page on load, whenever it changes, and when the page asks. A click on a #name link
|
||||
// (add-page-anchor-links) asks the page to scroll instead: the frame is as tall as its content and never scrolls.
|
||||
const FRAME_SCRIPT =
|
||||
`<script>(function(){function s(){parent.postMessage({type:"${FRAME_MESSAGE}",height:Math.ceil(document.documentElement.getBoundingClientRect().height)},"*")}` +
|
||||
`addEventListener("load",s);if(window.ResizeObserver)new ResizeObserver(s).observe(document.documentElement);s();` +
|
||||
`addEventListener("load",s);addEventListener("message",function(e){if(e.data&&e.data.type==="${FRAME_ASK_MESSAGE}")s()});if(window.ResizeObserver)new ResizeObserver(s).observe(document.documentElement);s();` +
|
||||
`document.addEventListener("click",function(e){var a=e.target&&e.target.closest&&e.target.closest('a[href^="#"]');if(!a)return;` +
|
||||
`var n=a.getAttribute("href").slice(1);if(!/${ANCHOR_SOURCE}/.test(n))return;e.preventDefault();var t=document.getElementById(n);` +
|
||||
`parent.postMessage({type:"${FRAME_ANCHOR_MESSAGE}",name:n,y:t?Math.round(t.getBoundingClientRect().top+scrollY):null},"*")})})();</script>`;
|
||||
|
||||
@@ -870,6 +870,13 @@ export const DEFAULT_MESSAGES: Record<string, string> = {
|
||||
PagesFormPreview: "The sign-up form shows here on the published page.",
|
||||
PagesHeroForm: "Sign-up form",
|
||||
PagesNoForm: "No form",
|
||||
PagesFullWidth: "Full width",
|
||||
PagesPointN: "Point {number}",
|
||||
PagesAddPoint: "Add point",
|
||||
PagesFormHeading: "Form heading",
|
||||
PagesFormText: "Form text",
|
||||
PagesUploadImage: "Upload image",
|
||||
PagesUploadImageHint: "PNG, JPEG or WebP up to 2 MB. Paste the link into your HTML, for example in an img tag's src.",
|
||||
PagesToolbar: "Formatting",
|
||||
PagesTextStyle: "Text style",
|
||||
PagesParagraph: "Paragraph",
|
||||
|
||||
@@ -855,6 +855,13 @@
|
||||
"PagesFormPreview": "发布后的网页会在此显示报名表。",
|
||||
"PagesHeroForm": "报名表单",
|
||||
"PagesNoForm": "不显示表单",
|
||||
"PagesFullWidth": "全宽",
|
||||
"PagesPointN": "要点 {number}",
|
||||
"PagesAddPoint": "添加要点",
|
||||
"PagesFormHeading": "表单标题",
|
||||
"PagesFormText": "表单说明",
|
||||
"PagesUploadImage": "上传图片",
|
||||
"PagesUploadImageHint": "PNG、JPEG 或 WebP,最大 2 MB。将链接粘贴到您的 HTML 中,例如 img 标签的 src。",
|
||||
"PagesToolbar": "格式",
|
||||
"PagesTextStyle": "文字样式",
|
||||
"PagesParagraph": "段落",
|
||||
|
||||
+6
-1
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* One landing-page block. Which fields apply depends on {@code type}:
|
||||
* HERO (imageId, heading, text, button, optional eventUuid for a sign-up form beside the text), RICH_TEXT (html), IMAGE_TEXT (imageId, imagePosition, heading, html, button),
|
||||
* HERO (imageId, heading, text, button, optional eventUuid for a sign-up form beside the text, fullWidth, formHeading and formText, cards as title-only points), RICH_TEXT (html), IMAGE_TEXT (imageId, imagePosition, heading, html, button),
|
||||
* FAQ (heading, items), FORM (heading, eventUuid), HTML (html), FEATURES (heading, text, cards), STEPS (heading, cards),
|
||||
* TRUST (cards), CTA (heading, text, button). Any block may carry anchor and look.
|
||||
*/
|
||||
@@ -35,4 +35,9 @@ public class CmsBlock {
|
||||
/** A Snowflake value beyond JavaScript number precision: written as a string, read from either. */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long eventUuid;
|
||||
/** add-hero-full-width: a HERO spanning the whole window. */
|
||||
private Boolean fullWidth;
|
||||
/** add-hero-full-width: heading (80) and text (200) at the top of a HERO's form card; only with an event. */
|
||||
private String formHeading;
|
||||
private String formText;
|
||||
}
|
||||
+19
-7
@@ -27,7 +27,7 @@ public final class CmsBlockValidator {
|
||||
/** Section looks and feature icons (add-page-sections). */
|
||||
private static final Set<String> LOOKS = Set.of("DEFAULT", "MUTED", "DARK", "ACCENT");
|
||||
static final Set<String> ICONS = Set.of("wifi", "phone", "tv", "monitor", "lock", "shield-check", "cloud", "wrench", "headset", "users", "calendar", "star");
|
||||
private static final Set<String> CARD_TYPES = Set.of("FEATURES", "STEPS", "TRUST");
|
||||
private static final Set<String> CARD_TYPES = Set.of("FEATURES", "STEPS", "TRUST", "HERO");
|
||||
private static final Pattern SCRIPT = Pattern.compile("(?i)<\\s*script|\\son[a-z]+\\s*=|javascript\\s*:");
|
||||
|
||||
private CmsBlockValidator() {
|
||||
@@ -75,6 +75,18 @@ public final class CmsBlockValidator {
|
||||
if (b.getEventUuid() != null && !ownEvent.test(b.getEventUuid())) {
|
||||
throw refuse(path + ".eventUuid", "PagesBadEvent");
|
||||
}
|
||||
// add-hero-full-width: up to 6 title-only points, and a form card heading and text only with a form.
|
||||
if (b.getCards() != null) {
|
||||
cards(b, path, 0, false, false);
|
||||
}
|
||||
max(b.getFormHeading(), path + ".formHeading", 80);
|
||||
max(b.getFormText(), path + ".formText", 200);
|
||||
if (b.getEventUuid() == null && b.getFormHeading() != null) {
|
||||
throw refuse(path + ".formHeading", "PagesUnusedField");
|
||||
}
|
||||
if (b.getEventUuid() == null && b.getFormText() != null) {
|
||||
throw refuse(path + ".formText", "PagesUnusedField");
|
||||
}
|
||||
}
|
||||
case "RICH_TEXT" -> html(b.getHtml(), path + ".html");
|
||||
case "HTML" -> {
|
||||
@@ -102,18 +114,18 @@ public final class CmsBlockValidator {
|
||||
required(b.getHeading(), path + ".heading");
|
||||
max(b.getHeading(), path + ".heading", 120);
|
||||
max(b.getText(), path + ".text", 300);
|
||||
cards(b, path, true, true);
|
||||
cards(b, path, 2, true, true);
|
||||
}
|
||||
case "STEPS" -> {
|
||||
required(b.getHeading(), path + ".heading");
|
||||
max(b.getHeading(), path + ".heading", 120);
|
||||
cards(b, path, false, true);
|
||||
cards(b, path, 2, false, true);
|
||||
}
|
||||
case "TRUST" -> {
|
||||
if (b.getHeading() != null) {
|
||||
throw refuse(path + ".heading", "PagesUnusedField");
|
||||
}
|
||||
cards(b, path, false, false);
|
||||
cards(b, path, 2, false, false);
|
||||
}
|
||||
case "CTA" -> {
|
||||
required(b.getHeading(), path + ".heading");
|
||||
@@ -173,10 +185,10 @@ public final class CmsBlockValidator {
|
||||
}
|
||||
}
|
||||
|
||||
/** 2 to 6 cards; an icon from the list where the type uses one, a title (80), a text (300) where used, nothing else. */
|
||||
private static void cards(CmsBlock b, String path, boolean icon, boolean text) {
|
||||
/** min to 6 cards; an icon from the list where the type uses one, a title (80), a text (300) where used, nothing else. */
|
||||
private static void cards(CmsBlock b, String path, int min, boolean icon, boolean text) {
|
||||
List<CmsCard> cards = b.getCards();
|
||||
if (cards == null || cards.size() < 2 || cards.size() > 6) {
|
||||
if (cards == null || cards.size() < min || cards.size() > 6) {
|
||||
throw refuse(path + ".cards", "PagesCardCount");
|
||||
}
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
|
||||
+56
@@ -1,6 +1,7 @@
|
||||
package com.solvway.services.counter.service;
|
||||
|
||||
import com.solvway.services.counter.dto.CmsBlock;
|
||||
import com.solvway.services.counter.dto.CmsCard;
|
||||
import com.solvway.services.counter.dto.CmsFaqItem;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -216,4 +217,59 @@ class CmsBlockValidatorTest {
|
||||
again.setAnchor("signup");
|
||||
refused(List.of(named, again), "blocks[1].anchor", "PagesAnchorTaken");
|
||||
}
|
||||
|
||||
// add-hero-full-width: points are title-only cards, 0 to 6 of them.
|
||||
private static List<CmsCard> points(int n) {
|
||||
List<CmsCard> out = new ArrayList<>();
|
||||
for (int i = 0; i < n; i++) out.add(new CmsCard(null, "Local support team in Malaysia", null));
|
||||
return out;
|
||||
}
|
||||
|
||||
@Test
|
||||
void aHeroMayCarryUpToSixTitleOnlyPoints() {
|
||||
CmsBlock one = hero();
|
||||
one.setCards(points(1));
|
||||
CmsBlock six = hero();
|
||||
six.setCards(points(6));
|
||||
assertThatCode(() -> validate(List.of(one, six))).doesNotThrowAnyException();
|
||||
CmsBlock seven = hero();
|
||||
seven.setCards(points(7));
|
||||
refused(List.of(seven), "blocks[0].cards", "PagesCardCount");
|
||||
CmsBlock blank = hero();
|
||||
blank.setCards(List.of(new CmsCard(null, " ", null)));
|
||||
refused(List.of(blank), "blocks[0].cards[0].title", "PagesRequired");
|
||||
CmsBlock longPoint = hero();
|
||||
longPoint.setCards(List.of(new CmsCard(null, "x".repeat(81), null)));
|
||||
refused(List.of(longPoint), "blocks[0].cards[0].title", "PagesTooLong");
|
||||
CmsBlock withIcon = hero();
|
||||
withIcon.setCards(List.of(new CmsCard("wifi", "WiFi", null)));
|
||||
refused(List.of(withIcon), "blocks[0].cards[0].icon", "PagesUnusedField");
|
||||
CmsBlock withText = hero();
|
||||
withText.setCards(List.of(new CmsCard(null, "WiFi", "More")));
|
||||
refused(List.of(withText), "blocks[0].cards[0].text", "PagesUnusedField");
|
||||
}
|
||||
|
||||
@Test
|
||||
void aHeroWithAFormMayCarryAFormHeadingAndText() {
|
||||
CmsBlock ok = hero();
|
||||
ok.setEventUuid(OWN_EVENT);
|
||||
ok.setFullWidth(true);
|
||||
ok.setFormHeading("Get a free consultation");
|
||||
ok.setFormText("Tell us about your property. It takes under a minute.");
|
||||
assertThatCode(() -> validate(List.of(ok))).doesNotThrowAnyException();
|
||||
CmsBlock longHeading = hero();
|
||||
longHeading.setEventUuid(OWN_EVENT);
|
||||
longHeading.setFormHeading("x".repeat(81));
|
||||
refused(List.of(longHeading), "blocks[0].formHeading", "PagesTooLong");
|
||||
CmsBlock longText = hero();
|
||||
longText.setEventUuid(OWN_EVENT);
|
||||
longText.setFormText("x".repeat(201));
|
||||
refused(List.of(longText), "blocks[0].formText", "PagesTooLong");
|
||||
CmsBlock noForm = hero();
|
||||
noForm.setFormHeading("Get a free consultation");
|
||||
refused(List.of(noForm), "blocks[0].formHeading", "PagesUnusedField");
|
||||
CmsBlock noFormText = hero();
|
||||
noFormText.setFormText("Tell us more");
|
||||
refused(List.of(noFormText), "blocks[0].formText", "PagesUnusedField");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user