diff --git a/dev/app/(frontend)/[locale]/[[...slug]]/page.tsx b/dev/app/(frontend)/[locale]/[[...slug]]/page.tsx new file mode 100644 index 0000000..bf4962a --- /dev/null +++ b/dev/app/(frontend)/[locale]/[[...slug]]/page.tsx @@ -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 diff --git a/dev/app/(frontend)/[locale]/actions.ts b/dev/app/(frontend)/[locale]/actions.ts new file mode 100644 index 0000000..d2e3538 --- /dev/null +++ b/dev/app/(frontend)/[locale]/actions.ts @@ -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 }) diff --git a/dev/app/(frontend)/[locale]/layout.tsx b/dev/app/(frontend)/[locale]/layout.tsx new file mode 100644 index 0000000..bfe74ac --- /dev/null +++ b/dev/app/(frontend)/[locale]/layout.tsx @@ -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 ( + +
{error}
{progress}
{step.title}
{step.description}
{f.errorMessage}