docs: archive add-landing-page-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
1 parent
c21a31e10f
commit
cc2d1c794e
7 files changed
+41
No files matched your search
@@ -0,0 +1,2 @@
|
||||
schema: spec-driven
|
||||
created: 2026-12-04
|
||||
@@ -0,0 +1,24 @@
|
||||
# Design
|
||||
|
||||
## Context
|
||||
|
||||
The company header and the page title are drawn by `LandingPage`, and "hide page header" (`hideHeader`) removes both. Page settings are database columns threaded through services-counter, mobile-api and the portal. Blocks are JSON validated by `CmsBlockValidator`, so a new block or block field needs no schema change.
|
||||
|
||||
## Approaches
|
||||
|
||||
1. **A Top bar block, used with "hide page header" (chosen).** It is JSON only: no migration, and no changes to the page records in three services. The INS page already uses "hide page header" with a Custom HTML top bar, so this is a native swap for the same layout.
|
||||
2. **New page settings** ("hide title", header button label and link, heading font). This is the natural model, but it means four new columns and changes to every page DTO, the draft record, the admin and public APIs, and the settings panel. That is about ten times the work for the same result.
|
||||
3. **Keep the top bar in Custom HTML.** This is what the original page does; the native page exists to avoid it.
|
||||
|
||||
## Decisions
|
||||
|
||||
- **The top bar is the first block only.** The server refuses it anywhere else (`PagesTopBarFirst`), because a sticky bar in the middle of a page would cover the content as the visitor scrolls past it. The bar is `sticky top-0` with a card background and a bottom border. It runs full width (it counts as bleed), so it joins a full-width hero below it with no gap.
|
||||
- **Top bar fields.** Only `buttonLabel` and `buttonUrl` (the pair rule, at most 40 characters, a safe link) plus the usual `anchor`. A heading, text, image, cards or look are refused (`PagesUnusedField`). The logo comes from the company's branding, as the default header's does.
|
||||
- **The label (`eyebrow`).** At most 40 characters, allowed on FEATURES, STEPS, IMAGE_TEXT, FAQ and CTA, and refused on other types. It renders as a `p` above the h2, not as part of the heading, so screen readers read the heading on its own. It can be edited in place on the canvas.
|
||||
- **Label colour.** On the DARK band it uses `text-primary`, the accent colour. On light backgrounds the accent can be too pale (INS gold on white is about 2:1), so it uses the accent mixed with the foreground colour, `color-mix(in srgb, var(--primary) 60%, var(--foreground))`. On the ACCENT band it uses the band's own text colour.
|
||||
- **Serif headings.** Section h2s get `font-serif`, Tailwind's system serif, as the full-width hero does. No web font is added. This changes every landing page, CV's included. It is a small change, and it matches the hero.
|
||||
|
||||
## Risks
|
||||
|
||||
- **CV pages change font.** CV's section headings become serif. If CV wants sans-serif, a later change can make the font a company setting.
|
||||
- **Sticky bar and same-page links.** A `#name` jump lands with the heading under the bar. `scroll-margin-top` on the named blocks keeps them clear when a top bar exists.
|
||||
@@ -0,0 +1,42 @@
|
||||
# Proposal
|
||||
|
||||
## Why
|
||||
|
||||
The native INS page (`/p/INS/hotel-technology-native`) now matches INS's standalone page in content, but it still looks different at the top and in its section headings:
|
||||
|
||||
- INS has a white top bar with the logo on the left and a "Get My Free Consultation" button on the right. The bar stays at the top while the visitor scrolls. Our page has two choices: show the company header and the page title, which INS does not have, or hide both, which also hides the logo.
|
||||
- INS puts a small gold uppercase label above each section heading ("Services", "How we work", "Why Infinity", "FAQ"). We have no such label.
|
||||
- INS's section headings are serif. Ours are sans-serif, except for the full-width hero.
|
||||
|
||||
## What Changes
|
||||
|
||||
- **Top bar block** (`TOPBAR`). It shows the company logo on the left (the company name when there is no logo) and an optional button on the right (`buttonLabel` and `buttonUrl`, with the same link rules as other buttons). It stays at the top of the window while the page scrolls. It may only be the first block. Together with "hide page header", it gives INS's layout: the logo and button stay, and the title and the default header go.
|
||||
- **Section labels** (`eyebrow`, at most 40 characters). Feature cards, Steps, Image with text, FAQ and Call to action may carry a short label. It shows above the heading in small uppercase letters in the accent colour, darkened on light backgrounds so it stays readable.
|
||||
- **Serif section headings.** Section headings (h2) on landing pages use the same serif as the full-width hero.
|
||||
- New editor labels in English and Chinese, with an SQL label file.
|
||||
|
||||
Not changing:
|
||||
- The page settings and the database. "Hide page header" already exists, and the new fields live in the block JSON.
|
||||
- Card and step layout, and the bullet style in rich text.
|
||||
- The default company header on pages without a top bar.
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
None.
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `landing-pages`: adds "Top Bar Block", "Section Labels" and "Serif Section Headings".
|
||||
|
||||
## Impact
|
||||
|
||||
- services-counter: `CmsBlock` gains `eyebrow`. `CmsBlockValidator` validates TOPBAR and `eyebrow`.
|
||||
- mobile-api: none. Public blocks pass through as maps.
|
||||
- Portal:
|
||||
- `cmsPages.ts`: the TOPBAR type, its label and empty block, and `eyebrow`;
|
||||
- `CmsBlocks.tsx`: renders the top bar, the labels and the serif headings;
|
||||
- `BlockFields.tsx`: the top bar's button and the label field;
|
||||
- labels in `defaultMessages.ts` and `zh_CN.seed.json`.
|
||||
- Data: no schema change. The new labels need a SQL label file in this change folder.
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Top Bar Block
|
||||
|
||||
A page's first block MAY be a top bar. The top bar SHALL show the company logo, or the company name when there is no logo, and an optional button, and SHALL stay at the top of the window while the page scrolls. The server SHALL refuse a top bar that is not the first block, or one that carries fields other than its button and link name.
|
||||
|
||||
#### Scenario: Logo and button without the page title
|
||||
|
||||
- **GIVEN** page `/p/INS/hotel-technology-native` with "hide page header" on, a top bar with the button "Get My Free Consultation" linking to `#consult`, and a full-width hero
|
||||
- **WHEN** a visitor opens the page and scrolls down
|
||||
- **THEN** the INS logo and the button stay at the top of the window
|
||||
- **AND** no page title heading shows, and the hero starts directly under the bar
|
||||
|
||||
#### Scenario: Top bar further down is refused
|
||||
|
||||
- **WHEN** staff save a page whose top bar is the second block
|
||||
- **THEN** the save is refused with the reason naming that block
|
||||
|
||||
### Requirement: Section Labels
|
||||
|
||||
Feature cards, Steps, Image with text, FAQ and Call to action blocks MAY carry a label of at most 40 characters. The page SHALL show the label above the block's heading, in small uppercase letters in the accent colour. The server SHALL refuse a longer label, or a label on any other block type.
|
||||
|
||||
#### Scenario: Label above a heading
|
||||
|
||||
- **GIVEN** a Feature cards block with the label "Services" and the heading "Everything your guests touch, handled by one team"
|
||||
- **WHEN** a visitor opens the page
|
||||
- **THEN** "Services" shows in small uppercase letters directly above the heading
|
||||
|
||||
#### Scenario: Type a label in the editor
|
||||
|
||||
- **GIVEN** staff editing a Steps block
|
||||
- **WHEN** they type "How we work" in its label field and save
|
||||
- **THEN** the page keeps the label
|
||||
|
||||
### Requirement: Serif Section Headings
|
||||
|
||||
Section headings on landing pages SHALL use the serif typeface that the full-width hero uses.
|
||||
|
||||
#### Scenario: Feature heading in serif
|
||||
|
||||
- **WHEN** a visitor opens a page with a Feature cards block
|
||||
- **THEN** its heading uses the serif typeface
|
||||
@@ -0,0 +1,9 @@
|
||||
-- The labels added by add-landing-page-polish, 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 'PagesBlockTopBar', JSON_OBJECT('en_US', 'Top bar', 'zh_CN', '顶栏'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesBlockTopBar') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '顶栏') WHERE LOWER(code) = LOWER('PagesBlockTopBar') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesEyebrow', JSON_OBJECT('en_US', 'Label', 'zh_CN', '小标签'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesEyebrow') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '小标签') WHERE LOWER(code) = LOWER('PagesEyebrow') AND area = 'A';
|
||||
INSERT INTO message (code, content, area) SELECT 'PagesTopBarFirst', JSON_OBJECT('en_US', 'The top bar must be the first section.', 'zh_CN', '顶栏必须是第一个区块。'), 'A' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM message WHERE LOWER(code) = LOWER('PagesTopBarFirst') AND area = 'A');
|
||||
UPDATE message SET content = JSON_SET(COALESCE(content, JSON_OBJECT()), '$.zh_CN', '顶栏必须是第一个区块。') WHERE LOWER(code) = LOWER('PagesTopBarFirst') AND area = 'A';
|
||||
@@ -0,0 +1,55 @@
|
||||
# Tasks
|
||||
|
||||
## 1. Server
|
||||
|
||||
- [x] 1.1 services-counter `CmsBlock`: add `eyebrow`. `CmsBlockValidator`:
|
||||
- TOPBAR is allowed only at index 0 (`PagesTopBarFirst`); it takes the button pair and `anchor` only, and any other field is refused (`PagesUnusedField`);
|
||||
- `eyebrow` at most 40 characters on FEATURES, STEPS, IMAGE_TEXT, FAQ and CTA, and refused elsewhere (`PagesUnusedField`).
|
||||
|
||||
Verify: new validator tests fail first, then pass; `mvn -T 1C -pl solvway-services-counter verify`.
|
||||
|
||||
## 2. Portal
|
||||
|
||||
- [x] 2.1 `CmsBlocks.tsx`:
|
||||
- renders TOPBAR (logo or name, optional button, sticky, full width, joins a full-width hero);
|
||||
- renders the label above section headings, in the accent colour, darkened on light backgrounds;
|
||||
- renders section h2s in serif;
|
||||
- named blocks keep clear of a sticky bar when jumped to.
|
||||
|
||||
Verify: render tests fail first, then pass; vitest exit 0.
|
||||
- [x] 2.2 Editor:
|
||||
- `cmsPages.ts`: TOPBAR type, label and empty block; `eyebrow`;
|
||||
- `BlockFields.tsx`: the top bar's button fields, and the label field on the five types; the label is editable in place on the canvas;
|
||||
- labels in `defaultMessages.ts`, `zh_CN.seed.json` and `sql/01-polish-labels.sql`; regenerate `local/seed/04-zh-cn-messages.sql`.
|
||||
|
||||
Verify: editor tests fail first, then pass; tsc and lint clean.
|
||||
|
||||
## 3. Verification
|
||||
|
||||
- [x] 3.1 Rebuild services-counter. Use Playwright on port 3001 to edit `/p/INS/hotel-technology-native` through the editor:
|
||||
- turn on "hide page header";
|
||||
- add a top bar first, with "Get My Free Consultation" linking to `#consult`;
|
||||
- add the labels "Services", "How we work", "Why Infinity" and "FAQ";
|
||||
- publish.
|
||||
|
||||
Check the published page at 1280 px and 390 px against the INS page, including the bar staying put on scroll.
|
||||
- [x] 3.2 Run the full portal vitest (exit 0), tsc, lint, Maven verify for services-counter, and `openspec validate add-landing-page-polish --strict`.
|
||||
- [x] 3.3 Add a release note to `docs/deployment.md` (label SQL).
|
||||
|
||||
## Notes (2026-12-04)
|
||||
|
||||
- **Red first:**
|
||||
- the validator tests failed on the top bar and the labels;
|
||||
- the render tests failed on the top bar, the scroll margin, the labels and the serif headings;
|
||||
- the editor test failed on the label field and the top bar.
|
||||
- **Changed existing tests:** none. One of my own new render tests changed before going green: the sticky class sits on the top bar's row, not on the header. A sticky element only sticks inside its parent, and the header's parent is just as tall as the header.
|
||||
- **Live check** (port 3001, rebuilt counter), on `/p/INS/hotel-technology-native` through the editor:
|
||||
- "hide page header" was already on;
|
||||
- added a Top bar section, moved it first, and set "Get My Free Consultation" linking to `#consult`;
|
||||
- typed the labels "Services", "How we work", "Why Infinity" and "FAQ" on the canvas;
|
||||
- saved and published.
|
||||
- **Published result:**
|
||||
- at 1280 px the logo and button sit in a white bar above the full-width hero, with no title, and the bar stays at the top while scrolling;
|
||||
- the labels show in darkened gold uppercase above serif headings;
|
||||
- at 390 px the bar keeps the logo and button, and the hero stacks.
|
||||
- **Not reachable in the UI, covered by the validator tests:** a top bar that is not first is refused (the server rule; the editor's Move up and Move down allow it, and the refusal shows on the canvas).
|
||||
Reference in new issue
Block a user