- Translate to English every doc the code branches did not touch: AGENT.md, developer guide, vibe, CHANGELOG, docs index, module pages, all skills except ipal-seo-check (14 pages follow after the security/SEO merge). Placeholder marker is now [TO FILL: …]; skill resources renamed to section-code.md / nav-code.md. AGENT.md and the ipal-skills pointer block say the docs are in English. - docs/seeding.md: create-only, natural keys, never delete, no users or secrets, empty-field globals, fallbackLocale: false, dry run, backup and restore, production update guard, seeds vs migrations, Coolify Terminal. Seed templates gain --dry-run, the SEED_UPDATE production guard (IPAL_SEED_ALLOW_PROD_UPDATE), skip of edited records and a summary. "Seeding on production" rule block in AGENT.md. - Coolify is the single deployment path (deployment, env, developer guide, ipal-setup): build vs runtime env, migrations on container start (prodMigrations), health check and rolling updates, rollback, backups and restore, DNS/Let's Encrypt/CAA. R2: custom domain needs a Cloudflare zone; default is media served by the app (R2_PUBLIC_URL empty). - docsConsistency: no Polish prose outside code/quoted data (pending pages listed); IPAL_* names may also be read by shipped skill templates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
54 lines
3.9 KiB
Markdown
54 lines
3.9 KiB
Markdown
---
|
||
name: ipal-block
|
||
description: Builds or refactors one page section (Payload block + React component) in an ipal-kit project the correct way — a clean editor panel (repeatable things as "+ Add …" arrays with rowLabel, never cta1/cta2 slots, short English labels, no empty spare fields), shared fields from the plugin (buildSectionHeaderField, buildLinksField, buildLinkField, buildSectionSettingsField), UI primitives (Section, SectionHeader, Media, CMSLink), fixed field vocabulary, max ~80 lines of JSX, subcomponents for repeated items, registry wiring. Use when creating a new section/block (hero, features, CTA, FAQ, gallery, pricing, testimonials…), changing a block's fields, or fixing a block with ctaLabel/buttonUrl/pdfUrl fields or a monolithic component.
|
||
---
|
||
|
||
# ipal-block
|
||
|
||
One section per use of this skill. Details and ready code:
|
||
`node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` §6.
|
||
|
||
## 0. Prerequisites
|
||
Check that these exist: `src/components/ui/{CMSLink,Button,Media,Section,SectionHeader}.tsx`.
|
||
Old `src/fields/sectionHeader.ts` / `sectionSettings.ts` → replace with the plugin import and delete them (blocks.md, no migration).
|
||
Links (`buildLinkField`, `buildLinksField`, `resolveLink`) and section fields (`buildSectionHeaderField`, `buildSectionSettingsField`) come from the plugin — do not create them in the project.
|
||
Missing → first create them 1:1 from `resources/section-code.md` (this skill)
|
||
(and tell the user). Do not write your own versions.
|
||
|
||
## 1. Plan (write 3–5 points, then go straight to code — AGENT.md §0a)
|
||
- block slug (camelCase), folder name (PascalCase),
|
||
- the field list, **only** from the AGENT.md §6.5 vocabulary:
|
||
`header`, `media`, `links`, `link`, `items` (+ `heading`, `text`, `content`), `settings`,
|
||
- whether `items` get a `<Name>Card.tsx` subcomponent,
|
||
- whether interaction is needed → a separate `'use client'` file (try `<details>`/`<dialog>` first),
|
||
- whether the section is a variant of an existing block (then a `variant: select` field, not a new block).
|
||
|
||
## 2. Code
|
||
File patterns (Hero, FeatureGrid + FeatureCard): `resources/section-code.md`.
|
||
|
||
1. `src/blocks/<Name>/config.ts` — `interfaceName: '<Name>Block'`, fields from the plan,
|
||
always `buildSectionSettingsField()`. CTA = `buildLinksField()`, never `cta*`/`button*` fields.
|
||
A downloadable file = a link of type `file`. **Panel per AGENT.md §6.5a:**
|
||
- repeatable → an array with `labels: { singular, plural }` + `admin: { initCollapsed: true, components: rowLabel('heading', '<Singular>') }`, `maxRows` from the design;
|
||
- no numbered fields (`cta1`, `feature2Title`, `image3`) and no spare fields "just in case";
|
||
- EN labels of 1–3 words, `description` only when needed (≤ 80 chars, what/where, an example);
|
||
- dependent fields use `admin.condition`, a variant = a `variant` select, > ~10 fields → `tabs`;
|
||
- block: `labels: { singular: 'Feature grid', plural: 'Feature grids' }`.
|
||
2. `src/blocks/<Name>/Component.tsx` — named export, type from `@/payload-types`
|
||
(`<Name>Block & { locale: string }`), structure:
|
||
`<Section settings>` → `<SectionHeader header>` → content with `<Media>`, `<CMSLink>`,
|
||
`items.map(<Card/>)`. No text, `href`, `<img>`, hex colors or inline SVG.
|
||
3. Subcomponents go in the same folder; shared by 2+ sections → `src/components/ui/`.
|
||
4. Add `config.ts` to `layout` in `src/collections/Pages.ts`,
|
||
and the component to `src/blocks/registry.ts` (key = slug).
|
||
5. `pnpm generate:types`.
|
||
|
||
## 3. Check
|
||
- `Component.tsx` ≤ ~80 lines of JSX.
|
||
- **Empty block test** in the panel: ≤ 6 items at the start, everything in English,
|
||
"+ Add Button / Add Feature", collapsed rows showing their content, every field shows something.
|
||
First `rowLabel` in the project → `pnpm payload generate:importmap`.
|
||
- Run the **ipal-audit** skill (`--quick`), fix every `[ERROR]`.
|
||
- Refactoring an existing block with renamed fields: **migrate the data first**
|
||
(old field → new), and only then remove the old fields (AGENT.md §6.7).
|