Docs in English (part 1), seeding guide, Coolify deployment
- 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]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6e3979bae6
commit
2d9f3e15d4
+48
-48
@@ -1,47 +1,47 @@
|
||||
# blocks
|
||||
|
||||
`RenderBlocks` — generyczny, serwerowy silnik renderowania bloków. Plugin nie
|
||||
zna Twoich bloków: iteruje po danych, mapuje `blockType` → komponent przez
|
||||
registry (prop), obsługuje zagnieżdżanie i rozszerzenia per-blok. Bloki
|
||||
(schemat + komponenty) definiujesz u siebie.
|
||||
`RenderBlocks` — a generic, server-side block rendering engine. The plugin does not
|
||||
know your blocks: it iterates over the data, maps `blockType` → component through a
|
||||
registry (prop), handles nesting and per-block extensions. You define the blocks
|
||||
(schema + components) in your project.
|
||||
|
||||
## Config
|
||||
|
||||
Brak opcji w payload.config — bloki definiujesz w swoich kolekcjach
|
||||
(pole typu `blocks`). Plugin dostarcza tylko silnik renderujący.
|
||||
No options in payload.config — you define blocks in your collections
|
||||
(a `blocks` type field). The plugin provides only the rendering engine.
|
||||
|
||||
## ⚠️ NIE pisz własnego renderera bloków (switch)
|
||||
## ⚠️ Do NOT write your own block renderer (switch)
|
||||
|
||||
**Renderer bloków to `RenderBlocks` z pluginu — NIGDY własny `switch`/`if`.**
|
||||
Częsty błąd: projekt pisze własny `BlockRenderer` z `switch (block.blockType)`
|
||||
i 20 case'ami. To łamie A0 — plugin ma silnik, projekt dostarcza tylko MAPĘ
|
||||
komponentów.
|
||||
**The block renderer is `RenderBlocks` from the plugin — NEVER your own `switch`/`if`.**
|
||||
Common mistake: the project writes its own `BlockRenderer` with `switch (block.blockType)`
|
||||
and 20 cases. That breaks A0 — the plugin has the engine, the project provides only the
|
||||
component MAP.
|
||||
|
||||
```tsx
|
||||
// ŹLE — własny switch w projekcie (gadatliwy, bez enhanceProps, rośnie liniowo)
|
||||
// WRONG — own switch in the project (verbose, no enhanceProps, grows linearly)
|
||||
switch (block.blockType) {
|
||||
case 'hero': return <Hero {...block} />
|
||||
case 'faq': return <FAQ {...block} />
|
||||
// ...20 case'ów
|
||||
// ...20 cases
|
||||
}
|
||||
|
||||
// DOBRZE — mapa + RenderBlocks (silnik z pluginu)
|
||||
// RIGHT — map + RenderBlocks (engine from the plugin)
|
||||
const registry = { hero: Hero, faq: FAQ, /* ... */ }
|
||||
<RenderBlocks blocks={page.layout} components={registry} />
|
||||
```
|
||||
|
||||
Dlaczego RenderBlocks, nie switch: enhanceProps (anchory nav, itp.), guardy,
|
||||
obsługa zagnieżdżeń, spójność między projektami. Switch tego nie ma i rośnie
|
||||
z każdym blokiem. Mapa jest płaska i deklaratywna.
|
||||
Why RenderBlocks, not a switch: enhanceProps (nav anchors, etc.), guards, nesting
|
||||
support, consistency across projects. A switch has none of this and grows with
|
||||
every block. The map is flat and declarative.
|
||||
|
||||
## Front — RenderBlocks
|
||||
|
||||
Import z `@intecion/ipal-kit/rsc` (to komponent serwerowy):
|
||||
Import from `@intecion/ipal-kit/rsc` (it is a server component):
|
||||
|
||||
```tsx
|
||||
import { RenderBlocks } from '@intecion/ipal-kit/rsc'
|
||||
|
||||
// Twój registry: blockType → komponent (komponenty są Twoje)
|
||||
// Your registry: blockType → component (the components are yours)
|
||||
import { Hero } from '@/blocks/Hero'
|
||||
import { FormBlock } from '@/blocks/FormBlock'
|
||||
|
||||
@@ -53,19 +53,19 @@ export default async function Page() {
|
||||
}
|
||||
```
|
||||
|
||||
- nieznany `blockType` → pomijany (null), nie crashuje
|
||||
- `blocks` puste / `null` → `null`
|
||||
- zagnieżdżone bloki: komponent rodzica sam renderuje `<RenderBlocks>` i **sam importuje
|
||||
registry** — silnik NIE przekazuje mapy w propsach (funkcje nie przechodzą granicy
|
||||
server→client w RSC)
|
||||
- unknown `blockType` → skipped (null), does not crash
|
||||
- `blocks` empty / `null` → `null`
|
||||
- nested blocks: the parent component renders `<RenderBlocks>` itself and **imports the
|
||||
registry itself** — the engine does NOT pass the map in props (functions do not cross the
|
||||
server→client boundary in RSC)
|
||||
|
||||
## enhanceProps — logika per-blok bez wiedzy pluginu
|
||||
## enhanceProps — per-block logic without the plugin knowing
|
||||
|
||||
Gdy blok potrzebuje danych z innych bloków (np. nawigacja zbierająca kotwice
|
||||
z sekcji), podaj `enhanceProps`. Plugin go wywołuje, nie znając Twoich bloków:
|
||||
When a block needs data from other blocks (e.g. a nav collecting anchors
|
||||
from sections), pass `enhanceProps`. The plugin calls it without knowing your blocks:
|
||||
|
||||
```tsx
|
||||
// argumenty: { block, allBlocks, index }
|
||||
// arguments: { block, allBlocks, index }
|
||||
const enhanceProps = ({ block, allBlocks }) => {
|
||||
if (block.blockType !== 'sectionNav') return {}
|
||||
const sections = allBlocks
|
||||
@@ -77,30 +77,30 @@ const enhanceProps = ({ block, allBlocks }) => {
|
||||
<RenderBlocks blocks={page.layout} components={registry} enhanceProps={enhanceProps} />
|
||||
```
|
||||
|
||||
## Wspólne pola sekcji — `buildSectionHeaderField`, `buildSectionSettingsField`
|
||||
## Shared section fields — `buildSectionHeaderField`, `buildSectionSettingsField`
|
||||
|
||||
```ts
|
||||
import { buildLinksField, buildSectionHeaderField, buildSectionSettingsField } from '@intecion/ipal-kit'
|
||||
|
||||
fields: [
|
||||
buildSectionHeaderField(), // grupa `header`: eyebrow, heading, intro (localized) — typ SectionHeaderData
|
||||
…pola bloku…,
|
||||
buildSectionHeaderField(), // `header` group: eyebrow, heading, intro (localized) — type SectionHeaderData
|
||||
…block fields…,
|
||||
buildLinksField(),
|
||||
buildSectionSettingsField(), // sidebar `settings`: anchor, background — typ SectionSettings
|
||||
buildSectionSettingsField(), // `settings` sidebar: anchor, background — type SectionSettings
|
||||
]
|
||||
```
|
||||
Domyślnie: `header` (interfejs `SectionHeaderData`), `settings` w sidebarze (interfejs `SectionSettings`)
|
||||
z `anchor` i `background` (`default` / `muted` / `inverted`, domyślnie pierwsza wartość).
|
||||
Wszystko do zmiany: `buildSectionSettingsField({ backgrounds: [{ label: 'Brand', value: 'brand' }], anchor: false,
|
||||
fields: [{ name: 'spacing', … }] })`, `backgrounds: false` (bez wyboru tła), `buildSectionHeaderField({ name, fields,
|
||||
interfaceName })`. Wartości tła mapuje na klasy `<Section>` projektu. Kształt danych taki jak dawne
|
||||
`src/fields/sectionHeader.ts` / `sectionSettings.ts` z kod-sekcji.md — zamiana importu nie wymaga migracji.
|
||||
Default: `header` (interface `SectionHeaderData`), `settings` in the sidebar (interface `SectionSettings`)
|
||||
with `anchor` and `background` (`default` / `muted` / `inverted`, the first value by default).
|
||||
Everything can be changed: `buildSectionSettingsField({ backgrounds: [{ label: 'Brand', value: 'brand' }], anchor: false,
|
||||
fields: [{ name: 'spacing', … }] })`, `backgrounds: false` (no background choice), `buildSectionHeaderField({ name, fields,
|
||||
interfaceName })`. The project maps the background values to its `<Section>` classes. The data shape matches the former
|
||||
`src/fields/sectionHeader.ts` / `sectionSettings.ts` from section-code.md — swapping the import needs no migration.
|
||||
|
||||
## Komponent bloku
|
||||
## Block component
|
||||
|
||||
Każdy komponent dostaje dane bloku jako propsy (plus to, co zwróci `enhanceProps`;
|
||||
w `createPageRoute` dodatkowo `locale`, `isFirst` i `blockProps` — frontend.md). Spacing/layout należą do Ciebie — silnik nie owija
|
||||
bloków żadnym markupem.
|
||||
Each component gets the block data as props (plus whatever `enhanceProps` returns;
|
||||
in `createPageRoute` also `locale`, `isFirst` and `blockProps` — frontend.md). Spacing/layout are yours — the engine does not wrap
|
||||
blocks in any markup.
|
||||
|
||||
```tsx
|
||||
export function Hero(props) {
|
||||
@@ -108,12 +108,12 @@ export function Hero(props) {
|
||||
}
|
||||
```
|
||||
|
||||
Typy: `BlockComponentMap`, `BlockData`, `EnhanceProps`, `RenderBlocksProps` (`/rsc`),
|
||||
Types: `BlockComponentMap`, `BlockData`, `EnhanceProps`, `RenderBlocksProps` (`/rsc`),
|
||||
`SectionHeaderFieldOptions`, `SectionSettingsFieldOptions` (root).
|
||||
|
||||
## Wyłączenie, nadpisanie, rozszerzenie
|
||||
## Turn off, override, extend
|
||||
|
||||
- Moduł nie ma opcji w `ipalKit()` — nic nie dodaje do schematu; `RenderBlocks` używasz albo nie.
|
||||
- Mapę komponentów i schematy bloków trzyma projekt; logikę per blok dokładasz przez `enhanceProps`.
|
||||
- `buildSectionHeaderField` / `buildSectionSettingsField`: `name`, `fields` (dodatkowe pola), `interfaceName`, `anchor: false`, `backgrounds: […] | false`.
|
||||
- Silnik nie owija bloków markupem i nie ma opcji wrappera — opakowanie robi komponent projektu.
|
||||
- The module has no options in `ipalKit()` — it adds nothing to the schema; you either use `RenderBlocks` or not.
|
||||
- The project keeps the component map and the block schemas; add per-block logic through `enhanceProps`.
|
||||
- `buildSectionHeaderField` / `buildSectionSettingsField`: `name`, `fields` (extra fields), `interfaceName`, `anchor: false`, `backgrounds: […] | false`.
|
||||
- The engine does not wrap blocks in markup and has no wrapper option — the project component does the wrapping.
|
||||
|
||||
Reference in New Issue
Block a user