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 ` set({ interestIds: e.target.value ? [Number(e.target.value)] : [] })}> + + {info.interests.map((i) => )} + + + ); + const notice = ( + <> +

{t("RegNoticeEn")}

+

{info.notice.textEn}

+

{t("RegNoticeMs")}

+

{info.notice.textMs}

+ + ); + return (
{formError &&

{formError}

} @@ -101,29 +140,16 @@ export function RegistrationForm({ tooManyKey, info, initial, submit, onDone, on {field("mobile", t("RegMobile"), "tel", t("RegContactHint"))} {field("email", t("RegEmail"), "email")} {field("companyName", t("RegCompany"))} - {field("jobTitle", t("RegJobTitle"))} - {info.interests.length > 0 && ( -
- {t("RegInterests")} - {info.interests.map((i) => ( - - ))} -
+ {compact ? null : field("jobTitle", t("RegJobTitle"))} + {info.interests.length > 0 && (compact ? serviceDropdown : interestBoxes)} + {compact ? ( +
+ {t("RegNoticeSummary")} +
{notice}
+
+ ) : ( +
{notice}
)} -
-

{t("RegNoticeEn")}

-

{info.notice.textEn}

-

{t("RegNoticeMs")}

-

{info.notice.textMs}

-