- AGENT.md: §7 full capability catalog (need → import), §0b/§3/§6 on RenderForm, SiteProviders, createPageRoute, re-exported routes, plugin section fields, resolveLink/resolveNav - PROGRAMISTA §2.4, §2.7–2.8 rewritten; §6 items 28–33 (28: FormRenderer leaked the Emails tab) - forms, links, blocks, pages, consent, turnstile, notifications, seo, mcp, i18n, deployment docs - ipal-form: RenderForm block, formClasses, CustomForm example (FormRenderer template removed), seed template handles steps and option labels per language - ipal-nav, ipal-block, ipal-setup, ipal-upgrade, ipal-seo-check, ipal-consent-check, vibe.md - ipal-audit: re-export routes and SiteProviders satisfy the mandatory set; flags form-engine copies, project section fields / navigation, server entries in client components - test/docsConsistency: docs imports exist in code; every public export is documented - CHANGELOG 1.9.2 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>
|
|
)
|
|
}
|