434df8a94c
[PR #14917](https://github.com/twentyhq/twenty/pull/14917/files#diff-e37dead9533eef25d3a1ac323bb68e93ad2edbb932e972e48f4c756e3c2d5c0f) upgraded twenty-website to Next.js v15, which requires React 19. However, the twenty-ui package (imported by twenty-website) uses React 18.2, causing a React version mismatch error. Solution : Downgrade Next.js from ^15.5.4 to ^14.2.0 to maintain compatibility with React 18.2 used across the monorepo.
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { type Metadata } from 'next';
|
|
import { notFound } from 'next/navigation';
|
|
|
|
import DocsMain from '@/app/_components/docs/DocsMain';
|
|
import { getDocsArticles } from '@/content/user-guide/constants/getDocsArticles';
|
|
import { fetchArticleFromSlug } from '@/shared-utils/fetchArticleFromSlug';
|
|
import { formatSlug } from '@/shared-utils/formatSlug';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
export async function generateMetadata(
|
|
props: { params: Promise<{ folder: string }> },
|
|
): Promise<Metadata> {
|
|
const { folder } = await props.params;
|
|
const formattedSlug = formatSlug(folder);
|
|
const basePath = '/src/content/user-guide';
|
|
const mainPost = await fetchArticleFromSlug(folder, basePath);
|
|
return {
|
|
title: 'Twenty - ' + formattedSlug,
|
|
description: mainPost?.itemInfo?.info,
|
|
};
|
|
}
|
|
|
|
export default async function UserGuideSlug(
|
|
props: { params: Promise<{ folder: string }> },
|
|
) {
|
|
const { folder } = await props.params;
|
|
const filePath = `src/content/user-guide/${folder}/`;
|
|
const docsArticleCards = getDocsArticles(filePath);
|
|
const isSection = true;
|
|
const hasOnlyEmptySections = docsArticleCards.every(
|
|
(article) => article.topic === 'Empty Section',
|
|
);
|
|
if (!docsArticleCards || hasOnlyEmptySections) {
|
|
notFound();
|
|
}
|
|
return <DocsMain docsArticleCards={docsArticleCards} isSection={isSection} />;
|
|
}
|