This PR introduces Keystatic to let us edit twenty.com's content with a CMS. For now, we'll focus on creating release notes through Keystatic as it uses quite simple Markdown. Other types of content will need some refactoring to work with Keystatic. https://github.com/user-attachments/assets/e9f85bbf-daff-4b41-bc97-d1baf63758b2 --------- Co-authored-by: Félix Malfait <felix@twenty.com>
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { desc } from 'drizzle-orm';
|
|
import { Metadata } from 'next';
|
|
|
|
import {
|
|
getMdxReleasesContent,
|
|
getReleases,
|
|
} from '@/app/(public)/releases/utils/get-releases';
|
|
import { getVisibleReleases } from '@/app/(public)/releases/utils/get-visible-releases';
|
|
import { ReleaseContainer } from '@/app/_components/releases/ReleaseContainer';
|
|
import { Title } from '@/app/_components/releases/StyledTitle';
|
|
import { ContentContainer } from '@/app/_components/ui/layout/ContentContainer';
|
|
import { findAll } from '@/database/database';
|
|
import { GithubReleases, githubReleasesModel } from '@/database/model';
|
|
import { pgGithubReleasesModel } from '@/database/schema-postgres';
|
|
|
|
export const metadata: Metadata = {
|
|
title: 'Twenty - Releases',
|
|
description:
|
|
'Discover the newest features and improvements in Twenty, the #1 open-source CRM.',
|
|
};
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
const Home = async () => {
|
|
const githubReleases = (await findAll(
|
|
githubReleasesModel,
|
|
desc(pgGithubReleasesModel.publishedAt),
|
|
)) as GithubReleases[];
|
|
|
|
const latestGithubRelease = githubReleases[0];
|
|
const releaseNotes = await getReleases();
|
|
|
|
const visibleReleasesNotes = getVisibleReleases(
|
|
releaseNotes,
|
|
latestGithubRelease.tagName,
|
|
);
|
|
|
|
const mdxReleasesContent = await getMdxReleasesContent(releaseNotes);
|
|
|
|
return (
|
|
<ContentContainer>
|
|
<Title />
|
|
<ReleaseContainer
|
|
visibleReleasesNotes={visibleReleasesNotes}
|
|
githubReleases={githubReleases}
|
|
mdxReleasesContent={mdxReleasesContent}
|
|
/>
|
|
</ContentContainer>
|
|
);
|
|
};
|
|
|
|
export default Home;
|