A HERO block may name an event. services-counter checks it belongs to the page's company; mobile-api serves and accepts the form for it like a FORM block; the portal shows the form in a card beside the hero text (below it on phones), with the hero's own event picker, "No form" by default. OpenSpec change: add-hero-signup-form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2.0 KiB
2.0 KiB
Tasks
1. Server
- 1.1 services-counter
CmsBlockValidator: a HERO's optionaleventUuidmust be an event of the page's company, refused atblocks[n].eventUuidwithPagesBadEvent. 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()attachesform/closedto 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.tsxHERO: withformorclosed, two columns frommd(text left, form card right; stacked on phones), image and shade kept; the card isLandingFormwith 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;eventUuidshown inline);usePageDraftclears a HERO's event on company switch like a FORM's; labelsPagesHeroFormandPagesNoFormindefaultMessages.ts,zh_CN.seed.jsonand 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.
Workflow follow-up
- PR to
mainand merge; archive on its own branch with its own PR.