reference/ is one complete client site on the plugin (made-up company, pl/en, MongoDB, every library block and template, token standard light/dark, forms, consent, SEO/GEO, enforced CSP, 2FA, base + demo seeds, Coolify runbook, smoke tests). It uses the plugin as file:.. (injected) and is not shipped. - docs/agent/reference-site/INDEX.md (generated by scripts/reference-index.mjs, kept current by test/referenceIndex.test.ts) - AGENT.md section and pointers in ipal-site, ipal-setup, ipal-reference, ipal-upgrade, ipal-block; release steps in PROGRAMISTA §8.1b - CI: reference (fast) on every push, reference-full on main; doctor steps wired, commented until ipal-doctor ships Co-Authored-By: Claude Opus 5.5 <[email protected]>
27 lines
1.5 KiB
TypeScript
27 lines
1.5 KiB
TypeScript
// src/blocks/FormBlock/Component.tsx — a panel form inside a section. Logic, steps,
|
|
// validation, Turnstile, honeypot and rich text come from ipal-kit; the look is
|
|
// formClasses (one file for every form on the site).
|
|
// Block config (src/blocks/FormBlock/config.ts): slug 'formBlock', fields
|
|
// buildSectionHeaderField(), { name: 'form', type: 'relationship', relationTo: 'forms', required: true },
|
|
// buildSectionSettingsField()
|
|
// Page query depth ≥ 1, otherwise `form` is just an ID (RenderForm renders nothing).
|
|
// `formTexts` and `sendForm` arrive via createPageRoute blockProps (ipal-form SKILL §4).
|
|
import type { FormNotificationTexts } from '@intecion/ipal-kit'
|
|
import { RenderForm, type SendFormAction } from '@intecion/ipal-kit/rsc'
|
|
import type { FormBlock as FormBlockData } from '@/payload-types'
|
|
import { formClasses } from '@/components/forms/formClasses'
|
|
import { Section } from '@/components/ui/Section'
|
|
import { SectionHeader } from '@/components/ui/SectionHeader'
|
|
|
|
type Props = FormBlockData & { locale: string; formTexts?: FormNotificationTexts; sendForm?: SendFormAction }
|
|
|
|
export function FormBlock({ form, header, settings, locale, formTexts, sendForm }: Props) {
|
|
if (!formTexts || !sendForm) return null // never a fake/hardcoded form
|
|
return (
|
|
<Section settings={settings}>
|
|
<SectionHeader header={header} />
|
|
<RenderForm form={form} action={sendForm} locale={locale} texts={formTexts} classNames={formClasses} />
|
|
</Section>
|
|
)
|
|
}
|