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
21 lines
2.0 KiB
Markdown
21 lines
2.0 KiB
Markdown
# 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`.
|
|
|
|
## Workflow follow-up
|
|
|
|
- PR to `main` and merge; archive on its own branch with its own PR.
|