Files
co-lite/openspec/changes/add-hero-signup-form/tasks.md
T

3.6 KiB

Tasks

1. Server

  • 1.1 services-counter CmsBlockValidator: a HERO's optional eventUuid must be an event of the page's company, refused at blocks[n].eventUuid with PagesBadEvent. Verify: new validator tests (own event saves, other company's event refused, no event saves) fail first, then pass; mvn -T 1C -pl solvway-services-counter verify.
  • 1.2 mobile-api PublicPageService: page() attaches form/closed to every block with an event that is FORM or HERO; submit() accepts a HERO with an event and refuses a HERO without one as not found. Verify: new service tests fail first, then pass; mvn -T 1C -pl solvway-mobile-api verify.

2. Portal

  • 2.1 CmsBlocks.tsx HERO: with form or closed, two columns from md (text left, form card right; stacked on phones), image and shade kept; the card is LandingForm with the hero's block index. Verify: render tests for with/without event, closed, and the edit canvas; vitest exit 0.
  • 2.2 BlockFields.tsx: the Hero gets the event picker ("No form" default, same hint and unavailable-event option as FORM; eventUuid shown inline); usePageDraft clears a HERO's event on company switch like a FORM's; labels PagesHeroForm and PagesNoForm in defaultMessages.ts, zh_CN.seed.json and an SQL label file in this change folder. Verify: editor tests fail first, then pass; tsc and lint clean.

3. Verification

  • 3.1 Rebuild services-counter and mobile-api locally; Playwright on port 3001: give a page's hero an event, see the card beside the text at 1280 px and below it at 390 px, submit as a visitor on the published page and see the lead under Event leads with source Web page; pick another company's event is impossible in the picker, and an ended event shows "closed". Use a disposable test page and the existing "LP Enquiries" test event; delete the test page after.
  • 3.2 Full portal vitest (exit 0), tsc, lint, both Maven modules, openspec validate add-hero-signup-form --strict.

Notes (2026-12-03)

  • Red first: each new test failed before its code existed. The validator test failed on the foreign event; the service tests found no form on the hero; the render tests, the editor picker test and the company-switch test failed too.
  • Existing editor test: one query was scoped to the FORM block's picker, because "Website enquiries" is now an option in two pickers. Its assertions are unchanged.
  • Live check (port 3001, rebuilt counter and mobile-api), on the throwaway page "Live check hero form":
    • the hero picker defaults to "No form";
    • the canvas shows the card beside the text;
    • published at 1280 px, the form sits beside the text, and at 390 px below it;
    • the visitor "Hero Check Visitor" registered from the hero and appears under INS website enquiries with "Web page: /p/INS/live-check-hero-form";
    • the page was deleted afterwards. The test lead stays in the local database.
  • Fixes from the live check:
    • the hero text is top-aligned, because a long form left it below the fold;
    • the top padding is larger, so the editor's image button clears the heading;
    • the shade is a gradient, because the design-token test refuses flat bg-black/*.
  • Not checked live:
    • the closed state, which the picker cannot reach because it offers no ended events (covered by the service and render tests);
    • the other-company refusal, which the picker cannot reach either (covered by the validator test).
  • Results: Maven verify passed for services-counter and mobile-api; vitest 1985 passed (exit 0); tsc clean; lint 0 errors.

Workflow follow-up

  • PR to main and merge; archive on its own branch with its own PR.