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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-04 09:46:32 +08:00
1 parent dbb58e6e94
commit b55b8d2d86
25 files changed
+575 -46

No files matched your search

@@ -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;
}
@@ -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++) {