Files
twenty/packages/twenty-website/src/shared-utils/constructSections.tsx
T
Félix Malfait 033bedde0a Upgrade NX (#13758)
Upgrade from NX18 to NX21
2025-08-08 10:38:12 +02:00

27 lines
670 B
TypeScript

import { type DocsArticlesProps } from '@/content/user-guide/constants/getDocsArticles';
export const constructSections = (
docsArticleCards: DocsArticlesProps[],
isSection: boolean,
): { name: string; info: string }[] => {
if (isSection) {
return [
{
name: docsArticleCards[0]?.topic,
info: docsArticleCards[0]?.sectionInfo,
},
];
} else {
return Array.from(
new Map(
docsArticleCards
.filter((guide) => guide.numberOfFiles > 0)
.map((guide) => [guide.section, guide]),
).values(),
).map((guide) => ({
name: guide.section,
info: guide.sectionInfo,
}));
}
};