Import instead of code: panel forms (steps, choice lists, dates), layout, page route, GEO routes, links, section fields
- Forms: step and checkboxGroup field types (radio, date on), server validation for them, useBuilderForm (logic) + BuilderForm (unstyled default) + RenderForm (/rsc: rich text, bound action, public part of the form only — the Emails tab never reaches the browser) - Notifications: next / back / stepOf texts - createContentHelpers: getSiteShell, getFormTexts, getLinkOptions, resolveLink, resolveNav, resolvePageRedirect, one-line route handlers (llms, llms-full, md, mcp, health, indexnow, manifest) - /rsc: SiteProviders, createPageRoute, createNotFoundPage - resolveLink / resolveNav / homeSlugFrom, buildSectionHeaderField / buildSectionSettingsField - Dev sandbox frontend built on these imports; tests (unit + real Payload) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { notFound, permanentRedirect } from 'next/navigation.js'
|
||||
import { createPageRoute } from '@intecion/ipal-kit/rsc'
|
||||
|
||||
import { FormBlock } from '../../../../blocks/FormBlock.js'
|
||||
import * as content from '../../../../lib/content.js'
|
||||
import { sendForm } from '../actions.js'
|
||||
|
||||
export const revalidate = 3600
|
||||
|
||||
const route = createPageRoute(content, {
|
||||
blockProps: async ({ locale }) => ({ formTexts: await content.getFormTexts(locale), sendForm }),
|
||||
blocks: { formBlock: FormBlock },
|
||||
notFound,
|
||||
permanentRedirect,
|
||||
})
|
||||
export default route.Page
|
||||
export const generateMetadata = route.generateMetadata
|
||||
export const generateStaticParams = route.generateStaticParams
|
||||
@@ -0,0 +1,7 @@
|
||||
'use server'
|
||||
import { headers } from 'next/headers.js'
|
||||
import { createSubmitAction } from '@intecion/ipal-kit/server'
|
||||
|
||||
import { getCachedPayload } from '../../../lib/content.js'
|
||||
|
||||
export const sendForm = createSubmitAction({ getCachedPayload, headers })
|
||||
@@ -0,0 +1,22 @@
|
||||
import { notFound } from 'next/navigation.js'
|
||||
import { CookieBanner } from '@intecion/ipal-kit/client'
|
||||
import { SiteProviders } from '@intecion/ipal-kit/rsc'
|
||||
|
||||
import { getConfiguredLocales, getSiteShell } from '../../../lib/content.js'
|
||||
import './styles.css'
|
||||
|
||||
type Props = { children: React.ReactNode; params: Promise<{ locale: string }> }
|
||||
|
||||
export default async function LocaleLayout({ children, params }: Props) {
|
||||
const { locale } = await params
|
||||
if (!(await getConfiguredLocales()).includes(locale)) notFound()
|
||||
return (
|
||||
<html lang={locale}>
|
||||
<body>
|
||||
<SiteProviders banner={<CookieBanner equalChoice />} logEndpoint="/api/ipal/consent" shell={await getSiteShell(locale)}>
|
||||
<main>{children}</main>
|
||||
</SiteProviders>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { createNotFoundPage } from '@intecion/ipal-kit/rsc'
|
||||
|
||||
import { FormBlock } from '../../../blocks/FormBlock.js'
|
||||
import * as content from '../../../lib/content.js'
|
||||
|
||||
export default createNotFoundPage(content, { blocks: { formBlock: FormBlock }, fallback: <h1>404</h1> })
|
||||
@@ -0,0 +1,10 @@
|
||||
/* Sandbox look — in a project this is the design system. */
|
||||
body { font-family: system-ui, sans-serif; margin: 0 auto; max-width: 40rem; padding: 1rem; }
|
||||
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); }
|
||||
.field { grid-column: span 2; } .half { grid-column: span 1; }
|
||||
.label, legend { display: block; font-weight: 600; margin-bottom: .25rem; }
|
||||
.input { border: 1px solid #999; border-radius: 6px; box-sizing: border-box; padding: .5rem; width: 100%; }
|
||||
.choices { border: 0; display: grid; gap: .25rem; margin: 0; padding: 0; } .choice { display: flex; gap: .5rem; }
|
||||
.error { color: #b00020; } .progress { color: #555; } .step-title { font-size: 1.25rem; font-weight: 700; }
|
||||
.actions { display: flex; gap: .5rem; margin-top: 1rem; } .btn { background: #111; border: 0; border-radius: 6px; color: #fff; padding: .6rem 1rem; }
|
||||
.btn-secondary { background: #ddd; color: #111; } .success { background: #e7f7ec; padding: 1rem; }
|
||||
@@ -0,0 +1,2 @@
|
||||
export { mcpGET as GET, mcpPOST as POST } from '../../../lib/content.js'
|
||||
export const dynamic = 'force-dynamic'
|
||||
@@ -0,0 +1,2 @@
|
||||
export { llmsRoute as GET } from '../../lib/content.js'
|
||||
export const dynamic = 'force-dynamic'
|
||||
Reference in New Issue
Block a user