From ba6ab7554db46ca6e2fd413974235828f30a637f Mon Sep 17 00:00:00 2001
From: ngqile
Date: Fri, 4 Dec 2026 10:47:02 +0800
Subject: [PATCH] feat(pages): a short sign-up form on landing pages, and
coloured sections join
Landing-page forms drop job title, ask for one service in a dropdown and fold the
privacy notice behind one line above the consent box. QR, invitation and customer
forms keep the full form. Sections with a colour look join with no gap.
Co-Authored-By: Claude Opus 5.5
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
---
docs/deployment.md | 2 +
local/seed/04-zh-cn-messages.sql | 6 ++
.../add-compact-landing-form/.openspec.yaml | 2 +
.../add-compact-landing-form/proposal.md | 44 ++++++++++++
.../specs/landing-pages/spec.md | 45 ++++++++++++
.../sql/01-compact-form-labels.sql | 9 +++
.../changes/add-compact-landing-form/tasks.md | 39 ++++++++++
.../app/components/pages/CmsBlocks.test.tsx | 20 ++++++
.../app/components/pages/CmsBlocks.tsx | 9 ++-
.../app/components/pages/LandingForm.tsx | 2 +-
.../RegistrationForm.compact.test.tsx | 49 +++++++++++++
.../registration/RegistrationForm.tsx | 72 +++++++++++++------
.../app/lib/i18n/defaultMessages.ts | 3 +
.../app/lib/i18n/zh_CN.seed.json | 3 +
14 files changed, 278 insertions(+), 27 deletions(-)
create mode 100644 openspec/changes/add-compact-landing-form/.openspec.yaml
create mode 100644 openspec/changes/add-compact-landing-form/proposal.md
create mode 100644 openspec/changes/add-compact-landing-form/specs/landing-pages/spec.md
create mode 100644 openspec/changes/add-compact-landing-form/sql/01-compact-form-labels.sql
create mode 100644 openspec/changes/add-compact-landing-form/tasks.md
create mode 100644 solvway-admin-portal/app/components/registration/RegistrationForm.compact.test.tsx
diff --git a/docs/deployment.md b/docs/deployment.md
index 12175b1..1afbed6 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -470,4 +470,6 @@ A form stops taking sign-ups when its event is disabled, its end date has passed
**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.
+**Release add-compact-landing-form (SQL, in its OpenSpec change folder):** deploy the portal, then run `sql/01-compact-form-labels.sql` (labels only). Landing-page sign-up forms drop job title, ask for one service in a dropdown, and fold the privacy notice behind one line. Coloured sections now join with no gap. QR, invitation and customer forms are unchanged. Before go-live, the PDPA owner should confirm the folded notice. 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.
diff --git a/local/seed/04-zh-cn-messages.sql b/local/seed/04-zh-cn-messages.sql
index 6cb393c..93718a4 100644
--- a/local/seed/04-zh-cn-messages.sql
+++ b/local/seed/04-zh-cn-messages.sql
@@ -1117,6 +1117,12 @@ INSERT INTO message (code, content, area) SELECT 'RegCompany', JSON_OBJECT('en_U
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '公司') WHERE LOWER(code) = LOWER('RegCompany') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'RegJobTitle', JSON_OBJECT('en_US', 'Job title', 'zh_CN', '职位'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('RegJobTitle') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '职位') WHERE LOWER(code) = LOWER('RegJobTitle') AND area = 'A';
+INSERT INTO message (code, content, area) SELECT 'RegServiceInterest', JSON_OBJECT('en_US', 'Service interested in (optional)', 'zh_CN', '感兴趣的服务(可选)'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('RegServiceInterest') AND area = 'A');
+UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '感兴趣的服务(可选)') WHERE LOWER(code) = LOWER('RegServiceInterest') AND area = 'A';
+INSERT INTO message (code, content, area) SELECT 'RegChooseService', JSON_OBJECT('en_US', 'Choose a service', 'zh_CN', '选择服务'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('RegChooseService') AND area = 'A');
+UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '选择服务') WHERE LOWER(code) = LOWER('RegChooseService') AND area = 'A';
+INSERT INTO message (code, content, area) SELECT 'RegNoticeSummary', JSON_OBJECT('en_US', 'How we use your details (English / Bahasa Malaysia)', 'zh_CN', '我们如何使用您的资料(English / Bahasa Malaysia)'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('RegNoticeSummary') AND area = 'A');
+UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '我们如何使用您的资料(English / Bahasa Malaysia)') WHERE LOWER(code) = LOWER('RegNoticeSummary') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'RegInterests', JSON_OBJECT('en_US', 'Interests (optional)', 'zh_CN', '兴趣(可选)'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('RegInterests') AND area = 'A');
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '兴趣(可选)') WHERE LOWER(code) = LOWER('RegInterests') AND area = 'A';
INSERT INTO message (code, content, area) SELECT 'RegNoticeEn', JSON_OBJECT('en_US', 'English', 'zh_CN', '英文'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('RegNoticeEn') AND area = 'A');
diff --git a/openspec/changes/add-compact-landing-form/.openspec.yaml b/openspec/changes/add-compact-landing-form/.openspec.yaml
new file mode 100644
index 0000000..2ad7578
--- /dev/null
+++ b/openspec/changes/add-compact-landing-form/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-12-04
diff --git a/openspec/changes/add-compact-landing-form/proposal.md b/openspec/changes/add-compact-landing-form/proposal.md
new file mode 100644
index 0000000..af8f88e
--- /dev/null
+++ b/openspec/changes/add-compact-landing-form/proposal.md
@@ -0,0 +1,44 @@
+# Proposal
+
+## Why
+
+The INS sign-up form on the standalone landing page is short: full name, email, phone, company, a single "service" dropdown and the button. Co-Lite's landing-page form is roughly three times as long. Most of that comes from three things: the full English and Malay privacy notice shown in the form, five interest checkboxes, and a job-title field that INS does not ask for. On the rebuilt Hotel technology page, the form card is taller than two screens.
+
+The coloured sections at the end of the page have a second problem: they are separated by pale gaps. The dark call to action and the dark footer therefore read as two footers.
+
+The owner chose the following on 2026-12-04: a collapsed privacy notice, one interest as a dropdown, and no job title on landing pages.
+
+## What Changes
+
+- **Landing-page forms are compact.** This covers the FORM block and a hero's form; QR, invitation and customer sign-up forms are unchanged.
+ - The interests are a single optional dropdown ("Service interested in"), so a submission carries at most one interest.
+ - There is no job-title field.
+ - The privacy notice is folded behind one line, "How we use your details (English / Bahasa Malaysia)", just above the consent box. It opens to the full bilingual notice.
+ - The consent box itself and its wording do not change.
+- **Coloured sections join.** A block with a non-default look (light grey, dark or company colour) counts as full width, like Custom HTML and the full-width hero. Two such blocks next to each other join with no gap.
+
+Not changing:
+- The server: it already accepts a submission without a job title and with zero or one interest.
+- The QR, invitation and customer forms.
+- The notice text, which consent still covers.
+
+## Capabilities
+
+### New Capabilities
+
+None.
+
+### Modified Capabilities
+
+- `landing-pages`:
+ - modifies "Full-Width Blocks Join Without Gaps";
+ - adds "Compact Landing-Page Form".
+
+## Impact
+
+- Portal:
+ - `RegistrationForm.tsx` gains a `compact` option;
+ - `LandingForm.tsx` passes it;
+ - `CmsBlocks.tsx` extends `bleeds()` to banded looks;
+ - new labels.
+- The compliance owner should confirm that a folded notice next to the consent box meets PDPA. The owner was told this when they chose it.
diff --git a/openspec/changes/add-compact-landing-form/specs/landing-pages/spec.md b/openspec/changes/add-compact-landing-form/specs/landing-pages/spec.md
new file mode 100644
index 0000000..67ffd11
--- /dev/null
+++ b/openspec/changes/add-compact-landing-form/specs/landing-pages/spec.md
@@ -0,0 +1,45 @@
+## ADDED Requirements
+
+### Requirement: Compact Landing-Page Form
+
+A landing page's sign-up form, in a FORM block or a hero, SHALL show name, mobile, email and company, the event's interests as one optional dropdown, the privacy notice folded behind a single line that opens it in full, and the consent box. It SHALL NOT show a job-title field. QR, invitation and customer sign-up forms SHALL keep their full layout.
+
+#### Scenario: Short form on the page
+
+- **GIVEN** a page whose hero has an event with five interests
+- **WHEN** a visitor opens the page
+- **THEN** the form shows name, mobile, email, company, a "Service interested in" dropdown and the consent box, with no job title and no interest checkboxes
+- **AND** the privacy notice is folded behind "How we use your details"
+
+#### Scenario: Pick one service
+
+- **WHEN** the visitor chooses "Cloud IP PABX" in the dropdown and submits
+- **THEN** the submission carries that one interest
+
+#### Scenario: Read the notice
+
+- **WHEN** the visitor opens "How we use your details"
+- **THEN** the full English and Malay notice shows above the consent box
+
+#### Scenario: QR form unchanged
+
+- **WHEN** a visitor opens an event's QR sign-up form
+- **THEN** it shows job title, the interest checkboxes and the full notice as before
+
+## MODIFIED Requirements
+
+### Requirement: Full-Width Blocks Join Without Gaps
+
+A full-width HERO, a Custom HTML block, and a block with a non-default look SHALL join with no gap when two of them are 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
+
+#### Scenario: Dark call to action runs into a dark footer
+
+- **GIVEN** a CTA block with the Dark look followed by a text block with the Dark look
+- **WHEN** a visitor opens the page
+- **THEN** the two bands join with no gap between them
diff --git a/openspec/changes/add-compact-landing-form/sql/01-compact-form-labels.sql b/openspec/changes/add-compact-landing-form/sql/01-compact-form-labels.sql
new file mode 100644
index 0000000..a28a529
--- /dev/null
+++ b/openspec/changes/add-compact-landing-form/sql/01-compact-form-labels.sql
@@ -0,0 +1,9 @@
+-- The labels added by add-compact-landing-form, 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 'RegServiceInterest', JSON_OBJECT('en_US', 'Service interested in (optional)', 'zh_CN', '感兴趣的服务(可选)'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('RegServiceInterest') AND area = 'A');
+UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '感兴趣的服务(可选)') WHERE LOWER(code) = LOWER('RegServiceInterest') AND area = 'A';
+INSERT INTO message (code, content, area) SELECT 'RegChooseService', JSON_OBJECT('en_US', 'Choose a service', 'zh_CN', '选择服务'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('RegChooseService') AND area = 'A');
+UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '选择服务') WHERE LOWER(code) = LOWER('RegChooseService') AND area = 'A';
+INSERT INTO message (code, content, area) SELECT 'RegNoticeSummary', JSON_OBJECT('en_US', 'How we use your details (English / Bahasa Malaysia)', 'zh_CN', '我们如何使用您的资料(English / Bahasa Malaysia)'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('RegNoticeSummary') AND area = 'A');
+UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '我们如何使用您的资料(English / Bahasa Malaysia)') WHERE LOWER(code) = LOWER('RegNoticeSummary') AND area = 'A';
diff --git a/openspec/changes/add-compact-landing-form/tasks.md b/openspec/changes/add-compact-landing-form/tasks.md
new file mode 100644
index 0000000..63ea14e
--- /dev/null
+++ b/openspec/changes/add-compact-landing-form/tasks.md
@@ -0,0 +1,39 @@
+# Tasks
+
+## 1. Portal
+
+- [x] 1.1 `RegistrationForm` `compact` option, passed by `LandingForm`:
+ - no job title;
+ - interests in one optional `
", look: "DARK" },
+ ])} />);
+ const rows = Array.from(document.querySelector("main > div")!.children);
+ expect(rows.map((r) => r.classList.contains("mt-10"))).toEqual([false, true, false]);
+ expect(rows.slice(1).map((r) => r.querySelector("[data-look]")?.getAttribute("data-look"))).toEqual(["DARK", "DARK"]);
+ });
+});
+
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 });
diff --git a/solvway-admin-portal/app/components/pages/CmsBlocks.tsx b/solvway-admin-portal/app/components/pages/CmsBlocks.tsx
index 32279cb..64ae251 100644
--- a/solvway-admin-portal/app/components/pages/CmsBlocks.tsx
+++ b/solvway-admin-portal/app/components/pages/CmsBlocks.tsx
@@ -228,14 +228,17 @@ 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);
+/**
+ * Blocks that run the full window width: Custom HTML, a full-width hero, and a coloured band (add-compact-landing-form).
+ * Two of them in a row join with no gap.
+ */
+const bleeds = (block: PublicBlock) => block.type === "HTML" || (block.type === "HERO" && !!block.fullWidth) || !!bandOf(block.look);
/** 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
{children}
;
+ if (block.type === "HERO" && block.fullWidth) return
{children}
;
if (!band) return
{children}
;
return (
diff --git a/solvway-admin-portal/app/components/pages/LandingForm.tsx b/solvway-admin-portal/app/components/pages/LandingForm.tsx
index cfc2224..7c1c2b3 100644
--- a/solvway-admin-portal/app/components/pages/LandingForm.tsx
+++ b/solvway-admin-portal/app/components/pages/LandingForm.tsx
@@ -33,5 +33,5 @@ export function LandingForm({ companyCode, slug, index, info, preview }: { compa
method: "POST",
body: JSON.stringify({ ...body, ...utmTags(window.location.search) }),
});
- return setPhase("done")} onInactive={() => setPhase("closed")} />;
+ return setPhase("done")} onInactive={() => setPhase("closed")} compact />;
}
diff --git a/solvway-admin-portal/app/components/registration/RegistrationForm.compact.test.tsx b/solvway-admin-portal/app/components/registration/RegistrationForm.compact.test.tsx
new file mode 100644
index 0000000..15aec89
--- /dev/null
+++ b/solvway-admin-portal/app/components/registration/RegistrationForm.compact.test.tsx
@@ -0,0 +1,49 @@
+import { describe, it, expect, vi } from "vitest";
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { RegistrationForm } from "./RegistrationForm";
+
+// add-compact-landing-form: landing pages use a short form; QR, invitation and customer forms keep the full one.
+const info = {
+ eventName: "INS enquiries", startDate: "2026-12-01", endDate: "2099-12-31", location: "KL", companyName: "INS",
+ notice: { id: 1, textEn: "English text", textMs: "Teks Melayu" },
+ interests: [{ id: 11, name: "WiFi Managed Services" }, { id: 12, name: "Cloud IP PABX" }],
+};
+const base = { info, onDone: () => {}, onInactive: () => {} };
+
+describe("RegistrationForm compact", () => {
+ it("has no job title, one service dropdown, and the notice folded above the consent box", async () => {
+ const user = userEvent.setup();
+ render( undefined} compact />);
+ expect(screen.queryByLabelText("Job title")).not.toBeInTheDocument();
+ expect(screen.queryByRole("checkbox", { name: "WiFi Managed Services" })).not.toBeInTheDocument();
+ const service = screen.getByRole("combobox", { name: "Service interested in (optional)" });
+ expect(service).toHaveValue("");
+ expect(screen.getByRole("option", { name: "Choose a service" })).toBeInTheDocument();
+ const notice = screen.getByText("English text").closest("details")!;
+ expect(notice).not.toHaveAttribute("open");
+ await user.click(screen.getByText("How we use your details (English / Bahasa Malaysia)"));
+ expect(notice).toHaveAttribute("open");
+ expect(notice.compareDocumentPosition(screen.getByRole("checkbox")) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ });
+
+ it("posts the one chosen service", async () => {
+ const submit = vi.fn().mockResolvedValue(undefined);
+ const user = userEvent.setup();
+ render();
+ await user.type(screen.getByLabelText("Your name"), "Tan");
+ await user.type(screen.getByLabelText("Mobile number"), "0125550101");
+ await user.selectOptions(screen.getByRole("combobox", { name: "Service interested in (optional)" }), "12");
+ await user.click(screen.getByRole("checkbox"));
+ await user.click(screen.getByRole("button", { name: "Register" }));
+ expect(submit.mock.calls[0][0]).toMatchObject({ interestIds: [12], jobTitle: "" });
+ });
+
+ it("keeps the full form without the option", () => {
+ render( undefined} />);
+ expect(screen.getByLabelText("Job title")).toBeInTheDocument();
+ expect(screen.getByRole("checkbox", { name: "WiFi Managed Services" })).toBeInTheDocument();
+ expect(screen.queryByRole("combobox")).not.toBeInTheDocument();
+ expect(screen.getByText("English text").closest("details")).toBeNull();
+ });
+});
diff --git a/solvway-admin-portal/app/components/registration/RegistrationForm.tsx b/solvway-admin-portal/app/components/registration/RegistrationForm.tsx
index be49295..73697db 100644
--- a/solvway-admin-portal/app/components/registration/RegistrationForm.tsx
+++ b/solvway-admin-portal/app/components/registration/RegistrationForm.tsx
@@ -15,6 +15,7 @@ const FIELDS = ["name", "mobile", "email", "companyName", "jobTitle", "consent"]
const ROW = "flex min-h-11 w-full cursor-pointer items-center gap-3 rounded-md border p-3";
const CONSENT_ROW = "flex min-h-11 w-full cursor-pointer items-start gap-3 rounded-md border p-3 leading-normal";
const BOX = "size-6";
+const NOTICE = "rounded-md bg-muted p-3 text-xs text-muted-foreground";
export function apiData(err: unknown): { status?: number; code?: string; error?: string; field?: string } {
if (!(err instanceof ApiError)) return {};
@@ -40,11 +41,13 @@ interface Props {
onDone: () => void;
/** The code or invitation was switched off: the page shows its own message. */
onInactive: () => void;
+ /** add-compact-landing-form: a landing page's short form: no job title, one service dropdown, the notice folded. */
+ compact?: boolean;
}
// The visitor registration form shared by /r, /i and /c: fields, bilingual privacy notice and consent.
// The event header comes from the VisitorCard around it.
-export function RegistrationForm({ tooManyKey, info, initial, submit, onDone, onInactive }: Props) {
+export function RegistrationForm({ tooManyKey, info, initial, submit, onDone, onInactive, compact }: Props) {
const t = useT();
const [form, setForm] = useState({ ...EMPTY, ...initial });
const [errors, setErrors] = useState>({});
@@ -94,6 +97,42 @@ export function RegistrationForm({ tooManyKey, info, initial, submit, onDone, on
);
};
+ const interestBoxes = (
+
+ );
+ // add-compact-landing-form: a landing page asks for at most one service.
+ const serviceDropdown = (
+